Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake linker configuration issue on fedora #937

Open
FuchtelJockel opened this issue Oct 1, 2024 · 3 comments
Open

cmake linker configuration issue on fedora #937

FuchtelJockel opened this issue Oct 1, 2024 · 3 comments

Comments

@FuchtelJockel
Copy link

FuchtelJockel commented Oct 1, 2024

  1. mkdir build
  2. cd build
  3. 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.

@pvelesko
Copy link
Collaborator

pvelesko commented Oct 2, 2024

CMAKE_C_COMPILER_WORKS
CMAKE_CXX_COMPILER_WORKS

What if you skip compiler checks -DCMAKE_CXX_COMPILER_WORKS=1 ?

@FuchtelJockel
Copy link
Author

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

@FuchtelJockel
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants