On 04.03.2005, at 04:35, Simon Marlow wrote:
On 03 March 2005 20:41, Wolfgang Thaller wrote:
I've run into yet another (non-critical) build system problem related to dynamic linking.
Libraries that are listed in "hs-libraries" get different versions according to the current way, while libraries in extra-libraries don't. The library libHSbase_cbits is in extra_libraries because it's written entirely in C, so having a separate profiling version is not necessary. However, it _does_ make sense to have a separate libHSbase_dyn.[dylib|so]. It would have to be in hs-libraries for that to work.
Do you mean libHSbase_cbits_dyn.[dylib|so]?
Of course, that's what I wanted to say.
Why doesn't that work?
The only thing about dynamic linking that you need to know to understand this is that dynamic libraries in GHC get the _dyn suffix so that we are in control of whether they are used or not. If we just had libHSfoo.[dylib|so], then it would be quite hard to prevent ld from using that when we want a static build. Passing -static to gcc/ld is too extreme, after all, we still want to dynamically link to all the "foreign" libraries.
For every entry "foo" in hs-libraries, GHC generates a -l option like -lfoo, -lfoo_p, -lfoo_dyn or -lfoo_p_dyn depending on the profiling and dynamic linking settings.
For entries in extra-libraries, GHC doesn't do this, so "X11" will just be used as -lX11.
Now libHSbase_cbits is in extra-libraries, because we don't need a separate profiling version. But we do want to use -lHSbase_cbits_dyn if -dynamic is specified and plain old -lHSbase_cbits if it's not. However if we move it from extra-libraries to hs-libraries, then GHC will use -lHSbase_cbits_p when profiling.
So the current situation is that libHSbase_cbits.a and libHSbase_cbits_dyn.dylib are built and installed, but when you link an executable using -dynamic, only the first of the two will ever get used (the latter actually gets used by GHCi in a "dynamic" build of GHC).
Cheers,
Wolfgang
_______________________________________________ Cvs-ghc mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/cvs-ghc
