[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
--enable-shared
----------------------------+-----------------------------------------------
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
think?
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 =>
/home/tener//lib/slayer-0.3.1/ghc-6.12.1/libHSslayer-0.3.1-ghc6.12.1.so
(0xb7793000)
libHStemplate-0.1.1.1-ghc6.12.1.so =>
/home/tener//lib/template-0.1.1.1/ghc-6.12.1/libHStemplate-0.1.1.1-ghc6.12.1.so
(...)
libgmp.so.3 => /usr/lib/libgmp.so.3 (0xb5c16000)
libHSghc-prim-0.2.0.0-ghc6.12.1.so => /usr/lib/ghc-6.12.1/ghc-
prim-0.2.0.0/libHSghc-prim-0.2.0.0-ghc6.12.1.so (0xb5ba3000)
libHSrts-ghc6.12.1.so => /usr/lib/ghc-6.12.1/libHSrts-ghc6.12.1.so
(0xb5b5e000)
libm.so.6 => /lib/libm.so.6 (0xb5b37000)
libHSffi-ghc6.12.1.so => /usr/lib/ghc-6.12.1/libHSffi-ghc6.12.1.so
(0xb5b2e000)
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
statically.
> > 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
9
}}}
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