When building with a clang-based toolchain, libomp requires compiler-rt in the correct version to be present. This dependency is not currently expressed in the ebuilds. This is especially problematic when upgrading the clang-based toolchain to a newer release, in which case dependency resolution (on my machine) wants to build the new limomp before the associated compiler-rt, leading to configure failures: ---- -- Check for working C compiler: /usr/lib/ccache/bin/clang-15 -- Check for working C compiler: /usr/lib/ccache/bin/clang-15 - broken CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message): The C compiler "/usr/lib/ccache/bin/clang-15" is not able to compile a simple test program. It fails with the following output: Change Dir: /var/tmp/portage/sys-libs/libomp-15.0.3/work/openmp_build-abi_x86_32.x86/CMakeFiles/CMakeTmp Run Build Command(s):/usr/bin/ninja cmTC_518dc && [1/2] Building C object CMakeFiles/cmTC_518dc.dir/testCCompiler.c.o [2/2] Linking C executable cmTC_518dc FAILED: cmTC_518dc : && /usr/lib/ccache/bin/clang-15 -m32 -mfpmath=sse -O3 -march=native -mtune=native -pipe -fomit-frame-pointer -Wl,-O3 -Wl,--as-needed -lm CMakeFiles/cmTC_518dc.dir/testCCompiler.c.o -o cmTC_518dc && : ld.lld: error: cannot open /usr/lib/llvm/15/bin/../../../../lib/clang/15.0.3/lib/linux/libclang_rt.builtins-i386.a: No such file or directory ld.lld: error: cannot open /usr/lib/llvm/15/bin/../../../../lib/clang/15.0.3/lib/linux/libclang_rt.builtins-i386.a: No such file or directory clang-15: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed. ---- (see attached build log) In this case, I was upgrading the toolchain from 15.0.2 to 15.0.3, and at the time compiler-rt was still at 15.0.2. Manually bumping compiler-rt to 15.0.3 allowed libomp to be upgraded, too. Reproducible: Always Steps to Reproduce: 1. Have a clang-based toolchain including compiler-rt and libomp 2. Try to bump the toolchain version via Portage's automatic dependency resolution Actual Results: If update of libomp is scheduled before update of compiler-rt, configure fails Expected Results: libomp should be built after compiler-rt
Created attachment 826691 [details] build.log
Created attachment 826693 [details] emerge --info
I'm sorry but we can't really solve this dependency problem. sys-libs/libomp can be built with either GCC or Clang, and we definitely don't want to force the whole clang toolchain when someone uses GCC to build it.
No way to do this conditionally based on current toolchain? I mean I can deal with this myself, but it does break automatic upgrades for clang users, and if that is ever supposed to be a supported thing, then I guess a solution needs to be found...
No, not really. The metadata is static, so it can't know what toolchain is being used. However, I'm thinking that moving clang-runtime dependency in sys-devel/clang from PDEPEND to RDEPEND might help Portage order packages better.
In LLVM 16.x (currently snapshots with no KEYWORDS), I've moved sys-devel/clang-runtime to RDEPEND of sys-devel/clang and we've changed compiler-rt to be installed into /usr/lib/clang/16 (without minor version), so hopefully upgrades will be less painful in the future.