Search code examples
scons

SCons: misterious Configure() failure in SConscript


I have a scons project with many SConscript files in the subdirectories. In one of those SConscript files I want to check if particular library is installed on the build host. Here is code snippet:

Import("env")

conf = Configure(env)
if conf.CheckLibWithHeader(...):
    doSomething()

env.Library(...)

When I execute build scons fails with strnge error without error message like this:

scons: *** 
File "/path/to/SConscript", line 3, in <module>

Line 3 is where I call Configure(). I guess I am doing something not allowed with Configure() function but I cannot find any explanation in scons documentation.

Please help me to debug this.


Solution

  • So the problem was in one of the sibling SConscript files. There was a call to Configure(env) but configuration object was not disposed with conf.Finish() call.

    This was an issue because SCons does not allow to create more than one configuration object at any moment. I found this rule by analysing SCons sources - I don't know if this is documented.

    Thus when I made my call to Configure(env) SCons thrown an exception because it seen there is another active configuration object orphaned by sibling SConscript.