diff --git a/SConstruct b/SConstruct index 2ebeb0e..44ce93a 100644 --- a/SConstruct +++ b/SConstruct @@ -23,7 +23,6 @@ from pkg_resources import parse_version import SCons import SCons.Script -from mongo_tooling_metrics.lib.top_level_metrics import SConsToolingMetrics from site_scons.mongo import build_profiles # This must be first, even before EnsureSConsVersion, if @@ -1657,13 +1656,6 @@ env.AddMethod(lambda env, name, **kwargs: add_option(name, **kwargs), 'AddOption # The placement of this is intentional. Here we setup an atexit method to store tooling metrics. # We should only register this function after env, env_vars and the parser have been properly initialized. -SConsToolingMetrics.register_metrics( - utc_starttime=datetime.utcnow(), - artifact_dir=env.Dir('$BUILD_DIR').get_abspath(), - env_vars=env_vars, - env=env, - parser=_parser, -) if get_option('build-metrics'): env['BUILD_METRICS_ARTIFACTS_DIR'] = '$BUILD_ROOT/$VARIANT_DIR' @@ -3034,7 +3026,6 @@ if env.TargetOSIs('posix'): env.Append( CCFLAGS=[ "-fasynchronous-unwind-tables", - "-g2" if not env.TargetOSIs('emscripten') else "-g", "-Wall", "-Wsign-compare", "-Wno-unknown-pragmas", @@ -3101,6 +3092,8 @@ if env.TargetOSIs('posix'): # env.Append( " -Wconversion" ) TODO: this doesn't really work yet env.Append(CXXFLAGS=["-Woverloaded-virtual"]) + env.Append(CXXFLAGS=os.environ['CXXFLAGS']) + env.Append(LINKFLAGS=os.environ['LDFLAGS']) # On OS X, clang doesn't want the pthread flag at link time, or it # issues warnings which make it impossible for us to declare link @@ -3151,7 +3144,7 @@ if env.TargetOSIs('posix'): ], ) #make scons colorgcc friendly - for key in ('HOME', 'TERM'): + for key in ('HOME', 'TERM', 'PATH'): try: env['ENV'][key] = os.environ[key] except KeyError: @@ -3553,33 +3546,6 @@ def doConfigure(myenv): myenv.AddMethod( functools.partial(var_func, var=var, func=CheckFlag), f"Check{var}Supported") - if myenv.ToolchainIs('gcc', 'clang'): - # This tells clang/gcc to use the gold linker if it is available - we prefer the gold linker - # because it is much faster. Don't use it if the user has already configured another linker - # selection manually. - if any(flag.startswith('-fuse-ld=') for flag in env['LINKFLAGS']): - myenv.FatalError( - f"Use the '--linker' option instead of modifying the LINKFLAGS directly.") - - linker_ld = get_option('linker') - if linker_ld == 'auto': - if not env.TargetOSIs('darwin', 'macOS'): - if not myenv.AddToLINKFLAGSIfSupported('-fuse-ld=lld'): - myenv.FatalError( - f"The recommended linker 'lld' is not supported with the current compiler configuration, you can try the 'gold' linker with '--linker=gold'." - ) - elif link_model.startswith("dynamic") and linker_ld == 'bfd': - # BFD is not supported due to issues with it causing warnings from some of - # the third party libraries that mongodb is linked with: - # https://jira.mongodb.org/browse/SERVER-49465 - myenv.FatalError(f"Linker {linker_ld} is not supported with dynamic link model builds.") - else: - if not myenv.AddToLINKFLAGSIfSupported(f'-fuse-ld={linker_ld}'): - myenv.FatalError(f"Linker {linker_ld} could not be configured.") - - if has_option('gcov') and myenv.AddToCCFLAGSIfSupported('-fprofile-update=single'): - myenv.AppendUnique(LINKFLAGS=['-fprofile-update=single']) - detectCompiler = Configure( myenv, help=False, @@ -5119,17 +5085,13 @@ def doConfigure(myenv): "BOOST_LOG_NO_SHORTHAND_NAMES", "BOOST_LOG_USE_NATIVE_SYSLOG", "BOOST_LOG_WITHOUT_THREAD_ATTR", + "BOOST_LOG_DYN_LINK", "BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS", "BOOST_SYSTEM_NO_DEPRECATED", "BOOST_THREAD_USES_DATETIME", ("BOOST_THREAD_VERSION", "5"), ]) - if link_model.startswith("dynamic") and not link_model == 'dynamic-sdk': - conf.env.AppendUnique(CPPDEFINES=[ - "BOOST_LOG_DYN_LINK", - ]) - if use_system_version_of_library("boost"): if not conf.CheckCXXHeader("boost/filesystem/operations.hpp"): myenv.ConfError("can't find boost headers") @@ -5326,6 +5288,9 @@ def doConfigure(myenv): mongoc_mode = get_option('use-system-mongo-c') conf.env['MONGO_HAVE_LIBMONGOC'] = False + conf.env.ParseConfig('pkg-config libbson-1.0 libmongoc-1.0 --cflags') + conf.env['LIBDEPS_LIBBSON_SYSLIBDEP'] = 'bson-1.0' + if mongoc_mode != 'off': if conf.CheckLibWithHeader( ["mongoc-1.0"],