I use SCons to create a project at work, and I try to parse text output from GCC to compile a summary report of all compiler warnings for each purpose, because our build scripts are quite long and there is a lot of text output to the console.
I searched Google and this site for quite a while, and I cannot find the method built into SCons for this. I tried to redirect the entire stream of stdout and stderr to a file for this example , but only the output from SCons itself is captured, and not any tools that it calls.
My next thought was to find where SCons compiles the arguments to send to GCC and adds a redirect to the end of the argument string. After reading the documentation, it seems that the CCCOM
and CXXCOM
construct variables contain the command line used for compilation. However, when I added the lines below to my SConstruct, nothing changed on the command lines that SCons executes.
baseEnv['CCCOM'] += " 2> gcc-c-output.txt" baseEnv['CXXCOM'] += " 2> gcc-cxx-output.txt"
One thing that worked was stderr thread redirection in the entire SCons team:
scons 2> stderr.txt
However, I would like to avoid this and keep everything possible in SCons. The output also does not have to go to a file. It can be saved anywhere, as long as I can access it for parsing and saving to a file at the end of the assembly.
I searched for so long and did not come up with anything, so I do not know what else to try. I have to believe that I am not the first to want to do something like this.
source share