SCons User Guide 0.97 | ||
---|---|---|
<<< Previous | Troubleshooting | Next >>> |
When you create a construction environment, SCons populates it with construction variables that are set up for various compilers, linkers and utilities that it finds on your system. Although this is usually helpful and what you want, it might be frustrating if SCons doesn't set certain variables that you expect to be sit. In situations like this, it's sometimes helpful to use the construction environment Dump method to print all or some of the construction variables. Note that the Dump method returns the representation of the variables in the environment for you to print (or otherwise manipulate):
env = Environment() print env.Dump() |
On a POSIX system with gcc installed, this might generate:
% scons scons: Reading SConscript files ... { 'BUILDERS': {}, 'CONFIGUREDIR': '#/.sconf_temp', 'CONFIGURELOG': '#/config.log', 'CPPSUFFIXES': [ '.c', '.C', '.cxx', '.cpp', '.c++', '.cc', '.h', '.H', '.hxx', '.hpp', '.hh', '.F', '.fpp', '.FPP', '.m', '.mm', '.S', '.spp', '.SPP'], 'DSUFFIXES': ['.d'], 'Dir': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c3fdac>, 'Dirs': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c3fdcc>, 'ENV': {'PATH': '/usr/local/bin:/opt/bin:/bin:/usr/bin'}, 'ESCAPE': <function escape at 0xb7ba1f0c>, 'File': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c3fdec>, 'IDLSUFFIXES': ['.idl', '.IDL'], 'INSTALL': <function installFunc at 0xb7c4317c>, 'INSTALLSTR': <function installStr at 0xb7c431b4>, 'LATEXSUFFIXES': ['.tex', '.ltx', '.latex'], 'LIBPREFIX': 'lib', 'LIBPREFIXES': '$LIBPREFIX', 'LIBSUFFIX': '.a', 'LIBSUFFIXES': ['$LIBSUFFIX', '$SHLIBSUFFIX'], 'MAXLINELENGTH': 128072, 'OBJPREFIX': '', 'OBJSUFFIX': '.o', 'PLATFORM': 'posix', 'PROGPREFIX': '', 'PROGSUFFIX': '', 'PSPAWN': <function piped_env_spawn at 0xb7bb12cc>, 'RDirs': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c3fe0c>, 'SCANNERS': [], 'SHELL': 'sh', 'SHLIBPREFIX': '$LIBPREFIX', 'SHLIBSUFFIX': '.so', 'SHOBJPREFIX': '$OBJPREFIX', 'SHOBJSUFFIX': '$OBJSUFFIX', 'SPAWN': <function spawnvpe_spawn at 0xb7ba1d4c>, 'TEMPFILE': <class SCons.Platform.TempFileMunge at 0xb7bce89c>, 'TEMPFILEPREFIX': '@', 'TOOLS': [], '_CPPDEFFLAGS': '${_defines(CPPDEFPREFIX, CPPDEFINES, CPPDEFSUFFIX, __env__)}', '_CPPINCFLAGS': '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)', '_LIBDIRFLAGS': '$( ${_concat(LIBDIRPREFIX, LIBPATH, LIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)', '_LIBFLAGS': '${_concat(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, __env__)}', '__RPATH': '$_RPATH', '_concat': <function _concat at 0xb7c43224>, '_defines': <function _defines at 0xb7c432cc>, '_installStr': <function installStr at 0xb7c431b4>, '_stripixes': <function _stripixes at 0xb7c43294>} scons: done reading SConscript files. scons: Building targets ... scons: `.' is up to date. scons: done building targets. |
On a Windows system with Visual C++ the output might look like:
C:\>scons scons: Reading SConscript files ... { 'BUILDERS': {'Object': <SCons.Builder.CompositeBuilder instance at 0xb7b6354c>, 'SharedObject': <SCons.Builder.CompositeBuilder instance at 0xb7b636cc>, 'StaticObject': <SCons.Builder.CompositeBuilder instance at 0xb7b6354c>, 'PCH': <SCons.Builder.BuilderBase instance at 0xb7bd6e8c>, 'RES': <SCons.Builder.BuilderBase instance at 0xb7b5b9ec>}, 'CC': 'cl', 'CCCOM': <SCons.Action.FunctionAction instance at 0xb7b63b6c>, 'CCCOMFLAGS': '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET $CCPCHFLAGS $CCPDBFLAGS', 'CCFLAGS': ['/nologo'], 'CCPCHFLAGS': ['${(PCH and "/Yu%s /Fp%s"%(PCHSTOP or "",File(PCH))) or ""}'], 'CCPDBFLAGS': ['${(PDB and "/Z7") or ""}'], 'CFILESUFFIX': '.c', 'CFLAGS': [], 'CONFIGUREDIR': '#/.sconf_temp', 'CONFIGURELOG': '#/config.log', 'CPPDEFPREFIX': '/D', 'CPPDEFSUFFIX': '', 'CPPSUFFIXES': [ '.c', '.C', '.cxx', '.cpp', '.c++', '.cc', '.h', '.H', '.hxx', '.hpp', '.hh', '.F', '.fpp', '.FPP', '.m', '.mm', '.S', '.spp', '.SPP'], 'CXX': '$CC', 'CXXCOM': '$CXX $CXXFLAGS $CCCOMFLAGS', 'CXXFILESUFFIX': '.cc', 'CXXFLAGS': ['$CCFLAGS', '$(', '/TP', '$)'], 'DSUFFIXES': ['.d'], 'Dir': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c5adac>, 'Dirs': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c5adcc>, 'ENV': { 'INCLUDE': 'C:\\Program Files\\Microsoft Visual Studio/VC98\\include', 'LIB': 'C:\\Program Files\\Microsoft Visual Studio/VC98\\lib', 'PATH': 'C:\\Program Files\\Microsoft Visual Studio\\Common\\tools\\WIN95;C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\bin;C:\\Program Files\\Microsoft Visual Studio\\Common\\tools;C:\\Program Files\\Microsoft Visual Studio/VC98\\bin', 'PATHEXT': '.COM;.EXE;.BAT;.CMD', 'SystemRoot': 'C:/WINDOWS'}, 'ESCAPE': <function escape at 0xb7bcf454>, 'File': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c5adec>, 'IDLSUFFIXES': ['.idl', '.IDL'], 'INCPREFIX': '/I', 'INCSUFFIX': '', 'INSTALL': <function installFunc at 0xb7c5e17c>, 'INSTALLSTR': <function installStr at 0xb7c5e1b4>, 'LATEXSUFFIXES': ['.tex', '.ltx', '.latex'], 'LIBPREFIX': '', 'LIBPREFIXES': ['$LIBPREFIX'], 'LIBSUFFIX': '.lib', 'LIBSUFFIXES': ['$LIBSUFFIX'], 'MAXLINELENGTH': 2048, 'MSVS': {'VERSION': '6.0', 'VERSIONS': ['6.0']}, 'MSVS_VERSION': '6.0', 'OBJPREFIX': '', 'OBJSUFFIX': '.obj', 'PCHCOM': '$CXX $CXXFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo${TARGETS[1]} /Yc$PCHSTOP /Fp${TARGETS[0]} $CCPDBFLAGS $PCHPDBFLAGS', 'PCHPDBFLAGS': ['${(PDB and "/Yd") or ""}'], 'PLATFORM': 'win32', 'PROGPREFIX': '', 'PROGSUFFIX': '.exe', 'PSPAWN': <function piped_spawn at 0xb7bcf3ac>, 'RC': 'rc', 'RCCOM': '$RC $_CPPDEFFLAGS $_CPPINCFLAGS $RCFLAGS /fo$TARGET $SOURCES', 'RCFLAGS': [], 'RDirs': <SCons.Defaults.Variable_Method_Caller instance at 0xb7c5ae0c>, 'SCANNERS': [], 'SHCC': '$CC', 'SHCCCOM': <SCons.Action.FunctionAction instance at 0xb7b63bcc>, 'SHCCFLAGS': ['$CCFLAGS'], 'SHCFLAGS': ['$CFLAGS'], 'SHCXX': '$CXX', 'SHCXXCOM': '$SHCXX $SHCXXFLAGS $CCCOMFLAGS', 'SHCXXFLAGS': ['$CXXFLAGS'], 'SHELL': None, 'SHLIBPREFIX': '', 'SHLIBSUFFIX': '.dll', 'SHOBJPREFIX': '$OBJPREFIX', 'SHOBJSUFFIX': '$OBJSUFFIX', 'SPAWN': <function spawn at 0xb7bcf41c>, 'STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME': 1, 'TEMPFILE': <class SCons.Platform.TempFileMunge at 0xb7be989c>, 'TEMPFILEPREFIX': '@', 'TOOLS': ['msvc'], '_CPPDEFFLAGS': '${_defines(CPPDEFPREFIX, CPPDEFINES, CPPDEFSUFFIX, __env__)}', '_CPPINCFLAGS': '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)', '_LIBDIRFLAGS': '$( ${_concat(LIBDIRPREFIX, LIBPATH, LIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)', '_LIBFLAGS': '${_concat(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, __env__)}', '_concat': <function _concat at 0xb7c5e224>, '_defines': <function _defines at 0xb7c5e2cc>, '_installStr': <function installStr at 0xb7c5e1b4>, '_stripixes': <function _stripixes at 0xb7c5e294>} scons: done reading SConscript files. scons: Building targets ... scons: `.' is up to date. scons: done building targets. |
The construction environments in these examples have actually been restricted to just gcc and Visual C++, respectively. In a real-life situation, the construction environments will likely contain a great many more variables.
To make it easier to see just what you're interested in, the Dump method allows you to specify a specific constrcution variable that you want to disply. For example, it's not unusual to want to verify the external environment used to execute build commands, to make sure that the PATH and other environment variables are set up the way they should be. You can do this as follows:
env = Environment() print env.Dump('ENV') |
Which might display the following when executed on a POSIX system:
% scons scons: Reading SConscript files ... {'PATH': '/usr/local/bin:/opt/bin:/bin:/usr/bin'} scons: done reading SConscript files. scons: Building targets ... scons: `.' is up to date. scons: done building targets. |
And the following when executed on a Windows system:
C:\>scons scons: Reading SConscript files ... { 'INCLUDE': 'C:\\Program Files\\Microsoft Visual Studio/VC98\\include', 'LIB': 'C:\\Program Files\\Microsoft Visual Studio/VC98\\lib', 'PATH': 'C:\\Program Files\\Microsoft Visual Studio\\Common\\tools\\WIN95;C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\bin;C:\\Program Files\\Microsoft Visual Studio\\Common\\tools;C:\\Program Files\\Microsoft Visual Studio/VC98\\bin', 'PATHEXT': '.COM;.EXE;.BAT;.CMD', 'SystemRoot': 'C:/WINDOWS'} scons: done reading SConscript files. scons: Building targets ... scons: `.' is up to date. scons: done building targets. |
<<< Previous | Home | Next >>> |
Troubleshooting | Up | What Dependencies Does SCons Know About? the --tree Option |