chipStar
chipStar copied to clipboard
cmake linker configuration issue on fedora
- mkdir build
- cd build
- cmake ..
-- Detected architecture: x86_64
-- GCC base path: /usr/lib64
-- Using llvm-config: /usr/bin/llvm-config
-- Using CLANG_ROOT_PATH: /usr
-- Using LLVM_VERSION: 18.1.8
-- Using CMAKE_CXX_COMPILER_PATH: /usr/bin/clang++
-- Using CMAKE_C_COMPILER_PATH: /usr/bin/clang
-- CMAKE_CXX_COMPILER is set to . Overriding with /usr/bin/clang++
-- CMAKE_C_COMPILER is set to . Overriding with /usr/bin/clang
-- Using llvm-link: /usr/bin/llvm-link
-- XXX LLVM-version-major: 18
-- Using llvm-spirv: /usr/bin/llvm-spirv
-- Using clang-offload-bundler: /usr/bin/clang-offload-bundler
-- llvm-spirv version: LLVM (http://llvm.org/):
LLVM version 18.1.8
Optimized build.
-- The CXX compiler identification is Clang 18.1.8
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- 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:60 (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/alexander/TODO/de.demuc.colmap/chipStar/build/CMakeFiles/CMakeScratch/TryCompile-aorOCu'
Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_0129a/fast
/usr/bin/gmake -f CMakeFiles/cmTC_0129a.dir/build.make CMakeFiles/cmTC_0129a.dir/build
gmake[1]: Entering directory '/home/alexander/TODO/de.demuc.colmap/chipStar/build/CMakeFiles/CMakeScratch/TryCompile-aorOCu'
Building CXX object CMakeFiles/cmTC_0129a.dir/testCXXCompiler.cxx.o
/usr/bin/clang++ -Wno-duplicate-decl-specifier -Wno-tautological-constant-compare -Wno-c++20-extensions -Wno-unused-result -Wno-delete-abstract-non-virtual-dtor -Wno-deprecated-declarations -Wunused-command-line-argument -gdwarf-4 --gcc-toolchain=/usr/lib64 -MD -MT CMakeFiles/cmTC_0129a.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_0129a.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_0129a.dir/testCXXCompiler.cxx.o -c /home/alexander/TODO/de.demuc.colmap/chipStar/build/CMakeFiles/CMakeScratch/TryCompile-aorOCu/testCXXCompiler.cxx
Linking CXX executable cmTC_0129a
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0129a.dir/link.txt --verbose=1
/usr/bin/clang++ -Wno-duplicate-decl-specifier -Wno-tautological-constant-compare -Wno-c++20-extensions -Wno-unused-result -Wno-delete-abstract-non-virtual-dtor -Wno-deprecated-declarations -Wunused-command-line-argument -gdwarf-4 --gcc-toolchain=/usr/lib64 CMakeFiles/cmTC_0129a.dir/testCXXCompiler.cxx.o -o cmTC_0129a
/usr/bin/ld: cannot find crtbegin.o: No such file or directory
/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)
gmake[1]: *** [CMakeFiles/cmTC_0129a.dir/build.make:100: cmTC_0129a] Error 1
gmake[1]: Leaving directory '/home/alexander/TODO/de.demuc.colmap/chipStar/build/CMakeFiles/CMakeScratch/TryCompile-aorOCu'
gmake: *** [Makefile:127: cmTC_0129a/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
cmake/FindLLVM.cmake:144 (enable_language)
CMakeLists.txt:69 (include)
- crtbegin.o /usr/lib/gcc/x86_64-redhat-linux/14/crtbegin.o
- stdc++
ls /usr/lib/gcc/x86_64-redhat-linux/14/libstdc++* /usr/lib/gcc/x86_64-redhat-linux/14/libstdc++exp.a /usr/lib/gcc/x86_64-redhat-linux/14/libstdc++fs.a /usr/lib/gcc/x86_64-redhat-linux/14/libstdc++.so
Searching for this issue online or asking the AI didn't really help, sadly.
CMAKE_C_COMPILER_WORKS
CMAKE_CXX_COMPILER_WORKS
What if you skip compiler checks -DCMAKE_CXX_COMPILER_WORKS=1 ?
Now it configures until:
-- Looking for C++ include filesystem
-- Looking for C++ include filesystem - not found
-- Looking for C++ include experimental/filesystem
-- Looking for C++ include experimental/filesystem - not found
CMake Error at CMakeLists.txt:167 (message):
<filesystem> was not found.
I have installed both libcxx-devel and libstdc++-devel
$ find /usr/include/c++ -name filesystem
/usr/include/c++/14/experimental/filesystem
/usr/include/c++/14/filesystem
/usr/include/c++/v1/filesystem
I found the issue.
which gcc
/usr/lib64/ccache/gcc
This will set the GCC_BASE_PATH to /usr/lib64 and CMake will look for /usr/lib64/include instead of /usr/include.
I am seeing similar things with LLVM detection on Fedora, it detects LLVM and then later complains about LLVM config:
-- Using llvm-link: /bin/llvm-link
-- XXX LLVM-version-major:
-- Using llvm-spirv: /bin/llvm-spirv
-- Using clang-offload-bundler: /bin/clang-offload-bundler
-- llvm-spirv version: LLVM (http://llvm.org/):
LLVM version 19.1.5
Optimized build.
-- The C compiler identification is Clang 19.1.5
-- The CXX compiler identification is Clang 19.1.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at cmake/FindLLVM.cmake:146 (find_package):
Could not find a package configuration file provided by "LLVM" with any of
the following names:
LLVMConfig.cmake
llvm-config.cmake
Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
"LLVM_DIR" to a directory containing one of the above files. If "LLVM"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
CMakeLists.txt:69 (include)