Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 865165

Summary: sys-devel/llvm-15.0.0_rc2: llvm-config --cmakedir returns incorrect path, dependent packages can't find LLVMConfig.cmake
Product: Gentoo Linux Reporter: Petr Polezhaev <NightNord>
Component: Current packagesAssignee: LLVM support project <llvm>
Status: RESOLVED FIXED    
Severity: minor CC: mgorny, sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://reviews.llvm.org/D131878
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: compiler-rt-14.0.6-r1 fail build.log
Add LLVM_INSTALL_PACKAGE_DIR variable

Description Petr Polezhaev 2022-08-14 20:35:22 UTC
Here is what the 14 version outputs, which is correct
```
$ /usr/lib/llvm/14/bin/llvm-config --cmakedir
/usr/lib/llvm/14/lib64/cmake/llvm
```

And that's what 15 outputs, which is incorrect
```
$ /usr/lib/llvm/15/bin/llvm-config --cmakedir
/usr/lib/llvm/15/
```

This is used by the dependent packages to find LLVMConfig.cmake, which is not found in case of the llvm:15 output

Also, packages complain about non-monorepo layout - it is only using llvm-config as a fallback. I assume that's because it can't find the top-level (monorepo-level) cmake directory. Maybe also llvm directory as well, not sure. Considering that ebuilds already unpack llvmorg tarball, is there any harm in unpacking a bit more for each project? AFAIK, you don't need to actually build as monorepo (although I haven't tried it)

According to https://github.com/llvm/llvm-project/blame/main/llvm/tools/llvm-config/llvm-config.cpp this is the change that came from https://github.com/llvm/llvm-project/commit/a5640968f2f7485b2aa4919f5fa68fd8f23e2d1f

So, it expects `LLVM_INSTALL_PACKAGE_DIR` to be set to `/usr/lib/llvm/<version>/lib64/cmake/llvm`, I think

NOTE: This originally was a bug with compiler-rt failing to configure, but I see that now it compiles just fine (still fails to find LLVMConfig.cmake, but then uses correct source path)

Reproducible: Always

Steps to Reproduce:
1. echo -e "\n="{sys-devel/{clang,llvm,clang-runtime},sys-libs/{compiler-rt{,-sanitizers},libomp}}"-15.0.0_rc2 **" "\n=sys-devel/llvmgold-15 **" >> /etc/portage/package.accept_keywords/temp-llvm-15
2. emerge -1 llvm:15
3. check that llvm-config --version is 15.0.0
4. check llvm-config --cmakedir
Actual Results:  
llvm-config --cmakedir reports /usr/lib/llvm/15

Expected Results:  
llvm-config --cmakedir should report /usr/lib/llvm/15/lib64/cmake/llvm

Portage 3.0.34 (python 3.10.6-final-0, default/linux/amd64/17.1/desktop/plasma, gcc-12.1.1, glibc-2.35-r8, 5.18.13-gentoo x86_64)
=================================================================
System uname: Linux-5.18.13-gentoo-x86_64-AMD_Ryzen_9_5950X_16-Core_Processor-with-glibc2.35
KiB Mem:    32777304 total,   5779408 free
KiB Swap:   33554428 total,  29179440 free
Timestamp of repository gentoo: Sun, 14 Aug 2022 19:30:01 +0000
Head commit of repository gentoo: eeb4da5e8fa5e420eaa8756e1ab144d2799d1108
Timestamp of repository dotnet: Sun, 24 Jul 2022 22:47:27 +0000
Head commit of repository dotnet: 535bc122b4db34965d9c3f7fb57d6fa45595dd4f

Timestamp of repository guru: Fri, 12 Aug 2022 22:16:52 +0000
Head commit of repository guru: 5529fe4874b2e1922ea72534869311f9157b3f90

Timestamp of repository steam-overlay: Sun, 07 Aug 2022 21:46:52 +0000
Head commit of repository steam-overlay: 084da06a9ce5d6bf957bc1f67c238113d5d247bb

Timestamp of repository tastytea: Tue, 09 Aug 2022 18:31:56 +0000
Head commit of repository tastytea: 720a4f5200e96a27fe42ab224a732ca58fd49c33

Head commit of repository tlp: 4ba9fce0927a4bc87a4df54eb352a163a439810e

Timestamp of repository vortex: Sun, 14 Aug 2022 15:46:48 +0000
Head commit of repository vortex: 8bdf3c583d0789cab8ed329adb7d7c438b83bdb7

