Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 923228 - dev-util/intel_clc seems to pull in several versions of clang/llvm at the same time
Summary: dev-util/intel_clc seems to pull in several versions of clang/llvm at the sam...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: LLVM support project
URL:
Whiteboard:
Keywords: PullRequest
Depends on: 926179
Blocks:
  Show dependency tree
 
Reported: 2024-01-29 08:05 UTC by Gabriele Svelto
Modified: 2024-03-05 05:06 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gabriele Svelto 2024-01-29 08:05:48 UTC
I've noticed that my system had both the clang:16/llvm:16 and clang:17/llvm:17 slots used which was surprising because I didn't have a specific version of either of them in my world file, so I assumed I'd get only the latest version. So I tried to remove either one of them only to discover that the dev-util/intel_clc (pulled in by mesa) appears to depend on both slots at the same time.

Here's the output of emerge --ask --verbose --depclean llvm:16 clang:16

Calculating dependencies... done!
  sys-devel/clang-16.0.6 pulled in by:
    dev-libs/libclc-17.0.6 requires sys-devel/clang:16
    dev-util/intel_clc-23.3.1-r1 requires sys-devel/clang:16
    media-sound/helvum-0.4.1 requires <sys-devel/clang-17
    sys-devel/clang-toolchain-symlinks-16-r2 requires sys-devel/clang:16

  sys-devel/llvm-16.0.6 pulled in by:
    dev-util/intel_clc-23.3.1-r1 requires sys-devel/llvm:16
    dev-util/spirv-llvm-translator-16.0.0-r1 requires sys-devel/llvm:16=, sys-devel/llvm:16/16=
    sys-devel/clang-16.0.6 requires ~sys-devel/llvm-16.0.6:16=[-debug,abi_x86_32(-),abi_x86_64(-)], ~sys-devel/llvm-16.0.6[llvm_targets_XCore], ~sys-devel/llvm-16.0.6[llvm_targets_Mips], ~sys-devel/llvm-16.0.6[llvm_targets_SystemZ], ~sys-devel/llvm-16.0.6[llvm_targets_AMDGPU], ~sys-devel/llvm-16.0.6[llvm_targets_AArch64], ~sys-devel/llvm-16.0.6[llvm_targets_ARM], ~sys-devel/llvm-16.0.6[llvm_targets_Hexagon], ~sys-devel/llvm-16.0.6[llvm_targets_RISCV], ~sys-devel/llvm-16.0.6[llvm_targets_AVR], ~sys-devel/llvm-16.0.6:16/16=[-debug,abi_x86_32(-),abi_x86_64(-)], ~sys-devel/llvm-16.0.6[llvm_targets_Lanai], ~sys-devel/llvm-16.0.6[llvm_targets_X86], ~sys-devel/llvm-16.0.6[llvm_targets_VE], ~sys-devel/llvm-16.0.6[llvm_targets_WebAssembly], ~sys-devel/llvm-16.0.6[llvm_targets_BPF], ~sys-devel/llvm-16.0.6[llvm_targets_PowerPC], ~sys-devel/llvm-16.0.6[llvm_targets_MSP430], ~sys-devel/llvm-16.0.6[llvm_targets_Sparc], ~sys-devel/llvm-16.0.6[llvm_targets_NVPTX], ~sys-devel/llvm-16.0.6[llvm_targets_LoongArch]
    sys-devel/llvm-toolchain-symlinks-16-r1 requires sys-devel/llvm:16
    sys-libs/compiler-rt-16.0.6 requires sys-devel/llvm:16
    sys-libs/compiler-rt-sanitizers-16.0.6 requires sys-devel/llvm:16

And here's emerge --ask --verbose --depclean llvm:17 clang:17:

