[Haskell-cafe] GHC and libc
Sven Panne
Sven.Panne at aedion.de
Sat May 15 18:28:41 EDT 2004
Per Larsson wrote:
> [...] Is there a GHC switch that I have missed that enables you to statically link
> the parts of libc that is used by the haskell program? [...]
Passing "-static" to the GNU linker results in a, well, statically linked program. :-)
Using "-optl -static" with GHC does what you want, see:
http://haskell.org/ghc/docs/latest/html/users_guide/options-phases.html#FORCING-OPTIONS-THROUGH
And here the proof:
panne at jeanluc:> ghc --make -optl -static Main.hs
Chasing modules from: Main.hs
Compiling Main ( Main.hs, Main.o )
Linking ...
panne at jeanluc:> file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, statically linked, not stripped
panne at jeanluc:> ldd a.out
not a dynamic executable
For non-GNU linkers consult the man pages for "ld", differing linking techniques
are one of the most annoying incompatibilities between different *nices IMHO.
Cheers,
S.
More information about the Haskell-Cafe
mailing list