compiler-rt runtime build fails with non-OS gcc
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Related to this change: https://github.com/llvm/llvm-project/pull/77537
The removal of GCC_INSTALL_PREFIX has the (unintended?) consequence of not being able to build compiler-rt as a runtime with old systems.
Building on CentOS 7 w/ a custom gcc 13.3.0 installation outside of /usr
Typically for a build I set CC=gcc and CXX=g++ and use GCC from my $PATH (CC=gcc to avoid `cc` being picked up from /usr/bin)
After moving compiler-rt to a RUNTIME from PROJECT (https://github.com/llvm/llvm-project/issues/181898) I see this:
```
fbef6827b06d: [2380/2793] Building CXX object compiler-rt/lib/xray/CMakeFiles/RTXrayPROFILING.x86_64.dir/xray_profile_collector.cpp.o
fbef6827b06d: FAILED: [code=1] compiler-rt/lib/xray/CMakeFiles/RTXrayPROFILING.x86_64.dir/xray_profile_collector.cpp.o
fbef6827b06d: /build/llvm-project-22.1.0.src/build/bin/clang++ --target=x86_64-unknown-linux-gnu -DSANITIZER_COMMON_NO_REDEFINE_BUILTINS -DXRAY_HAS_EXCEPTIONS=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/build/llvm-project-22.1.0.src/compiler-rt/lib/xray/.. -I/build/llvm-project-22.1.0.src/compiler-rt/lib/xray/../../include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -Wno-unused-parameter -O3 -DNDEBUG -std=c++17 -m64 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -ftrivial-auto-var-init=pattern -Wno-format -fno-rtti -MD -MT compiler-rt/lib/xray/CMakeFiles/RTXrayPROFILING.x86_64.dir/xray_profile_collector.cpp.o -MF compiler-rt/lib/xray/CMakeFiles/RTXrayPROFILING.x86_64.dir/xray_profile_collector.cpp.o.d -o compiler-rt/lib/xray/CMakeFiles/RTXrayPROFILING.x86_64.dir/xray_profile_collector.cpp.o -c /build/llvm-project-22.1.0.src/compiler-rt/lib/xray/xray_profile_collector.cpp
fbef6827b06d: In file included from /build/llvm-project-22.1.0.src/compiler-rt/lib/xray/xray_profile_collector.cpp:14:
fbef6827b06d: In file included from /build/llvm-project-22.1.0.src/compiler-rt/lib/xray/xray_profile_collector.h:20:
fbef6827b06d: /build/llvm-project-22.1.0.src/compiler-rt/lib/xray/xray_function_call_trie.h:142:37: error: no type named 'byte' in namespace 'std'
fbef6827b06d: 142 | alignas(NodeAllocatorType) std::byte
fbef6827b06d: | ~~~~~^
fbef6827b06d: /build/llvm-project-22.1.0.src/compiler-rt/lib/xray/xray_function_call_trie.h:144:37: error: no type named 'byte' in namespace 'std'
fbef6827b06d: 144 | alignas(RootAllocatorType) std::byte
fbef6827b06d: | ~~~~~^
fbef6827b06d: /build/llvm-project-22.1.0.src/compiler-rt/lib/xray/xray_function_call_trie.h:146:44: error: no type named 'byte' in namespace 'std'
fbef6827b06d: 146 | alignas(ShadowStackAllocatorType) std::byte
fbef6827b06d: |
```
A few workarounds were to set
```
-DGCC_INSTALL_PREFIX=${UTILS_GCC} \
-DUSE_DEPRECATED_GCC_INSTALL_PREFIX=ON \
```
or (but still used libstdc++?)
```
-DCOMPILER_RT_CXX_LIBRARY=libcxx
```
or
```
-DCLANG_DEFAULT_RTLIB=compiler-rt \
-DCLANG_DEFAULT_CXX_STDLIB=libc++ \
-DCLANG_DEFAULT_UNWINDLIB=libunwind \
```
but it would still link to libstdc++?
I cant set a config alongside the clang binaries at this point in the build to set clang/clang++ options to set the the correct gcc-install-dir.
Contributor guide
Assessment
This issue has not been assessed yet.