alculating dependencies... done!
  sys-devel/clang-17.0.6 pulled in by:
    dev-util/intel_clc-23.3.1-r1 requires <sys-devel/clang-18:=, <sys-devel/clang-18:17/17=
    sys-devel/clang-common-17.0.6-r1 requires sys-devel/clang:*
    sys-devel/clang-toolchain-symlinks-17 requires sys-devel/clang:17
    sys-libs/compiler-rt-16.0.6 requires sys-devel/clang
    sys-libs/compiler-rt-17.0.6 requires sys-devel/clang
    sys-libs/compiler-rt-sanitizers-16.0.6 requires sys-devel/clang
    sys-libs/compiler-rt-sanitizers-17.0.6 requires sys-devel/clang

  sys-devel/llvm-17.0.6 pulled in by:
    dev-util/intel_clc-23.3.1-r1 requires <sys-devel/llvm-18:=, <sys-devel/llvm-18:17/17=
    media-libs/mesa-23.3.1 requires <sys-devel/llvm-18:17/17=[llvm_targets_AMDGPU(+),abi_x86_32(-),abi_x86_64(-)], <sys-devel/llvm-18:=[llvm_targets_AMDGPU(+),abi_x86_32(-),abi_x86_64(-)], sys-devel/llvm:17[llvm_targets_AMDGPU(+),abi_x86_32(-),abi_x86_64(-)]
    sys-devel/clang-17.0.6 requires ~sys-devel/llvm-17.0.6[llvm_targets_Mips], ~sys-devel/llvm-17.0.6[llvm_targets_AMDGPU], ~sys-devel/llvm-17.0.6[llvm_targets_BPF], ~sys-devel/llvm-17.0.6[llvm_targets_Hexagon], ~sys-devel/llvm-17.0.6[llvm_targets_ARM], ~sys-devel/llvm-17.0.6[llvm_targets_LoongArch], ~sys-devel/llvm-17.0.6[llvm_targets_PowerPC], ~sys-devel/llvm-17.0.6[llvm_targets_SystemZ], ~sys-devel/llvm-17.0.6[llvm_targets_NVPTX], ~sys-devel/llvm-17.0.6[llvm_targets_X86], ~sys-devel/llvm-17.0.6[llvm_targets_WebAssembly], ~sys-devel/llvm-17.0.6[llvm_targets_VE], ~sys-devel/llvm-17.0.6[llvm_targets_RISCV], ~sys-devel/llvm-17.0.6[llvm_targets_Lanai], ~sys-devel/llvm-17.0.6:17=[-debug,abi_x86_32(-),abi_x86_64(-)], ~sys-devel/llvm-17.0.6[llvm_targets_Sparc], ~sys-devel/llvm-17.0.6[llvm_targets_XCore], ~sys-devel/llvm-17.0.6[llvm_targets_AVR], ~sys-devel/llvm-17.0.6:17/17=[-debug,abi_x86_32(-),abi_x86_64(-)], ~sys-devel/llvm-17.0.6[llvm_targets_MSP430], ~sys-devel/llvm-17.0.6[llvm_targets_AArch64]
    sys-devel/llvm-toolchain-symlinks-17 requires sys-devel/llvm:17
    sys-devel/llvmgold-17 requires sys-devel/llvm:17[binutils-plugin]
    sys-libs/compiler-rt-17.0.6 requires sys-devel/llvm:17
    sys-libs/compiler-rt-sanitizers-17.0.6 requires sys-devel/llvm:17

This is not a big deal, but I thought it was worth reporting.

Reproducible: Always

Steps to Reproduce:
I think this happened simply through updates since I didn't install either package manually.
Actual Results:  
I have two versions of clang/llvm installed at the same time, both of which are required.

Expected Results:  
dev-util/intel_clc only depends of one version of clang/llvm
Comment 1 Matt Turner gentoo-dev 2024-01-29 18:40:30 UTC
I just copied what we did in media-libs/mesa.

llvm@: do you see anything wrong here?
Comment 2 Arsen Arsenović gentoo-dev 2024-02-04 22:17:54 UTC
seems that the same does not apply to mesa - it only depends on one llvm (at least in the docker.io/gentoo/stage3:amd64-desktop-systemd-mergedusr image):

e62f946ebc17 / # emerge -cpv llvm:16
!!! You have no world file.

