www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - SCons D tool: need help with building static library

reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
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
	"""))

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.

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'?

Thanks!


T

-- 
Who told you to swim in Crocodile Lake without life insurance??
Dec 13 2012
parent Jacob Carlborg <doob me.com> writes:
On 2012-12-13 23:49, H. S. Teoh wrote:

 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.

Isn't "lib" what Windows uses? You know that you can also use the "-lib" flag directly with dmd. -- /Jacob Carlborg
Dec 13 2012