[Scons-users] Debugging scons scripts

Bjoern Doebel bjoern.doebel at gmail.com
Wed Aug 8 11:23:17 EDT 2012


Hi all,

I'd like to debug a scons setup and would be interested in pointers on
how to proceed.

I have a setup that builds one library and 2 applications (which
depend on the lib to be ready) within a variant dir. In general, For
that I do in my SConstruct:

env = Environment( ... some std. settings for CPPPATH, FLAGS etc. )
SConscript("app1", variant_dir="#/build/app1", exports="env")
SConscript("app2", variant_dir="#/build/app2", exports="env")
SConscript("lib", variant_dir="#/build/lib", exports="env")

In the SConscripts I simply add a bunch of objects and one target:

app1: env.app1 = env.Program("app1", app1_objs)
app2: env.app2 = env.Program("app2", app2_objs)
lib: env.lib = env.Library("foo", lib_objs)

I declare additional dependencies in my main SConstruct:

env.Depends(env.app1, env.lib)
env.Depends(env.app2, env.lib)

This setup works fine so far. Now I added some Autoconf-style magic.
_Before_ calling into the SConscripts, I do:

conf = Configure(env)
if not conf.CheckCC(): sys.exit(1)
[... additional stuff ...]
if not conf.CheckLib("boost_serialization", language="C++"): sys.exit(1)
env = conf.Finish()

The configuration stuff works as expected as well. Now I'm getting to
my problem:

When I modify one object that goes into the library, I'd expect the
object as well as the library and all dependencies to be rebuilt.
However, scons only triggers a rebuild of the object file, but does
not link the library or the depending programs. I found this weird, so
I started investigating. And what I found was, that if I remove the
conf line:

if not conf.CheckLib("boost_serialization", language="C++"): sys.exit(1)

I get the expected behavior. This is really strange, because the
boost_serialization lib is not related to the lib I build at all.

I also tried to condense all this into a tiny test case (one lib, one
app, some autoconf-style checks), but did not succeed in reproducing
this behavior so far. Therefore I assume that I do some additional
stuff that is wrong and I'd like to further investigate the problem.
However, I feel clueless about where to look, so any hints would be
appreciated.

Cheers,
Bjoern


More information about the Scons-users mailing list