dmd link mystery on linux

John Belmonte john at neggie.net
Sat May 19 16:58:35 PDT 2012


I'm having a problem where the link command line generated by dmd 
is picking up the globally-installed version of the phobos 
library instead of my local one.  I'm using a dmd.conf pointing 
at my local phobos build so this shouldn't be happening.  From 
output of "dmd rdmd.d -v":

   gcc rdmd.o -o rdmd -m64 -Xlinker 
-L/home/john/dev/d/phobos/generated/linux/release/64 -lphobos2 
-lpthread -lm -lrt

which looks right to me (referenced dir contains libphobos2.a).  
I know this is picking up the wrong phobos2 because the 
globally-installed version is missing some required symbols.  If 
I move the global .a out of the way my local lib is picked up and 
the link and subsequent run are fine.

More strangely, if I remove -Xlinker from that link line my local 
lib is again picked up.  From my understanding, omitting -Xlinker 
causes gcc to interpret the -L option natively.  Does anyone know 
why this would make a difference, or can anyone point out what 
I'm missing?

Also, I'm wondering if anyone else would find it useful for the 
update.sh tool to automatically generate a dmd.conf which points 
to the local druntime and phobos.



More information about the Digitalmars-d mailing list