"/usr/bin/ld: cannot find -lc++" when using the clang-lto toolchain file
Calinou opened this issue · 2 comments
Calinou commented
I'm trying out Polly on this repository but I'm getting this error on Fedora 29:
❯ cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="$POLLY_ROOT/clang-lto.cmake"
-- [polly] Used toolchain: clang / LLVM Standard C++ Library (libc++) / c++11 support / LTO
-- The C compiler identification is Clang 7.0.1
-- The CXX compiler identification is Clang 7.0.1
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:45 (message):
The C++ compiler
"/usr/bin/clang++"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/hugo/Documents/Git/trackballs/trackballs/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_d2b97/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_d2b97.dir/build.make CMakeFiles/cmTC_d2b97.dir/build
gmake[1]: Entering directory '/home/hugo/Documents/Git/trackballs/trackballs/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_d2b97.dir/testCXXCompiler.cxx.o
/usr/bin/clang++ -std=c++11 -stdlib=libc++ -flto=thin -std=c++11 -o CMakeFiles/cmTC_d2b97.dir/testCXXCompiler.cxx.o -c /home/hugo/Documents/Git/trackballs/trackballs/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTC_d2b97
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d2b97.dir/link.txt --verbose=1
/usr/bin/clang++ -std=c++11 -stdlib=libc++ -flto=thin -rdynamic CMakeFiles/cmTC_d2b97.dir/testCXXCompiler.cxx.o -o cmTC_d2b97
/usr/bin/ld: cannot find -lc++
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[1]: *** [CMakeFiles/cmTC_d2b97.dir/build.make:87: cmTC_d2b97] Error 1
gmake[1]: Leaving directory '/home/hugo/Documents/Git/trackballs/trackballs/build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:121: cmTC_d2b97/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "/home/hugo/Documents/Git/trackballs/trackballs/build/CMakeFiles/CMakeOutput.log".
See also "/home/hugo/Documents/Git/trackballs/trackballs/build/CMakeFiles/CMakeError.log".
I can reproduce this in other CMake-based projects too.
ruslo commented
-- [polly] Used toolchain: clang / LLVM Standard C++ Library (libc++) / c++11 support / LTO
This toolchain is using libc++ and I guess "/usr/bin/ld: cannot find -lc++" error means that libc++ library is not installed or available.
ruslo commented
Closing inactive discussion.