Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 715218 - dev-db/postgresql-12.2[llvm]: build fails when llvm & clang slots don't match
Summary: dev-db/postgresql-12.2[llvm]: build fails when llvm & clang slots don't match
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-29 02:39 UTC by Petronio Coelho
Modified: 2020-11-23 11:31 UTC (History)
3 users (show)

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


Attachments
build.log (build.log.gz,66.59 KB, application/gzip)
2020-03-29 02:43 UTC, Petronio Coelho
Details
build.log (build.log.xz,49.18 KB, application/x-xz)
2020-03-29 19:23 UTC, Petronio Coelho
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petronio Coelho 2020-03-29 02:39:27 UTC
When building dev-db/postgresql-12.2 with the llvm flag and you have a possible version mismatch between the slotted llvm and clang packages, the install phase may fail with the following:

error: can't create module summary index for buffer: Invalid summary version 8. Version should be in the range [1-7].
LLVM ERROR: ThinLink didn't create an index
make[2]: *** [Makefile:217: install-postgres-bitcode] Error 1

In my case I have both llvm:9 and llvm:10 installed, but only clang:10 . In the build log you can see that llvm:9 is selected with clang:10

checking for llvm-config... /usr/lib/llvm/9/bin/llvm-config
checking for clang... /usr/lib/llvm/10/bin/clang

Reproducible: Always
Comment 1 Petronio Coelho 2020-03-29 02:43:47 UTC
Created attachment 626624 [details]
build.log
Comment 2 Jonas Stein gentoo-dev 2020-03-29 13:37:06 UTC
Thank you for the report. We need to have all information at hand before ticket assignment. That is why I ask you to 
* attach the logs and 
* paste the emerge info 
as described on 
https://wiki.gentoo.org/wiki/Attach_the_logs_to_the_bug_ticket
Comment 3 Petronio Coelho 2020-03-29 19:23:32 UTC
Created attachment 627016 [details]
build.log

