Bug #67233
openCMakeTestCXXCompiler.cmake fails: /usr/bin/ld: cannot find -lstdc++: No such file or directory
0%
Description
while experimenting with https://github.com/ceph/ceph/pull/58384 to bump our gcc version from 11 to 12, i seem to have broken the ceph-pull-requests jobs on other branches
from an example log https://jenkins.ceph.com/job/ceph-pull-requests/140102/consoleFull#-16451420407641bc0b-bacc-4481-8290-0cf28df0ce68:
+ cmake -GNinja -DWITH_PYTHON3=3.10 -DWITH_CCACHE=ON -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=clang++-14 -DCMAKE_C_COMPILER=clang-14 -DCMAKE_CXX_FLAGS_DEBUG=-Werror -DENABLE_GIT_VERSION=OFF -DWITH_GTEST_PARALLEL=ON -DWITH_FIO=ON -DWITH_CEPHFS_SHELL=ON -DWITH_GRAFANA=ON -DWITH_SPDK=ON -DWITH_RBD_MIRROR=ON -DWITH_SEASTAR=ON -DWITH_RBD_RWL=ON -DWITH_RBD_SSD_CACHE=ON -DCMAKE_CXX_COMPILER=clang++-14 -DCMAKE_C_COMPILER=clang-14 -DCMAKE_CXX_FLAGS_DEBUG=-Werror -DENABLE_GIT_VERSION=OFF -DWITH_GTEST_PARALLEL=ON -DWITH_FIO=ON -DWITH_CEPHFS_SHELL=ON -DWITH_GRAFANA=ON -DWITH_SPDK=ON -DWITH_RBD_MIRROR=ON -DWITH_SEASTAR=ON -DWITH_RBD_RWL=ON -DWITH_RBD_SSD_CACHE=ON -DWITH_SYSTEM_BOOST=ON -DBOOST_ROOT=/opt/ceph ..
-- The CXX compiler identification is Clang 14.0.0
-- The C compiler identification is Clang 14.0.0
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /usr/bin/clang-14
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /usr/bin/clang++-14
-- Check for working CXX compiler: /usr/bin/clang++-14 - broken
CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message):
The C++ compiler
"/usr/bin/clang++-14"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/jenkins-build/build/workspace/ceph-pull-requests/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/ninja cmTC_371d5 && [1/2] Building CXX object CMakeFiles/cmTC_371d5.dir/testCXXCompiler.cxx.o
[2/2] Linking CXX executable cmTC_371d5
FAILED: cmTC_371d5
: && /usr/bin/clang++-14 CMakeFiles/cmTC_371d5.dir/testCXXCompiler.cxx.o -o cmTC_371d5 && :
/usr/bin/ld: cannot find -lstdc++: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
this has been working with clang-14 and gcc-11, but the installation of gcc-12 seems to have broken clang. there's a relevant stackoverflow thread in https://stackoverflow.com/questions/74543715/usr-bin-ld-cannot-find-lstdc-no-such-file-or-directory-on-running-flutte whose solution is "install libstdc++-12-dev"
i was able to reproduce this issue in a ubuntu 22.04 vm. it shows that clang is selecting gcc-12 for its std library:
$ clang++-14 --verbose Ubuntu clang version 14.0.0-1ubuntu1.1 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12 Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12 Candidate multilib: .;@m64 Selected multilib: .;@m64
nothing in the ceph build installs that as a dependency, so i think the right answer is to go through all of these ubuntu 22.04 nodes and install that package manually
Updated by Rongqi Sun over 1 year ago
Bacause libstdc++-12-dev will cause seastar issue, I suggest uninstall libgcc-12-dev.
Updated by Redouane Kachach Elhicou over 1 year ago
Plz, do we have any update on this? we can't merge without a green make check :(
Updated by Casey Bodley over 1 year ago
Redouane Kachach Elhichou wrote in #note-2:
Plz, do we have any update on this? we can't merge without a green make check :(
the cleanup effort is ongoing in https://ceph-storage.slack.com/archives/C1HFJ4VTN/p1722274076452799