On Sat, 2012-12-15 at 11:19 -0800, H. S. Teoh wrote:
[…]
> But I have trouble when I try to link to it. For some reason, the dmd
> link command isn't picking up the value of LIBPATH, so the linker can't
> find the library. Here's a reduced test case:
>
> #!/usr/src/scons/russel/scons_d_tooling/bootstrap.py -f
> env = Environment(
> DC = '/usr/src/d/dmd/src/dmd',
> )
> env.Library('mylib', 'mylib.d')
>
> prog_env = env.Clone(
> LIBS = ['mylib'],
> LIBPATH = '#'
> )
> prog_env.Program('prog', 'prog.d')
>
> Output:
>
> scons: Reading SConscript files ...
> scons: done reading SConscript files.
> scons: Building targets ...
> /usr/src/d/dmd/src/dmd -I. -c -ofmylib.o mylib.d
> ar cr libmylib.a mylib.o
> ranlib libmylib.a
> /usr/src/d/dmd/src/dmd -I. -c -ofprog.o prog.d
> /usr/src/d/dmd/src/dmd -ofprog prog.o -L-lmylib
> /usr/bin/ld: cannot find -lmylib
> collect2: error: ld returned 1 exit status
> --- errorlevel 1
> scons: *** [prog] Error 1
> scons: building terminated because of errors.
>
> This works correctly when using the C compiler (SCons correctly inserts
> a "-L." in the link command).Can you set out that case and the correct command line? I have to admit DMD/LDC flags often confuse me, I must be a GDC/GCC person ;-) > // > > Also, an unrelated issue: if DC isn't specified and no D compiler is > found in $PATH, it produces a rather odd command line: > > scons: Reading SConscript files ... > scons: done reading SConscript files. > scons: Building targets ... > I. -c -ofprog.o prog.d > sh: 1: I.: not found > ofprog prog.o -L-lmylib > sh: 1: ofprog: not found > scons: done building targets. > > This is not a big deal, but it'd be nice if the tool gave a more helpful > message along the lines of "I can't find a D compiler, please specify > one", instead of producing a mangled command. :-) Actually this is a big deal. If none of dmd, gdc, ldc2 are found then the build should fails before trying a command. Isn't this why exists exists. Also the generate should fail if there is no D compiler. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:[email protected] 41 Buckmaster Road m: +44 7770 465 077 xmpp: [email protected] London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part
