SCons D tool: need help with building static library

Russel Winder russel at winder.org.uk
Sat Dec 15 10:42:45 PST 2012


On Thu, 2012-12-13 at 14:49 -0800, H. S. Teoh wrote:
> Hi Russel,
> 
> I've been using your BitBucket scons_d_tooling version of SCons for my D
> projects, and it's been great! However, I needed to make a static
> library today and I'm having some trouble with it.  Here's a reduced
> testcase:
> 
> 	env = Environment(
> 		DC = '/usr/src/d/dmd/src/dmd'
> 	)
> 	env.StaticLibrary('mylib', Split("""
> 		a.d
> 		b.d
> 	"""))

You are the first person to try doing this since I severely restructured
the code!

> Here's the output:
> 
> 	scons: Reading SConscript files ...
> 	scons: done reading SConscript files.
> 	scons: Building targets ...
> 	/usr/src/d/dmd/src/dmd -I. -c -ofa.o a.d
> 	/usr/src/d/dmd/src/dmd -I. -c -ofb.o b.d
> 	lib -c libmylib.a a.o b.o
> 	sh: 1: lib: not found
> 	scons: *** [libmylib.a] Error 127
> 	scons: building terminated because of errors.
> 
> The compilation steps work fine, but when it should be running ar to
> create the library archive, it runs a non-existent 'lib' instead, which
> fails.

lib is the Windows equivalent of ar, I failed to take this into account.

> I've tracked down the problem to the presub command $SMART_ARCOM, but it
> appears to be a function disguised as a magical variable, so I've no
> idea how to go further.
> 
> Am I missing some setting in the Environment? How can I convince it to
> use 'ar' (as it should) instead of 'lib'?

I entered a variant of your code as a test and made the smallest
possible change to make things work on Linux. This is untested on OS X
or Windows.

The LDC test fails for reasons I cannot suss just now, the DMD and GDC
tests pass.

I have no doubt this is a hack patch, it all needs to be sorted
properly. 

-- 
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/20121215/2b0cf752/attachment.pgp>


More information about the Digitalmars-d mailing list