SCons D tool: need help with building static library

Russel Winder russel at winder.org.uk
Mon Dec 17 11:28:53 PST 2012


On Mon, 2012-12-17 at 11:08 -0800, H. S. Teoh wrote:
[…]

> I'm a GDC/GCC person as well. :-) Except that GDC for my platform is
> horribly outdated, so I've had to resort to DMD for my newer projects.
> Plus, sometimes I'm testing fixes for Phobos, which often requires the
> latest git dmd to even compile.

I switched to LDC as DMD broke in the 2.059 → 2.060 change.

> Anyway.  The command is missing a "-L-L." option. It should read:
> 
> 	/usr/src/d/dmd/src/dmd -ofprog prog.o -L-L. -L-lmylib
> 
> which passes a "-L." option to the linker to make it search the current
> directory for the library.

I tried this on spec earlier and got:

|> dmd -ofprog prog.o -L-L. -L-lmylib
/usr/lib/x86_64-linux-gnu/libphobos2.a(dmain2_45f_1a5.o): In function `_D2rt6dmain24mainUiPPaZi7runMainMFZv':
src/rt/dmain2.d:(.text._D2rt6dmain24mainUiPPaZi7runMainMFZv+0x18): undefined reference to `_Dmain'
/usr/lib/x86_64-linux-gnu/libphobos2.a(thread_192_1b8.o): In function `_D4core6thread6Thread6__ctorMFZC4core6thread6Thread':
src/core/thread.d:(.text._D4core6thread6Thread6__ctorMFZC4core6thread6Thread+0x26): undefined reference to `_tlsend'
src/core/thread.d:(.text._D4core6thread6Thread6__ctorMFZC4core6thread6Thread+0x31): undefined reference to `_tlsstart'
/usr/lib/x86_64-linux-gnu/libphobos2.a(thread_1a2_6e4.o): In function `thread_attachThis':
src/core/thread.d:(.text.thread_attachThis+0xf4): undefined reference to `_tlsstart'
src/core/thread.d:(.text.thread_attachThis+0xff): undefined reference to `_tlsend'
/usr/lib/x86_64-linux-gnu/libphobos2.a(thread_180_1b8.o): In function `_D4core6thread6Thread6__ctorMFPFZvmZC4core6thread6Thread':
src/core/thread.d:(.text._D4core6thread6Thread6__ctorMFPFZvmZC4core6thread6Thread+0x2b): undefined reference to `_tlsend'
src/core/thread.d:(.text._D4core6thread6Thread6__ctorMFPFZvmZC4core6thread6Thread+0x36): undefined reference to `_tlsstart'
/usr/lib/x86_64-linux-gnu/libphobos2.a(thread_181_1b8.o): In function `_D4core6thread6Thread6__ctorMFDFZvmZC4core6thread6Thread':
src/core/thread.d:(.text._D4core6thread6Thread6__ctorMFDFZvmZC4core6thread6Thread+0x37): undefined reference to `_tlsend'
src/core/thread.d:(.text._D4core6thread6Thread6__ctorMFDFZvmZC4core6thread6Thread+0x42): undefined reference to `_tlsstart'
/usr/lib/x86_64-linux-gnu/libphobos2.a(deh2_441_525.o): In function `_D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable':
src/rt/deh2.d:(.text._D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable+0xa): undefined reference to `_deh_beg'
src/rt/deh2.d:(.text._D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable+0x14): undefined reference to `_deh_beg'
src/rt/deh2.d:(.text._D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable+0x1e): undefined reference to `_deh_end'
src/rt/deh2.d:(.text._D2rt4deh213__eh_finddataFPvZPS2rt4deh29FuncTable+0x45): undefined reference to `_deh_end'
/usr/lib/x86_64-linux-gnu/libphobos2.a(thread_17d_713.o): In function `thread_entryPoint':
src/core/thread.d:(.text.thread_entryPoint+0xa1): undefined reference to `_tlsend'
src/core/thread.d:(.text.thread_entryPoint+0xac): undefined reference to `_tlsstart'
collect2: error: ld returned 1 exit status
--- errorlevel 1

The problem here I think relates to the name of the library. Should it
be libmylib.as or mylib.a on Linux?

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121217/c101681c/attachment-0001.pgp>


More information about the Digitalmars-d mailing list