[SERVER-22343] Use scons --mute to make compile logs readable Created: 12/Feb/14  Updated: 15/Mar/16  Resolved: 15/Mar/16

Status: Closed
Project: Core Server
Component/s: Logging
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Siyuan Zhou Assignee: Andrew Morrow (Inactive)
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-12705 register exit handler to enumerate bu... Closed
Backwards Compatibility: Fully Compatible
Sprint: Platforms 12 (04/01/16)
Participants:

 Description   

Quoting SCons: It isn't that bad!:

--mute: This option makes it so long compile lines are not echoed to the terminal. Someday this should be the default, but for now you need to request it. It makes it much easier to understand what the build is doing, which in turn lets you understand more about how we make the sausage. Use this.

Example output:

Compiling build/cached/mongo/db/db.o
Compiling build/cached/mongo/db/commands/touch.o
Compiling build/cached/mongo/db/mongod_options_init.o
Compiling build/cached/mongo/base/error_codes.o
Compiling build/cached/mongo/base/global_initializer.o
Compiling build/cached/mongo/base/global_initializer_registerer.o
Compiling build/cached/mongo/base/init.o
Compiling build/cached/mongo/base/initializer.o
Compiling build/cached/mongo/base/initializer_context.o
Compiling build/cached/mongo/base/initializer_dependency_graph.o
Compiling build/cached/mongo/base/make_string_vector.o
Compiling build/cached/mongo/base/parse_number.o
Compiling build/cached/mongo/base/status.o
Compiling build/cached/mongo/base/string_data.o
Compiling build/cached/mongo/db/auth/action_set.o
Compiling build/cached/mongo/db/auth/action_type.o



 Comments   
Comment by Andrew Morrow (Inactive) [ 20/Feb/16 ]

However, what Andy mentioned above about GetBuildFailures and atexit has been on my personal todo list for some time. I think it is something worth doing anyway. But I still don't think we should mute the build line. I really do sometimes need to see what flags were used on a given build even if there were no failures.

Comment by Andy Schwerin [ 12/Feb/14 ]

See Section 9.4 of the SCons User Guide for one option.

In essence, you could use python's atexit.register to register an exit handler that used the SCons GetBuildFailures method to enumerate the build failures. From those, you could print the command lines that failed. Here's a not-for-commit example, that you can stick at the end of the SConstruct today:

def bfsummary():
    for bf in GetBuildFailures():
        if bf:
            print "FAILED COMMAND: %s" % ' '.join(bf.command)
 
import atexit
atexit.register(bfsummary)

Comment by Michael O'Brien [ 12/Feb/14 ]

It looks like it doesn't show the whole command on error.
without mute:

scons: Building targets ...
g++ -o build/darwin/normal/mongo/base/string_data.o -c -Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Werror -pipe -O3 -Wno-unused-function -Wno-unused-private-field -Wno-deprecated-declarations -Wno-tautological-constant-out-of-range-compare -mmacosx-version-min=10.6 -DBOOST_ALL_NO_LIB -D_SCONS -DMONGO_EXPOSE_MACROS -DSUPPORT_UTF8 -DMONGO_OPTIMIZED_BUILD -D_FILE_OFFSET_BITS=64 -DMONGO_HAVE_HEADER_UNISTD_H -DMONGO_HAVE_EXECINFO_BACKTRACE -Ibuild/darwin/normal/third_party/snappy -Isrc/third_party/snappy -Ibuild/darwin/normal/third_party/libstemmer_c/include -Isrc/third_party/libstemmer_c/include -Ibuild/darwin/normal/third_party/s2 -Isrc/third_party/s2 -Ibuild/darwin/normal/third_party/boost -Isrc/third_party/boost -Ibuild/darwin/normal/third_party/pcre-8.30 -Isrc/third_party/pcre-8.30 -Ibuild/darwin/normal -Isrc -Ibuild/darwin/normal/mongo -Isrc/mongo -Ibuild/darwin/normal/third_party/s2 -Isrc/third_party/s2 -Ibuild/darwin/normal/third_party/snappy -Isrc/third_party/snappy -Ibuild/darwin/normal/third_party/v8/include -Isrc/third_party/v8/include -Ibuild/darwin/normal/third_party/yaml-cpp-0.5.1/include -Isrc/third_party/yaml-cpp-0.5.1/include src/mongo/base/string_data.cpp
src/mongo/base/string_data.cpp:18:2: error: invalid preprocessing directive
#i dgsdgnclude <ostream>
 ^
src/mongo/base/string_data.cpp:45:22: error: implicit instantiation of undefined template 'std::basic_ostream<char, std::char_traits<char> >'
        return stream.write(value.rawData(), value.size());
                     ^
/usr/include/c++/4.2.1/iosfwd:63:11: note: template is declared here
    class basic_ostream;
          ^
2 errors generated.

with mute:

scons: Building targets ...
Compiling build/darwin/normal/mongo/base/string_data.o
src/mongo/base/string_data.cpp:18:2: error: invalid preprocessing directive
#i dgsdgnclude <ostream>
 ^
src/mongo/base/string_data.cpp:45:22: error: implicit instantiation of undefined template 'std::basic_ostream<char, std::char_traits<char> >'
        return stream.write(value.rawData(), value.size());
                     ^
/usr/include/c++/4.2.1/iosfwd:63:11: note: template is declared here
    class basic_ostream;
          ^
2 errors generated.

If there's a change you can make to scons options to make it show the whole command line on error, we can push this change - otherwise i'll close this as works as designed.

Comment by Andy Schwerin [ 12/Feb/14 ]

Actually, I'm interested enough in this that I'm going to take a quick peek at our options in SCons for this.

Comment by Andy Schwerin [ 12/Feb/14 ]

Thumbs down unless you can make SCons print the whole executed command line on error. If you can do that, then double thumbs up.

Comment by Michael O'Brien [ 12/Feb/14 ]

milkie schwerin
can you give this a thumbs up/down?

Comment by Ian Whalen (Inactive) [ 12/Feb/14 ]

need to get confirmation from Eric or Andy before making this change.

Comment by Michael O'Brien [ 12/Feb/14 ]

Makes sense to me. Is there any drawback to doing this? Any potentially information in the long compile lines that we are giving up by doing this?
Also - does this work on all platforms? (windows, etc)

Generated at Thu Feb 08 04:00:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.