Portage 2.3.96 (python 3.7.7-final-0, default/linux/amd64/17.1/desktop/gnome/systemd, gcc-9.3.0, glibc-2.30-r6, 5.5.13-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.5.13-gentoo-x86_64-Intel-R-_Core-TM-_i7-7700HQ_CPU_@_2.80GHz-with-gentoo-2.7
KiB Mem:    32790600 total,  19059528 free
KiB Swap:   50331644 total,  50331644 free
Timestamp of repository gentoo: Sun, 29 Mar 2020 18:09:09 +0000
Head commit of repository gentoo: a1daaed370c3aa2965bd05e91b5f25a770ab829a

sh bash 5.0_p16
ld GNU ld (Gentoo 2.34 p1) 2.34.0
app-shells/bash:          5.0_p16::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.30.1::gentoo
dev-lang/python:          2.7.17-r1::gentoo, 3.6.10::gentoo, 3.7.7::gentoo, 3.8.2::gentoo
dev-util/cmake:           3.17.0::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.2::gentoo
sys-devel/binutils:       2.34::gentoo
sys-devel/gcc:            9.3.0::gentoo
sys-devel/gcc-config:     2.2.1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.5::gentoo (virtual/os-headers)
sys-libs/glibc:           2.30-r6::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo.git
    priority: -1000
    sync-git-verify-commit-signature: true

localrepo
    location: /usr/local/portage
    masters: gentoo

calculate
    location: /var/lib/layman/calculate
    masters: gentoo
    priority: 50

laurentb
    location: /var/lib/layman/laurentb
    masters: gentoo
    priority: 50

lto-overlay
    location: /var/lib/layman/lto-overlay
    masters: gentoo mv
    priority: 50

mv
    location: /var/lib/layman/mv
    masters: gentoo
    priority: 50

pentoo
    location: /var/lib/layman/pentoo
    masters: gentoo
    priority: 50

sakaki-tools
    location: /var/lib/layman/sakaki-tools
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -pipe -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=8 -fuse-linker-plugin -fno-common -fno-plt -mtls-dialect=gnu2 -falign-functions=32 -flimit-function-alignment -malign-data=cacheline"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /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 /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -pipe -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=8 -fuse-linker-plugin -fno-common -fno-plt -mtls-dialect=gnu2 -falign-functions=32 -flimit-function-alignment -malign-data=cacheline"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--jobs 9 --load-average 8"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN 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="-march=native -pipe -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=8 -fuse-linker-plugin -fno-common -fno-plt -mtls-dialect=gnu2 -falign-functions=32 -flimit-function-alignment -malign-data=cacheline"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg cgroup config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-elog strict strict-keepdir unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -pipe -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=8 -fuse-linker-plugin -fno-common -fno-plt -mtls-dialect=gnu2 -falign-functions=32 -flimit-function-alignment -malign-data=cacheline"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--sort-common -Wl,--hash-style=gnu -march=native -pipe -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=8 -fuse-linker-plugin -fno-common -fno-plt -mtls-dialect=gnu2 -falign-functions=32 -flimit-function-alignment -malign-data=cacheline"
LINGUAS="en"
MAKEOPTS="-j9 -l8"
PKGDIR="/usr/portage/packages"
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="/var/tmp"
USE="X a52 aac aacs acl acpi alsa amd64 amr aom apparmor audit bcrypt bdplus berkdb blake2 bluetooth bluray branding brotli btrfs bzip2 cairo caps cdda cdr chromecast cjk cli colord corefonts crypt cups curl custom-cflags custom-optimization dbus djvu dri dts dvb dvd dvdr dvi ed25519 emboss encode evo exif faad fdk ffmpeg filecaps firewalld flac fontconfig fontforge fortran fpx fuse gdbm gif gme gmp gnome gnome-keyring gnome-online-accounts gpm graphviz gsf gsm gstreamer gtk gtk3 hardened hdri heif iconv icu idn inotify introspection iproute2 iptc ipv6 jbig jpeg jpeg2k lcms ldap lensfun libaom libass libdrm libidn2 libnotify libsecret libtirpc libva live lm_sensors lto lz4 lzma lzo mad matroska mms mng modplug mp3 mp4 mpeg mtp multilib musepack nautilus ncurses networkmanager nftables nls nptl ogg openexr opengl openh264 openmp openssl opus pam pango pcre pdf pgo pie plymouth png policykit postscript ppds pulseaudio qt5 raw readline samba sctp sdl seccomp sha3 shout smp speex spell split-usr srt ssl ssp startup-notification svg systemd t1lib taglib tcpd theora threads tiff truetype udev udisks unicode unwind upnp upower usb v4l vaapi vorbis vpx wavpack wayland webp wmf wxwidgets x264 x265 xattr xcb xml xmp xpm xps xtpax xv xvid xz zeroconf zlib zsh-completion zstd zvbi" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" CURL_SSL="nss" 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" KERNEL="linux" L10N="en en-US" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="BPF WebAssembly" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python3_7" RUBY_TARGETS="ruby26" USERLAND="GNU" VIDEO_CARDS="intel i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

dev-db/postgresql-12.2::gentoo was built with the following:
USE="icu kerberos ldap llvm nls pam readline server ssl systemd threads uuid xml zlib -debug -doc -libressl -perl -python (-selinux) -static-libs -tcl" ABI_X86="(64)" PYTHON_SINGLE_TARGET="python3_7 -python3_6"
CFLAGS="-march=native -pipe -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=8 -fuse-linker-plugin -fno-common -fno-plt -mtls-dialect=gnu2 -falign-functions=32 -flimit-function-alignment -malign-data=cacheline -Wl,-O1 -Wl,--as-needed -Wl,--sort-common -Wl,--hash-style=gnu"
CXXFLAGS="-march=native -pipe -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=8 -fuse-linker-plugin -fno-common -fno-plt -mtls-dialect=gnu2 -falign-functions=32 -flimit-function-alignment -malign-data=cacheline -Wl,-O1 -Wl,--as-needed -Wl,--sort-common -Wl,--hash-style=gnu"
Comment 4 Karl-Johan Karlsson 2020-04-25 07:00:19 UTC
I'm hitting the same bug.

Even if Clang is upgraded to version 10, LLVM has to have slot 9 installed because of Mesa:

   # emerge -pv --depclean sys-devel/llvm:9

   Calculating dependencies... done!
     sys-devel/llvm-9.0.1 pulled in by:
       media-libs/mesa-20.0.5 requires sys-devel/llvm:9[abi_x86_32(-),abi_x86_64(-)], <sys-devel/llvm-10:9/9=[abi_x86_32(-),abi_x86_64(-)], <sys-devel/llvm-10:=[abi_x86_32(-),abi_x86_64(-)]

   >>> No packages selected for removal by depclean

But LLVM 9 comes before 10 in PATH:

   # echo $PATH
   /usr/lib/llvm/9/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/10/bin

This is because of how the files in /etc/env.d/ that set the path are named, with 9 coming before 10:

   # grep -R ^PATH.*llvm /etc/env.d/
   /etc/env.d/10llvm-9990:PATH="/usr/lib/llvm/9/bin"
   /etc/env.d/60llvm-9989:PATH="/usr/lib/llvm/10/bin"

The suffixes should make the file for LLVM 10 come first, if the prefixes had been the same. But why is llvm:9 at prefix 10 but llvm:10 at 60? Looking at the Git history leads to this commit:

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

which changed the prefix for all versions of LLVM from 10 to 60, but didn't bump the package revision. This means that if you already had llvm-9.0.1 installed on 2020-01-27 and later upgraded to llvm:10, you will always get llvm:9 binaries first in PATH.

Manually renaming the file in env.d puts LLVM 10 first in PATH:

   # mv /etc/env.d/10llvm-9990 /etc/env.d/60llvm-9990
   # env-update
   >>> Regenerating /etc/ld.so.cache...
   # logout
   $ su -
   Password: 
   # echo $PATH
   /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/10/bin:/usr/lib/llvm/9/bin

And allows dev-db/postgresql-12.2 to build:

   # grep "checking for.*/llvm/" /var/tmp/portage/dev-db/postgresql-12.2/temp/build.log
   checking for llvm-config... /usr/lib/llvm/10/bin/llvm-config
   checking for clang... /usr/lib/llvm/10/bin/clang

Presumably, moving an installed file like that will lead to a file collision on the next upgrade of llvm:9. Making Portage happy probably requires rebuilding llvm:9, which will take a couple of hours to test.

Rebuilding media-libs/mesa-20.0.5 after changing PATH still works and finds LLVM 9.0.1, because llvm.eclass takes care of setting LLVM 9 first in PATH when building:

   # grep 'declare -x PATH=' /var/tmp/portage/media-libs/mesa-20.0.5/temp/environment 
   declare -x PATH="/var/tmp/portage/media-libs/mesa-20.0.5/temp/python3.6/bin:/usr/lib/llvm/9/bin:/usr/lib/portage/python3.7/ebuild-helpers/xattr:/usr/lib/portage/python3.7/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/10/bin:/usr/lib/llvm/9/bin
   # grep 'Run-time dependency LLVM' /var/tmp/portage/media-libs/mesa-20.0.5/temp/build.log
   Run-time dependency LLVM (modules: all-targets, amdgpu, bitreader, bitwriter, core, coverage, engine, executionengine, instcombine, instrumentation, ipo, irreader, linker, lto, mcdisassembler, mcjit, native, objcarcopts, option, profiledata, scalaropts, transformutils, coroutines) found: YES 9.0.1
   Run-time dependency LLVM (modules: all-targets, amdgpu, bitreader, bitwriter, core, coverage, engine, executionengine, instcombine, instrumentation, ipo, irreader, linker, lto, mcdisassembler, mcjit, native, objcarcopts, option, profiledata, scalaropts, transformutils, coroutines) found: YES 9.0.1
Comment 5 Karl-Johan Karlsson 2020-04-25 08:37:13 UTC
That worked. After rebuilding sys-devel/llvm-9.0.1, /etc/env.d/60llvm-9990 gets the correct name, which puts /usr/lib/llvm/9/bin at the end of PATH, which makes dev-db/postgresql-12.2 pick up LLVM 10 instead, which makes the PostgreSQL build succeed.
Comment 6 Maxim P. Dementiev 2020-11-21 18:23:15 UTC
I've got "llvm-c/OrcBindings.h: No such file or directory" too with dev-db/postgresql-12.5.

And config of postgresql ebuild finds this:

checking for llvm-config... /usr/lib/llvm/12/bin/llvm-config
checking for clang... /usr/lib/llvm/11/bin/clang

Because I've got:

$ for i in /etc/env.d/*llvm* ; do echo $i ; echo ================== ; cat $i ; echo ================== ; echo ; done 
/etc/env.d/60llvm-9987
==================
PATH="/usr/lib/llvm/12/bin"
# we need to duplicate it in ROOTPATH for Portage to respect...
ROOTPATH="/usr/lib/llvm/12/bin"
MANPATH="/usr/lib/llvm/12/share/man"
LDPATH="/usr/lib/llvm/12/lib64"
==================

/etc/env.d/60llvm-9988
==================
PATH="/usr/lib/llvm/11/bin"
# we need to duplicate it in ROOTPATH for Portage to respect...
ROOTPATH="/usr/lib/llvm/11/bin"
MANPATH="/usr/lib/llvm/11/share/man"
LDPATH="/usr/lib/llvm/11/lib64"
==================

/etc/env.d/60llvm-9989
==================
PATH="/usr/lib/llvm/10/bin"
# we need to duplicate it in ROOTPATH for Portage to respect...
ROOTPATH="/usr/lib/llvm/10/bin"
MANPATH="/usr/lib/llvm/10/share/man"
LDPATH="/usr/lib/llvm/10/lib64"
==================

/etc/env.d/60llvm-9990
==================
PATH="/usr/lib/llvm/9/bin"
# we need to duplicate it in ROOTPATH for Portage to respect...
ROOTPATH="/usr/lib/llvm/9/bin"
MANPATH="/usr/lib/llvm/9/share/man"
LDPATH="/usr/lib/llvm/9/lib64"
==================

$ set | grep PATH 
INFOPATH=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.3.0/info:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.34/info:/usr/share/info
MANPATH=/etc/java-config-2/current-system-vm/man:/usr/share/gcc-data/x86_64-pc-linux-gnu/9.3.0/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.34/man:/etc/java-config-2/current-system-vm/man/:/usr/local/share/man:/usr/share/man:/usr/lib/rust/man:/usr/lib/llvm/12/share/man:/usr/lib/llvm/11/share/man:/usr/lib/llvm/10/share/man:/usr/lib/llvm/9/share/man
MOZ_GMP_PATH=/usr/lib64/nsbrowser/plugins/gmp-gmpopenh264/system-installed
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/12/bin:/usr/lib/llvm/11/bin:/usr/lib/llvm/10/bin:/usr/lib/llvm/9/bin:/usr/lib64/subversion/bin:/opt/cuda/bin
WINDOWPATH=2
Comment 7 Aaron W. Swenson gentoo-dev 2020-11-22 20:10:42 UTC
(In reply to Maxim P. Dementiev from comment #6)
> I've got "llvm-c/OrcBindings.h: No such file or directory" too with
> dev-db/postgresql-12.5.
> 
> And config of postgresql ebuild finds this:
> 
> checking for llvm-config... /usr/lib/llvm/12/bin/llvm-config
> checking for clang... /usr/lib/llvm/11/bin/clang

Do you have sys-devel/clang:12 installed?
Comment 8 Maxim P. Dementiev 2020-11-23 11:31:50 UTC
> Do you have sys-devel/clang:12 installed?

Right you are, sir.