#1452: "undefined reference" while linking executable (for cyclic import 
project)
in ghc-6.6.1
------------------------------+---------------------------------------------
    Reporter:  guest          |        Owner:  guest           
        Type:  bug            |       Status:  assigned        
    Priority:  normal         |    Milestone:                  
   Component:  Compiler       |      Version:  6.6.1           
    Severity:  normal         |   Resolution:                  
    Keywords:  cyclic import  |   Difficulty:  Moderate (1 day)
          Os:  Linux          |     Testcase:                  
Architecture:  x86            |  
------------------------------+---------------------------------------------
Comment (by simonpj):

 Just to make this 100% explicit:

  * Cabal uses ghc --make to build a bunch of .o files (including Match.o)

  * Cabal then links the .o files that are listed in dm.cabal (as exposed
 or other) to make a .a file.  This list accidentally excludes Match.o

  * Cabal copies the .a file and the .hi files listed in dm.cabal (as
 exposed or other) to the install place, and registers them.  Again, this
 list excludes Match.o

 As a result, a client of the package compiles all right (so long as it
 does not import Match) but fails at the link stage, lacking symbols in
 Match.

 This seems like a bug in Cabal, because it allows you to build and install
 an unusable package.  Possible solutions I can think of:

  * Cabal does its own dependency analysis and calls GHC one module at a
 time

  * GHC gets a flag which prevents it finding any module other than those
 listed on the command line (although it may still do dependency analysis
 to figure out which order to compile them in)

  * The .cabal file is no longer reqd to list non-exposed modules.  Instead
 Cabal works out what the non-exposed modules are (perhaps by calling GHC
 -M or something similar).

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1452>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to