SCons D tool: need help with building static library
H. S. Teoh
hsteoh at quickfur.ath.cx
Mon Dec 17 11:37:08 PST 2012
On Mon, Dec 17, 2012 at 07:28:53PM +0000, Russel Winder wrote:
> 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.
I haven't tried LDC yet, though I've heard good things about it. Maybe I
should check it out sometime.
> > 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'
[...]
Did you define main() in prog.d (or somewhere)? The second line of the
output here seems to indicate that you didn't. I think the latest git
dmd is patched so that a more helpful error message is provided in this
case, but this unhelpful screenful of errors is what the current release
dmd gives when main() isn't defined.
T
--
Try to keep an open mind, but not so open your brain falls out. -- theboz
More information about the Digitalmars-d
mailing list