wiki:SConsFAQ
Last modified 11 years ago Last modified on 11/15/2007 08:43:24 AM

Local FAQ

Here's a list of questions that RHL asked himself when learning scons; maybe some of them'll help you too

How can I run scons in a subdirectory?
Use scons -u or scons -U. This is equivalent to changing to your product root directory and building the targets in your current directory --- you'll see that you're running e.g. gcc -o src/foo.o src/foo.cc
SCons takes forever (well, 5-10s) before it even parses my SConstruct file
Make sure that $SCONSDISTRIB_DIR}/python}} is at the beginning of your {{{PYTHONPATH so that python doesn't have to search (e.g.) scipy before finding the scons source. One way to do this is to say setup scons --- even if it's already setup, this will move it the start of the search path.
SCons is still slow
The standard answer is to add --implicit-deps-unchanged --max-drift=1 to the SCONSFLAGS environment variable. Another option is to run a parallel build using -j, but this won't help with startup time.

N.b. SCons may fail to detect that you've added/subtracted/changed include files with this setting. If you suspect trouble, trying running SCons once as env SCONSFLAGS= scons

How do I use SCons with Doxygen?
See DoxygenAndScons
SCons has mysteriously started complaining that it cannot find libraries like 'm', when nothing relevant has changed since the last build. How can I recover?
Try 'rm -rf .scon*' in the directory where you invoke scons. This clears all its cached information, which apparently sometimes gets corrupted.
I can't see my error and warning messages
Try scons -Q | perl -pe 's/s+-[DIL]S+//g'

A slightly more sophisticated version (for bash users is):

alias noI='perl -pe "s/s+-[DIL]S+//g"; if [ ${PIPESTATUS[${#PIPESTATUS[*]}-2]} = 0 ]; then true; else false; fi'

This gets the exit status right, so you can say scons -Q | noI && runMyCode

What is the equivalent of 'make clean'?
scons -c
If I am actively developing code, how do I point Scons to use libraries such as fw that eups knows about
You edit your SConstruct file. For e.g. "fw" you add ["fw", "lsst/fw/LsstBase.h", "fw"] to SConstruct's env = scons.makeEnv() command. You may also need to tell your code to link to env.libs["fw"]. Of course, you must have said "setup fw" for scons to find the product.

Scons is reporting test failures; how do I see what happened? Also, I want to modify the test and re-run it, but scons thinks that nothing has changed.

Test results are in tests/.tests. The failed ones have .failed appended to the testname. To re-run a test delete its test result file (or re-run all tests by deleting tests/.tests) and then scons tests