-
Notifications
You must be signed in to change notification settings - Fork 2k
easy-build flow: on linux, if both GCC and Clang are installed, build fails because CMake picks GCC #8515
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
Comments
I think that is in expected, you need to tell Filament where is clang if your default compiler is not clang.
|
I only got as far as using the "easy build" flow. |
I made a fresh docker image based on Ubuntu Noble 24.04, installed cmake, ninja-build, gcc, and clang. Then specifying the CC and CXX and CXXFLAGS as suggested also fails: # CC=/usr/bin/clang CXX=/usr/bin/clang++ CXXFLAGS=-stdlib=libc++ ./build.sh -c release
Cleaning build directories...
Building release in out/cmake-release...
-- The C compiler identification is Clang 18.1.3
-- The CXX compiler identification is Clang 18.1.3
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- 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-3.28/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: '/src/filament/out/cmake-release/CMakeFiles/CMakeScratch/TryCompile-rZUKFq'
Run Build Command(s): /usr/bin/ninja -v cmTC_13331
[1/2] /usr/bin/clang++ -stdlib=libc++ -MD -MT CMakeFiles/cmTC_13331.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_13331.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_13331.dir/testCXXCompiler.cxx.o -c /src/filament/out/cmake-release/CMakeFiles/CMakeScratch/TryCompile-rZUKFq/testCXXCompiler.cxx
[2/2] : && /usr/bin/clang++ -stdlib=libc++ CMakeFiles/cmTC_13331.dir/testCXXCompiler.cxx.o -o cmTC_13331 && :
FAILED: cmTC_13331
: && /usr/bin/clang++ -stdlib=libc++ CMakeFiles/cmTC_13331.dir/testCXXCompiler.cxx.o -o cmTC_13331 && :
/usr/bin/ld: cannot find -lc++: No such file or directory
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:17 (project)
-- Configuring incomplete, errors occurred!
This is probably just a documentation issue. |
When I modify the command line to use -libstdc++ I get past configuration but fail compilation because it can't find the C++ headers. CC=/usr/bin/clang CXX=/usr/bin/clang++ CXXFLAGS=-stdlib=libstdc++ ./build.sh -c release | tee build.log I'm attaching the build.log file. |
So in the BUILD instructions, there are some dependencies. Can you try installing them and try again? (You'll have to remove the Instead of |
I agree it should be the dependency issue since the specifying |
CMake will default to GCC if it's available. Force use of the latest Clang instead. This can be overridden with CC, CXX, and CXXFLAGS Fixed: google#8515
CMake will default to GCC if it's available. Force use of the latest Clang instead. This can be overridden with CC, CXX, and CXXFLAGS Fixed: google#8515
CMake will default to GCC if it's available. Force use of the oldest installed Clang instead. This can be overridden with CC, CXX, and CXXFLAGS Fixed: google#8515
Describe the bug
On Linux a default build will fail because CMake selects GCC instead of Clang
To Reproduce
Steps to reproduce the behavior:
./build.sh release
Expected behavior
When clang is available, Filament should be built.
Screenshots
If applicable, add screenshots to help explain your problem.
Logs
If applicable, copy full logs from your console here. Please do not
use screenshots of logs, copy them as text, use gist or attach an uncompressed file.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: