Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 879157 - sys-libs/libomp should depend on sys-libs/compiler-rt
Summary: sys-libs/libomp should depend on sys-libs/compiler-rt
Status: RESOLVED CANTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Bernard Cafarelli
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: systemwide-clang
  Show dependency tree
 
Reported: 2022-11-02 10:52 UTC by Manuel Nickschas
Modified: 2022-11-14 04:04 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log.xz,1.84 KB, application/x-xz)
2022-11-02 10:53 UTC, Manuel Nickschas
Details
emerge --info (emerge.info.xz,7.29 KB, application/x-xz)
2022-11-02 10:54 UTC, Manuel Nickschas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel Nickschas 2022-11-02 10:52:43 UTC
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
Comment 1 Manuel Nickschas 2022-11-02 10:53:49 UTC
Created attachment 826691 [details]
build.log
Comment 2 Manuel Nickschas 2022-11-02 10:54:04 UTC
Created attachment 826693 [details]
emerge --info
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-11-03 04:00:00 UTC
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.
Comment 4 Manuel Nickschas 2022-11-03 11:40:31 UTC
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...
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-11-03 13:58:23 UTC
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.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-11-14 04:04:30 UTC
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.