Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 713530 - sys-devel/llvm-10.0.0_rc4 does not build with clang-10.0.0_rc4 when CUDA dev-util/nvidia-cuda-toolkit-10.2 is installed
Summary: sys-devel/llvm-10.0.0_rc4 does not build with clang-10.0.0_rc4 when CUDA dev-...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: LLVM support project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: llvm-10
  Show dependency tree
 
Reported: 2020-03-19 20:13 UTC by Christian Stoitner
Modified: 2020-12-10 08:54 UTC (History)
3 users (show)

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


Attachments
build log (llvm_build.log.xz,94.26 KB, application/x-xz)
2020-03-19 20:13 UTC, Christian Stoitner
Details
0001-CUDA-Warn-about-unsupported-CUDA-SDK-version-only-if.patch (0001-CUDA-Warn-about-unsupported-CUDA-SDK-version-only-if.patch,5.19 KB, patch)
2020-03-21 16:35 UTC, Michał Górny
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Stoitner 2020-03-19 20:13:29 UTC
Created attachment 622854 [details]
build log

When trying to emerge llvm-10.0.0_rc4 with CC="clang" and CXX="clang++" set, linking fails with this error:

/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld.gold: error: lib64/libLLVMDebugInfoCodeView.a(DebugSymbolRVASubsection.cpp.o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC

The "-fPIC" flag indeed seems to be missing in all non compiler calls in the log. As far as I can tell this happens because the cmake configuration checks for supported flags by the compiler. In the configure phase it outputs this:

CMake Warning at cmake/modules/HandleLLVMOptions.cmake:230 (message):
  -fPIC is not supported.

I think this happens because clang-10.0.0_rc4 always outputs a warning on my machine, even when just executing "clang --version":

clang-10: warning: Unknown CUDA version 10.2. Assuming the latest supported version 10.1 [-Wunknown-cuda-version]

And so the cmake configuration thinks every single tested flag does not work, including -fPIC. I currently have dev-util/nvidia-cuda-toolkit-10.2.89-r1 installed.

This seems to be a similar issue to https://bugs.gentoo.org/712488.
Comment 1 Jonas Stein gentoo-dev 2020-03-19 21:27:33 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
Please reopen this ticket (Status:UNCONFIRMED) afterwards.
Comment 2 Christian Stoitner 2020-03-20 17:06:53 UTC
emerge --info '=sys-devel/llvm-10.0.0_rc4::gentoo':

Portage 2.3.89 (python 3.6.10-final-0, default/linux/amd64/17.1/desktop/plasma/systemd, gcc-9.3.0, glibc-2.29-r7, 5.5.9-gentoo.build0 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.5.9-gentoo.build0-x86_64-AMD_Ryzen_9_3950X_16-Core_Processor-with-gentoo-2.6
KiB Mem:    32901792 total,  31148568 free
KiB Swap:   16777212 total,  16777212 free
Timestamp of repository gentoo: Tue, 17 Mar 2020 21:15:01 +0000
Head commit of repository gentoo: 24dc9ea5e7fda8ac045b3ded1e47e7841d68a2b5
Timestamp of repository kde: Tue, 17 Mar 2020 18:43:39 +0000
Head commit of repository kde: 6af5de7804d29272ce12a853c99238364f9315c1

sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.33.1 p2) 2.33.1
app-shells/bash:          4.4_p23-r1::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.6::gentoo
dev-util/cmake:           3.14.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.33.1-r1::gentoo
sys-devel/gcc:            8.4.0::gentoo, 9.3.0::gentoo
sys-devel/gcc-config:     2.2.1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.20::gentoo (virtual/os-headers)
sys-libs/glibc:           2.29-r7::gentoo
Repositories:

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

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

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

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -pipe -O3 -fstack-protector --param=ssp-buffer-size=32 -fno-semantic-interposition -fipa-pta -fdevirtualize-at-ltrans"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0"
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="-march=native -pipe -O3 -fstack-protector --param=ssp-buffer-size=32"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y --jobs=16 --load-average=31"
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 -fstack-protector --param=ssp-buffer-size=32"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs cgroup config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -pipe -O3 -fstack-protector --param=ssp-buffer-size=32"
GENTOO_MIRRORS="https://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/ http://ftp.halifax.rwth-aachen.de/gentoo/ https://mirror.eu.oneandone.net/linux/distributions/gentoo/gentoo/ https://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/"
LANG="de_DE.UTF-8"
LDFLAGS="-Wl,--as-needed -fuse-ld=gold"
MAKEOPTS="--jobs=32 --load-average=34"
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="/var/tmp"
USE="X a52 aac acl acpi activities alsa amd64 berkdb bluetooth branding bzip2 c++0x c++11 c++14 c++1y cairo canberra cdda cdr cli crypt cups cxx dbus declarative dri dts dvd dvdr emboss encode exif flac gdbm gif gpm gtk iconv icu ipv6 jpeg kde kipi kwallet lcms ldap libnotify libtirpc linguas_en linguas_en_GB mad matroska mercurial mng mp3 mp4 mpeg multilib ncurses networkmanager nls nptl ogg opengl openmp opus pam pango pcre pdf phonon plasma png policykit ppds pulseaudio python qml qt5 rar readline rtsp sdl seccomp semantic-desktop spell split-usr ssl startup-notification svg swscale systemd taglib tcpd theora threads tiff truetype udev udisks unicode upower usb visibility vorbis widgets wifi wxwidgets x264 xattr xcb xcomposite xml xv xvid zlib" 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="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="evdev keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="nvidia" 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, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

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

sys-devel/llvm-10.0.0_rc4::gentoo was built with the following:
USE="gold libedit libffi ncurses xml -debug -doc -exegesis -test -xar -z3" ABI_X86="(64) -32 (-x32)" LLVM_TARGETS="AMDGPU BPF NVPTX (X86) -AArch64 -ARC -ARM -AVR -Hexagon -Lanai -MSP430 -Mips -PowerPC -RISCV -Sparc -SystemZ -WebAssembly -XCore"
FEATURES="preserve-libs news pid-sandbox sandbox userpriv usersync parallel-install cgroup userfetch binpkg-docompress binpkg-dostrip sfperms qa-unresolved-soname-deps strict usersandbox config-protect-if-modified fixlafiles assume-digests merge-sync xattr unmerge-logs binpkg-logs multilib-strict ebuild-locks ipc-sandbox unknown-features-warn protect-owned distlocks parallel-fetch network-sandbox unmerge-orphans"
Comment 3 Christian Stoitner 2020-03-20 17:20:53 UTC
The flags in emerge --info didn't pick up my settings in /etc/portage/env.

To reproduce this problem:
- emerge ~sys-devel/clang-10.0.0
- emerge =dev-util/nvidia-cuda-toolkit-10.2.89-r1
- configure build env for llvm as follows:
    CFLAGS="-march=native -pipe -O3" # probably not important
    LDFLAGS="-Wl,--as-needed -fuse-ld=gold" # probably not important
    CC="clang-10"
    CXX="clang++-10"
- try to remerge any llvm based package, like llvm-10.0.0_rc4, clang-10.0.0_rc4 or lld-10.0.0_rc4

This should lead to the linker errors in my build.log.


Downgrading dev-util/nvidia-cuda-toolkit to 10.1.243-r2 fixed the problem for me.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-03-21 16:35:46 UTC
Created attachment 623928 [details, diff]
0001-CUDA-Warn-about-unsupported-CUDA-SDK-version-only-if.patch

Could you test this patch, and if possible test it really fast?  I have my doubts whether upstream's going to accept one more backport at this point but there's a chance if I submit it soonish.
Comment 5 Christian Stoitner 2020-03-21 19:48:37 UTC
I had to remove the "/clang" path prefixes in the patch to make it work with the ebuild. Apart from that it works. The warning is gone for normal compiles, and is displayed again when compiling in CUDA mode.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-03-23 20:50:24 UTC
If you wish to make extra sure this has been fixed, I've added _rc6 without keywords (the final release is expected tomorrow, so there's no reason to make people rebuild it today).
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-12-10 08:54:29 UTC
Fixed in 10.0.0 final.