sh bash 5.1_p16-r1
ld GNU ld (Gentoo 2.38 p4) 2.38
app-misc/pax-utils:        1.3.5::gentoo
app-shells/bash:           5.1_p16-r1::gentoo
dev-java/java-config:      2.3.1::gentoo
dev-lang/perl:             5.36.0::gentoo
dev-lang/python:           3.7.13::gentoo, 3.8.13_p6::gentoo, 3.9.13_p4::gentoo, 3.10.6_p2::gentoo, 3.11.0_rc1::gentoo
dev-lang/rust:             1.62.1::gentoo
dev-util/cmake:            3.24.0::gentoo
dev-util/meson:            0.63.0::gentoo
sys-apps/baselayout:       2.8-r2::gentoo
sys-apps/openrc:           0.45.2::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/autoconf:        2.13-r2::gentoo, 2.71-r1::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.38-r2::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/clang:           15.0.0_rc2::gentoo
sys-devel/gcc:             12.1.1_p20220625::gentoo
sys-devel/gcc-config:      2.5-r1::gentoo
sys-devel/libtool:         2.4.7::gentoo
sys-devel/lld:             14.0.6::gentoo
sys-devel/llvm:            14.0.6-r2::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.19::gentoo (virtual/os-headers)
sys-libs/glibc:            2.35-r8::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts: 
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes

dotnet
    location: /var/db/repos/dotnet
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/dotnet.git
    masters: gentoo

guru
    location: /var/db/repos/guru
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/guru.git
    masters: gentoo

localrepo
    location: /var/db/repos/localrepo
    masters: gentoo

steam-overlay
    location: /var/db/repos/steam-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/steam-overlay.git
    masters: gentoo

tastytea
    location: /var/db/repos/tastytea
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/tastytea.git
    masters: guru gentoo

tlp
    location: /var/db/repos/tlp
    sync-type: git
    sync-uri: https://github.com/dywisor/tlp-portage.git
    sync-user: portage
    masters: gentoo

vortex
    location: /var/db/repos/vortex
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/vortex.git
    masters: gentoo

crossdev
    location: /var/db/repos/localrepo-crossdev
    masters: gentoo
    priority: 10

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=nzver2 -march=znver2"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=nzver2 -march=znver2"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="-q"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe -march=nzver2 -march=znver2"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live cgroup config-protect-if-modified distlocks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news noinfo nostrip parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=nzver2 -march=znver2"
GENTOO_MIRRORS="https://mirror.yandex.ru/gentoo-distfiles/ http://mirrors.evowise.com/gentoo/"
LANG="ru_RU.UTF-8"
LC_ALL="ru_RU.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j32"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/tmp"
SHELL="/bin/bash"
USE="DOTNET_TARGETS:net45 X a52 aac acl acpi activities alsa amd64 bash-completion bluetooth branding bzip2 cairo cdda cdr cli crypt cups dbus declarative dri dts dvd dvdr elogind encode exif flac fortran gdbm gif gpm gtk gui iconv icu ipv6 jpeg kde kwallet lcms libglvnd libnotify libtirpc libv4l mad mng mp3 mp4 mpeg multilib ncurses net40 networkmanager nls nptl ogg opencl opengl openmp pam pango pcre pdf plasma png policykit ppds pulseaudio qml qt5 readline sdl seccomp semantic-desktop spell split-usr ssl startup-notification svg tiff truetype udev udisks unicode upower usb v4l v4l2 vkd3d vorbis vulkan widgets wxwidgets x264 xattr xcb xinerama xml xv xvid zlib zsh-completion" ABI_X86="64 32" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 aes avx avx2 f16c fma3 pclmul popcnt sha sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput evdev" KERNEL="linux" L10N="en ru" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10 python3_7 python3_8 python3_9" RUBY_TARGETS="ruby27 ruby30 ruby31" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Petr Polezhaev 2022-08-14 22:44:00 UTC
Created attachment 799627 [details]
compiler-rt-14.0.6-r1 fail build.log

Actually, I lied, compiler-rt still fails, it just needs a complete env update, and then it can't find the llvm cmake modules anymore

So, this is actually a non-minor bug. There is a workaround - remove llvm:15, update env, install llvm:15 again (from binpkg) and then everything works, but links with llvm:14
Comment 2 Petr Polezhaev 2022-08-15 00:58:23 UTC
Created attachment 799633 [details, diff]
Add LLVM_INSTALL_PACKAGE_DIR variable

As I suspected, setting LLVM_INSTALL_PACKAGE_DIR fixes the issue. It is still affected by #850646 after that, but that one also has a working fix/workaround
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-08-15 05:45:24 UTC
The default LLVM_INSTALL_PACKAGE_DIR is correct.  Something else goes wrong along the way.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-08-15 06:38:01 UTC
This is a regression from https://reviews.llvm.org/D130539.  I'm working on a patch.
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-08-17 14:56:31 UTC
This has been merged to main and release/15.x branches now.  If you wish, you can confirm by installing 15.0.0.9999.  Otherwise, it'll be part of _rc3.