Prior to SERVER-49465, developers explicitly configured SCons to use a particular linker by definining fuse-ld=<linker> in the LINKFLAGS. Now, they use -linker=<linker>. The linker argument is evaluated after some configure checks, such as Checking that the C++ compiler can link a C++ program... have been performed. This means that if LINKFLAGS are provided which depend on a particular linker, the compiler link test will fail.
Before SERVER-49465, the following configuration worked:
python ./buildscripts/scons.py --variables-files=etc/scons/mongodbtoolchain_v3_clang.vars --link-model=dynamic --build-tools=next --ninja generate-ninja ICECC=icecc CCACHE=ccache CCFLAGS="-Wa,--compress-debug-sections -gsplit-dwarf -fvisibility-inlines-hidden" LINKFLAGS="-Wl,-O2 -Wl,--icf=safe -fuse-ld=lld -Wl,--hash-style=gnu -Wl,-Bsymbolic-functions" MONGO_VERSION="0.0.0" MONGO_GIT_HASH="unknown"
Attempting to replace fuse-ld=lld with -linker=lld results in the following:
(python3-venv) ubuntu@ip-10-122-6-169:~/mongo$ autoninja scons: Reading SConscript files ... scons: running with args /home/ubuntu/mongo/python3-venv/bin/python ./buildscripts/scons.py --variables-files=etc/scons/mongodbtoolchain_v3_clang.vars --link-model=dynamic --build-tools=next --ninja generate-ninja ICECC=icecc CCACHE=ccache CCFLAGS=-Wa,--compress-debug-sections -gsplit-dwarf -fvisibility-inlines-hidden --linker=lld LINKFLAGS=-Wl,-O2 -Wl,--icf=safe -Wl,--hash-style=gnu -Wl,-Bsymbolic-functions MONGO_VERSION=0.0.0 MONGO_GIT_HASH=unknown Using variable customization file etc/scons/mongodbtoolchain_v3_clang.vars scons version: 3.1.2 python version: 3 7 0 'final' 0 CC is /opt/mongodbtoolchain/v3/bin/clang /opt/mongodbtoolchain/v3/bin/clang resolves to /opt/mongodbtoolchain/revisions/e5348beb43e147b74a40f4ca5fb05a330ea646cf/stow/llvm-v3.99u/bin/clang-7 CXX is /opt/mongodbtoolchain/v3/bin/clang++ /opt/mongodbtoolchain/v3/bin/clang++ resolves to /opt/mongodbtoolchain/revisions/e5348beb43e147b74a40f4ca5fb05a330ea646cf/stow/llvm-v3.99u/bin/clang-7 Checking whether the C compiler works... (cached) yes Checking whether the C++ compiler works... (cached) yes Checking that the C++ compiler can link a C++ program... no C++ compiler /opt/mongodbtoolchain/v3/bin/clang++ can't link C++ programs See /home/ubuntu/mongo/build/scons/config.log for details
/opt/mongodbtoolchain/v3/bin/clang++ -o build/scons/opt/sconf_temp/conftest_ac30bfea77045c1c67c4f51773b51414_0_a328baf5669f1d30a6b15100081d56ea -Wl,-O2 -Wl,--icf=safe -Wl,--hash-style=gnu -Wl,-Bsymbolic-functions build/scons/opt/sconf_temp/conftest_ac30bfea77045c1c67c4f51773b51414_0.o /opt/mongodbtoolchain/v3/bin/ld: unrecognized option '--icf=safe' /opt/mongodbtoolchain/v3/bin/ld: use the --help option for usage information clang-7: error: linker command failed with exit code 1 (use -v to see invocation) scons: Configure: no
- is caused by
-
SERVER-49465 Builds with -fuse-ld=bfd fail in --link-model=dynamic
- Closed