digitalmars.D.learn - using scons on 64-bit platform, with gdc
Hi, Not sure it is a bug or a misuse of scons, but on Saucy 64, with scons --version script: v2.3.0, 2013/03/03 09:48:35, by garyo on reepicheep engine: v2.3.0, 2013/03/03 09:48:35, by garyo on reepicheep and a simple SConstruct like: import os env = Environment(ENV = os.environ) env.Program(target='test01', source=Split('test01.d')); it tries to execute: scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... gcc -o test01 -m32 test01.o -L/usr/lib -lphobos2 -lpthread -lm /usr/bin/ld: cannot find -lphobos2 collect2: error: ld returned 1 exit status scons: *** [test01] Error 1 scons: building terminated because of errors. which is expected to fail since: 1) the architecture (and the libraries) are m64, not m32 (why does scons believe that?) 2) the gdc's phobos libraries is called libgphobos2, not libphobos2 Manually correcting and executing the offending line: gcc -o test01 -m64 test01.o -L/usr/lib -lgphobos2 -lpthread -lm works as expected.
Sep 18 2013
On Wednesday, 18 September 2013 at 07:09:27 UTC, eles wrote:import os env = Environment(ENV = os.environ)gcc -o test01 -m32 test01.o -L/usr/lib -lphobos2 -lpthread -lmRelated, why the scons is passing the -L/usr/lib to the gcc, while the LD_LIBRARY_PATH variable of my bash shell is rather: /opt/gdc-4.9/lib/../lib64 This provides a bad version of lib(g)phobos.a. The verbose invocation of gcc (no -L parameter), that is: gcc -v -o test01 -m64 test01.o -lgphobos2 -lpthread -lm correctly specifies: LIBRARY_PATH=/opt/gdc-4.9/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/:/opt/gdc-4.9/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../lib64/:/lib/x86_64-linux-gnu/:/lib/../lib64/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib64/:/opt/gdc-4.9/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../:/lib/:/usr/lib/ and finds the libgphobos.a from: /opt/gdc-4.9/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../lib64/ which, indeed, is the correct version. Note that I have two installations of gdc, but the PATH of /opt/gdc-4.9/bin preceded the /usr/bin: $ which -a gcc /opt/gdc-4.9/bin/gcc /usr/bin/gcc
Sep 18 2013