Calculating dependencies... done!
  sys-devel/llvm-16.0.6 pulled in by:
    dev-util/intel_clc-23.3.1-r1 requires sys-devel/llvm:16
    dev-util/spirv-llvm-translator-16.0.0-r1 requires sys-devel/llvm:16=, sys-devel/llvm:16/16=
    sys-devel/clang-16.0.6 requires ~sys-devel/llvm-16.0.6[llvm_targets_BPF], ~sys-devel/llvm-16.0.6:16/16=[-debug,abi_x86_64(-)], ~sys-devel/llvm-16.0.6[llvm_targets_SystemZ], ~sys-devel/llvm-16.0.6[llvm_targets_WebAssembly], ~sys-devel/llvm-16.0.6[llvm_targets_Lanai], ~sys-devel/llvm-16.0.6[llvm_targets_NVPTX], ~sys-devel/llvm-16.0.6[llvm_targets_ARM], ~sys-devel/llvm-16.0.6[llvm_targets_LoongArch], ~sys-devel/llvm-16.0.6[llvm_targets_AVR], ~sys-devel/llvm-16.0.6[llvm_targets_XCore], ~sys-devel/llvm-16.0.6[llvm_targets_AMDGPU], ~sys-devel/llvm-16.0.6[llvm_targets_X86], ~sys-devel/llvm-16.0.6[llvm_targets_Hexagon], ~sys-devel/llvm-16.0.6:16=[-debug,abi_x86_64(-)], ~sys-devel/llvm-16.0.6[llvm_targets_VE], ~sys-devel/llvm-16.0.6[llvm_targets_Mips], ~sys-devel/llvm-16.0.6[llvm_targets_MSP430], ~sys-devel/llvm-16.0.6[llvm_targets_AArch64], ~sys-devel/llvm-16.0.6[llvm_targets_Sparc], ~sys-devel/llvm-16.0.6[llvm_targets_RISCV], ~sys-devel/llvm-16.0.6[llvm_targets_PowerPC]
    sys-devel/llvm-toolchain-symlinks-16-r1 requires sys-devel/llvm:16
    sys-libs/compiler-rt-16.0.6 requires sys-devel/llvm:16
    sys-libs/compiler-rt-sanitizers-16.0.6 requires sys-devel/llvm:16

>>> No packages selected for removal by depclean
Packages installed:   529
Packages in world:    0
Packages in system:   49
Required packages:    529
Number to remove:     0
e62f946ebc17 / # emerge -cpv llvm:17
!!! You have no world file.

Calculating dependencies... done!
  sys-devel/llvm-17.0.6 pulled in by:
    dev-util/intel_clc-23.3.1-r1 requires <sys-devel/llvm-18:17/17=, <sys-devel/llvm-18:=
    media-libs/mesa-23.3.1 requires <sys-devel/llvm-18:=[llvm_targets_AMDGPU(+),abi_x86_64(-)], sys-devel/llvm:17[llvm_targets_AMDGPU(+),abi_x86_64(-)], <sys-devel/llvm-18:17/17=[llvm_targets_AMDGPU(+),abi_x86_64(-)]
    sys-devel/clang-17.0.6 requires ~sys-devel/llvm-17.0.6[llvm_targets_XCore], ~sys-devel/llvm-17.0.6[llvm_targets_RISCV], ~sys-devel/llvm-17.0.6:17=[-debug,abi_x86_64(-)], ~sys-devel/llvm-17.0.6[llvm_targets_SystemZ], ~sys-devel/llvm-17.0.6[llvm_targets_NVPTX], ~sys-devel/llvm-17.0.6[llvm_targets_Hexagon], ~sys-devel/llvm-17.0.6[llvm_targets_Sparc], ~sys-devel/llvm-17.0.6[llvm_targets_WebAssembly], ~sys-devel/llvm-17.0.6[llvm_targets_ARM], ~sys-devel/llvm-17.0.6[llvm_targets_Mips], ~sys-devel/llvm-17.0.6[llvm_targets_MSP430], ~sys-devel/llvm-17.0.6[llvm_targets_AArch64], ~sys-devel/llvm-17.0.6[llvm_targets_BPF], ~sys-devel/llvm-17.0.6[llvm_targets_Lanai], ~sys-devel/llvm-17.0.6:17/17=[-debug,abi_x86_64(-)], ~sys-devel/llvm-17.0.6[llvm_targets_AVR], ~sys-devel/llvm-17.0.6[llvm_targets_VE], ~sys-devel/llvm-17.0.6[llvm_targets_AMDGPU], ~sys-devel/llvm-17.0.6[llvm_targets_LoongArch], ~sys-devel/llvm-17.0.6[llvm_targets_X86], ~sys-devel/llvm-17.0.6[llvm_targets_PowerPC]
    sys-devel/llvm-toolchain-symlinks-17 requires sys-devel/llvm:17
    sys-devel/llvmgold-17 requires sys-devel/llvm:17[binutils-plugin]
    sys-libs/compiler-rt-17.0.6 requires sys-devel/llvm:17
    sys-libs/compiler-rt-sanitizers-17.0.6 requires sys-devel/llvm:17

