Manually linking druntime and phobos2

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Fri Jul 23 05:39:21 PDT 2010


On Fri, 23 Jul 2010 06:50:08 -0400, Michel Fortin wrote:

> When manually calling the linker, which libraries should be linked with
> a d object file? If I run dmd with the -v option on Mac OS X, I notice
> dmd issues the following linker command:
> 
> gcc test.o -o test -m32 -Xlinker
> -L/Library/Compilers/dmd2/osx/bin/../lib -lphobos2 -lpthread -lm
> 
> which includes library phobos2 but not druntime. I've made D for Xcode
> link both phobos2 and druntime in the final executable; this cause no
> problem on Mac OS X 10.6 (Snow Leopard) but I have a user on 10.5
> (Leopard) who gets duplicate symbols in druntime and phobos2 because of
> this.
> 
> So now I wonder, is druntime included into the phobos2 library? Is this
> how it should be?

It seems that at least parts of druntime gets included in the Phobos 
library.  Here is the line (200) from the Phobos makefile that builds the 
file libphobos2.a:

  $(DMD) $(DFLAGS) -lib -of$@ $(DRUNTIME) $(D_FILES) $(OBJS)

The variable $(DRUNTIME) contains the path to libdruntime.a.  If it is 
removed, Phobos still compiles just fine, so I suspect it shouldn't be 
there.

-Lars


More information about the Digitalmars-d mailing list