SCons User Guide 0.96.90 | ||
---|---|---|
<<< 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):
On a POSIX system with gcc installed, this might generate:
% scons scons: Reading SConscript files ... { 'BUILDERS': {}, 'CPPSUFFIXES': [ '.c', '.C', '.cxx', '.cpp', '.c++', '.cc', '.h', '.H', '.hxx', '.hpp', '.hh', '.F', '.fpp', '.FPP', '.S', '.spp', '.SPP'], 'DSUFFIXES': ['.d'], 'Dir': <SCons.Defaults.Variable_Method_Caller instance at 0x829dcb4>, 'ENV': {'PATH': '/usr/local/bin:/bin:/usr/bin'}, 'ESCAPE': <function escape at 0x837d2a4>, 'File': <SCons.Defaults.Variable_Method_Caller instance at 0x829e0fc>, 'IDLSUFFIXES': ['.idl', '.IDL'], 'INSTALL': <function copyFunc at 0x829db9c>, 'LIBPREFIX': 'lib', 'LIBPREFIXES': '$LIBPREFIX', 'LIBSUFFIX': '.a', 'LIBSUFFIXES': ['$LIBSUFFIX', '$SHLIBSUFFIX'], 'OBJPREFIX': '', 'OBJSUFFIX': '.o', 'PDFPREFIX': '', 'PDFSUFFIX': '.pdf', 'PLATFORM': 'posix', 'PROGPREFIX': '', 'PROGSUFFIX': '', 'PSPAWN': <function piped_env_spawn at 0x837d384>, 'PSPREFIX': '', 'PSSUFFIX': '.ps', 'RDirs': <SCons.Defaults.Variable_Method_Caller instance at 0x829e46c>, 'SCANNERS': [], 'SHELL': 'sh', 'SHLIBPREFIX': '$LIBPREFIX', 'SHLIBSUFFIX': '.so', 'SHOBJPREFIX': '$OBJPREFIX', 'SHOBJSUFFIX': '$OBJSUFFIX', 'SPAWN': <function spawnvpe_spawn at 0x8377fdc>, 'TEMPFILE': <class SCons.Defaults.NullCmdGenerator at 0x829ddec>, 'TOOLS': [], '_CPPDEFFLAGS': '${_defines(CPPDEFPREFIX, CPPDEFINES, CPPDEFSUFFIX, __env__)}', '_CPPINCFLAGS': '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET)} $)', '_LIBDIRFLAGS': '$( ${_concat(LIBDIRPREFIX, LIBPATH, LIBDIRSUFFIX, __env__, RDirs, TARGET)} $)', '_LIBFLAGS': '${_concat(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, __env__)}', '__RPATH': '$_RPATH', '_concat': <function _concat at 0x829dc0c>, '_defines': <function _defines at 0x829dc7c>, '_stripixes': <function _stripixes at 0x829dc44>} 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.Memoize.MultiStepBuilder object at 0x83493e4>, 'SharedObject': <SCons.Memoize.MultiStepBuilder object at 0x8349fec>, 'StaticObject': <SCons.Memoize.MultiStepBuilder object at 0x83493e4>, 'PCH': <SCons.Memoize.BuilderBase object at 0x83418cc>, 'RES': <SCons.Memoize.BuilderBase object at 0x8367cec>}, 'CC': 'cl', 'CCCOM': <SCons.Memoize.FunctionAction object at 0x8340454>, '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', 'CPPDEFPREFIX': '/D', 'CPPDEFSUFFIX': '', 'CPPSUFFIXES': [ '.c', '.C', '.cxx', '.cpp', '.c++', '.cc', '.h', '.H', '.hxx', '.hpp', '.hh', '.F', '.fpp', '.FPP', '.S', '.spp', '.SPP'], 'CXX': '$CC', 'CXXCOM': '$CXX $CXXFLAGS $CCCOMFLAGS', 'CXXFILESUFFIX': '.cc', 'CXXFLAGS': ['$CCFLAGS', '$(', '/TP', '$)'], 'DSUFFIXES': ['.d'], 'Dir': <SCons.Defaults.Variable_Method_Caller instance at 0x829dcb4>, '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'}, 'ESCAPE': <function <lambda> at 0x82339ec>, 'File': <SCons.Defaults.Variable_Method_Caller instance at 0x829e0fc>, 'IDLSUFFIXES': ['.idl', '.IDL'], 'INCPREFIX': '/I', 'INCSUFFIX': '', 'INSTALL': <function copyFunc at 0x829db9c>, '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 ""}'], 'PDFPREFIX': '', 'PDFSUFFIX': '.pdf', 'PLATFORM': 'win32', 'PROGPREFIX': '', 'PROGSUFFIX': '.exe', 'PSPAWN': <function piped_spawn at 0x8372bc4>, 'PSPREFIX': '', 'PSSUFFIX': '.ps', 'RC': 'rc', 'RCCOM': '$RC $_CPPDEFFLAGS $_CPPINCFLAGS $RCFLAGS /fo$TARGET $SOURCES', 'RCFLAGS': [], 'RDirs': <SCons.Defaults.Variable_Method_Caller instance at 0x829e46c>, 'SCANNERS': [], 'SHCC': '$CC', 'SHCCCOM': <SCons.Memoize.FunctionAction object at 0x83494bc>, 'SHCCFLAGS': ['$CCFLAGS'], 'SHCXX': '$CXX', 'SHCXXCOM': '$SHCXX $SHCXXFLAGS $CCCOMFLAGS', 'SHCXXFLAGS': ['$CXXFLAGS'], 'SHELL': None, 'SHLIBPREFIX': '', 'SHLIBSUFFIX': '.dll', 'SHOBJPREFIX': '$OBJPREFIX', 'SHOBJSUFFIX': '$OBJSUFFIX', 'SPAWN': <function spawn at 0x8374c34>, 'STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME': 1, 'TEMPFILE': <class SCons.Platform.win32.TempFileMunge at 0x835edc4>, 'TOOLS': ['msvc'], '_CPPDEFFLAGS': '${_defines(CPPDEFPREFIX, CPPDEFINES, CPPDEFSUFFIX, __env__)}', '_CPPINCFLAGS': '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET)} $)', '_LIBDIRFLAGS': '$( ${_concat(LIBDIRPREFIX, LIBPATH, LIBDIRSUFFIX, __env__, RDirs, TARGET)} $)', '_LIBFLAGS': '${_concat(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, __env__)}', '_concat': <function _concat at 0x829dc0c>, '_defines': <function _defines at 0x829dc7c>, '_stripixes': <function _stripixes at 0x829dc44>} 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:
Which might display the following when executed on a POSIX system:
% scons scons: Reading SConscript files ... {'PATH': '/usr/local/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'} scons: done reading SConscript files. scons: Building targets ... scons: `.' is up to date. scons: done building targets. |
<<< Previous | Home | Next >>> |
Troubleshooting | Up | Construction Variables |