[Hackage] #179: support GHC's main-is extension

Hackage cvs-ghc at haskell.org
Tue Jun 21 13:04:53 CEST 2011


#179: support GHC's main-is extension
----------------------------+-----------------------------------------------
  Reporter:  duncan         |        Owner:          
      Type:  enhancement    |       Status:  reopened
  Priority:  low            |    Milestone:  _|_     
 Component:  Cabal library  |      Version:  1.2.2.0 
  Severity:  normal         |   Resolution:          
  Keywords:                 |   Difficulty:  normal  
Ghcversion:  6.4.2          |     Platform:  Linux   
----------------------------+-----------------------------------------------

Comment(by cjs):

 Ah, sorry. Basically, different and incompatible object files are produced
 when you compile the same source with and without --main-is. Any object
 files compiled with --main-is cannot be linked into another program (that
 has its own main) because the two main functions will conflict at the link
 stage. Basically, the link stage doesn't know from main, it just links all
 the stuff together and depends on one (and only one) object file to have a
 program entry point (a "main") of some sort specified.

 This is a bit insidious because the object files go to the same location
 when compiled with or without --main-is. So if you do a clean build of
 some system with your --main-is set to one module, you will successfully
 link your final program. If you re-compile with the --main-is option
 reset, the GHC dependency checker (--make option) does not know that
 another module was previously compiled with --main-is, and when you hit
 the link stage you will get an error.

 Well, this is more or less how I remember it. If this still doesn't make
 sense, it's probably best to contact me via e-mail (cjs at cynic.net) and I
 can put together an example that demonstrates the problem more precisely,
 and give suggestions on how to have the build system deal with the issue
 (essentially, putting any object files compiled with --main-is in a
 separate object directory or just giving them different names).

-- 
Ticket URL: <http://hackage.haskell.org/trac/hackage/ticket/179#comment:23>
Hackage <http://haskell.org/cabal/>
Hackage: Cabal and related projects



More information about the cabal-devel mailing list