>>> No packages selected for removal by depclean
Packages installed:   529
Packages in world:    0
Packages in system:   49
Required packages:    529
Number to remove:     0
e62f946ebc17 / #
Comment 3 Arsen Arsenović gentoo-dev 2024-02-04 22:55:29 UTC
well, anyway, ultimately this (seemingly) happens because the package depstring includes:

	<sys-devel/clang-$((LLVM_MAX_SLOT + 1)):=
	<sys-devel/llvm-$((LLVM_MAX_SLOT + 1)):=


these are not sufficient to constrain the generated || ( block ) to be sufficiently as in the mesa depstring, forcing only one of them to be 'useful'.

the seemingly obvious solution of adding

	<dev-util/spirv-llvm-translator-$((LLVM_MAX_SLOT + 1)):=

also won't work because portage, as if to annoy me, for some reason decides to materialize those three deps as:

<sys-devel/clang-18:17/17=
<sys-devel/llvm-18:17/17=
<dev-util/spirv-llvm-translator-18:16/16=

(which is sufficient proof that it can do so in the general case)

in general, the llvm.eclass model of depending on LLVM via pulling in *either* clang or llvm fixes this issue, but, obviously, that is not scalable when we need to pull two things that depend on llvm (in this instance s-l-t and clang)

maybe an LLVM_TARGETS is in order?  :^)

jokes aside, I'm not quite sure if I'm right in my analysis or fix attempt, but this seems to be the mechanism exploited in mesa, and a reason for it failing in intel_clc
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-02-05 23:46:59 UTC
See https://marc.info/?l=gentoo-dev&m=170715274130875&w=2.
Comment 5 Larry the Git Cow gentoo-dev 2024-02-10 10:47:30 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fe756615c56e52511bdd35c8247a59ecfc1f5f79

commit fe756615c56e52511bdd35c8247a59ecfc1f5f79
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2024-02-05 19:30:02 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2024-02-10 10:47:24 +0000

    dev-util/intel_clc: Migrate to llvm-r1
    
    Closes: https://bugs.gentoo.org/923228
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 dev-util/intel_clc/intel_clc-24.0.0.ebuild | 48 ++++++------------------------
 dev-util/intel_clc/intel_clc-9999.ebuild   | 48 ++++++------------------------
 2 files changed, 18 insertions(+), 78 deletions(-)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5618de75aec49009489efb560a89e014fd060524

commit 5618de75aec49009489efb560a89e014fd060524
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2024-02-05 19:29:36 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2024-02-10 10:47:23 +0000

    llvm-r1.eclass: Initial version
    
    Bug: https://bugs.gentoo.org/923228
    Bug: https://bugs.gentoo.org/880671
    Closes: https://bugs.gentoo.org/821955
    Closes: https://bugs.gentoo.org/919150
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 eclass/llvm-r1.eclass   | 250 ++++++++++++++++++++++++++++++++++++++++++++++++
 eclass/tests/llvm-r1.sh | 151 +++++++++++++++++++++++++++++
 2 files changed, 401 insertions(+)
Comment 6 Larry the Git Cow gentoo-dev 2024-03-05 05:05:28 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=13236593cbd00ae106ac27544010f302d98dc115

commit 13236593cbd00ae106ac27544010f302d98dc115
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-03-05 05:01:32 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-03-05 05:04:57 +0000

    dev-util/intel_clc: backport llvm-r1 to 23.x
    
    Bug: https://bugs.gentoo.org/923228
    Closes: https://bugs.gentoo.org/924876
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-util/intel_clc/intel_clc-23.3.6-r1.ebuild | 86 +++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)