[Hackage] #600: Cabal should use -dynamic linking for executable when package configured --enable-shared

Hackage trac at galois.com
Tue Jan 26 08:56:03 EST 2010

#600: Cabal should use -dynamic linking for executable when package configured
  Reporter:  juhp           |        Owner:           
      Type:  defect         |       Status:  new      
  Priority:  normal         |    Milestone:  Cabal-1.8
 Component:  Cabal library  |      Version:  HEAD     
  Severity:  normal         |     Keywords:           
Difficulty:  unknown        |   Ghcversion:           
  Platform:  Linux          |  

Comment(by KrzysztofSkrzetnicki):

 Replying to [comment:6 juhp]:
 > Replying to [comment:5 KrzysztofSkrzetnicki]:
 > > It should also be noted that simply building with {{{ghc --make
 -dynamic program.hs}}} works correctly
 > Right but that does not give you dynamic linking to your library, I

 It does, actually. I've moved executable to a different directory to force
 GHC to use library installed in the system (instead of picking up modules
 from directory tree) and command {{{ghc --make -dynamic fake_main.hs}}}
 went successfully. The resulting executable uses shared libraries:
 $ ghc --make -dynamic fake_main
 [1 of 1] Compiling Main             ( fake_main.hs, fake_main.o )
 Linking fake_main ...
 $ ldd fake_main
         linux-gate.so.1 =>  (0xb7881000)
         libHSslayer-0.3.1-ghc6.12.1.so =>
         libHStemplate- =>
         libgmp.so.3 => /usr/lib/libgmp.so.3 (0xb5c16000)
         libHSghc-prim- => /usr/lib/ghc-6.12.1/ghc-
 prim- (0xb5ba3000)
         libHSrts-ghc6.12.1.so => /usr/lib/ghc-6.12.1/libHSrts-ghc6.12.1.so
         libm.so.6 => /lib/libm.so.6 (0xb5b37000)
         libHSffi-ghc6.12.1.so => /usr/lib/ghc-6.12.1/libHSffi-ghc6.12.1.so
         libc.so.6 => /lib/libc.so.6 (0xb59e7000)
         libpthread.so.0 => /lib/libpthread.so.0 (0xb59cd000)
         /lib/ld-linux.so.2 (0xb7882000)
 There are '''52''' .so libs in total as opposed to '''9''' when linking

 > > and so does {{{cabal install --enable-shared}}} with libraries.
 > and no dynamic executable in this case.
 > Have you tried dynamic and shared without profiling?

 Here is the output:
 $ cabal install --disable-library-profiling --enable-shared
 $ ldd dist/build/slayer/slayer | wc -l
 It's definitely statical.

 > (I guess the Cabal version metadata in trac needs updating
 > I hope this can be fixed in 1.10.)

 It's not critical issue but I hope that too.

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

More information about the cabal-devel mailing list