Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 621220 - sys-devel/llvm:4: Slot installation prevents finding of OpenCL headers
Summary: sys-devel/llvm:4: Slot installation prevents finding of OpenCL headers
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: LLVM support project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-08 15:59 UTC by Jan Kundrát (RETIRED)
Modified: 2017-09-03 07:57 UTC (History)
2 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 Jan Kundrát (RETIRED) gentoo-dev 2017-06-08 15:59:58 UTC
I believe that our current config with a slotted prefix prevents clang/LLVM from finding its own libraries. This is what I get when I play around with Darktable's .cl files:

/usr/lib/llvm/4/bin/clang-4.0 -cc1 -cl-std=CL1.1 -finclude-default-header -I/home/jkt/work/prog/darktable/data/kernels /home/jkt/work/prog/darktable/data/kernels/blendop.cl
<built-in>:1:10: fatal error: 'opencl-c.h' file not found
#include "opencl-c.h"
         ^~~~~~~~~~~~
1 error generated.

That header is available at /usr/lib64/clang/4.0.0/include/opencl-c.h. Adding a `-isystem /usr/lib64/clang/4.0.0/include` to the compiler's invocation helps. However, I don't understand why should I have to pass this along explicitly. (Even though DT tries to do that and fails to find that header from its cmake bowels with the slotted 4.0.)

# emerge --info sys-devel/{clang,llvm}
Portage 2.3.5 (python 2.7.12-final-0, hardened/linux/amd64, gcc-4.9.3, glibc-2.23-r3, 4.9.18 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.9.18-x86_64-Intel-R-_Core-TM-_i5-6300U_CPU_@_2.40GHz-with-gentoo-2.3
KiB Mem:    24508972 total,  15494072 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Tue, 06 Jun 2017 00:45:01 +0000
sh bash 4.3_p48
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p48::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.22.3_rc4::gentoo
dev-lang/python:          2.7.12::gentoo, 3.4.5::gentoo
dev-util/cmake:           3.8.0::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/sandbox:         2.10-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.12.6::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo, 2.26.1::gentoo
sys-devel/gcc:            4.9.3::gentoo, 6.2.0-r1::gentoo, 6.3.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r3::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: webrsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

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

kde
    location: /var/lib/layman/kde
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/kde.git
    masters: gentoo
    priority: 50

qt
    location: /var/lib/layman/qt
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/qt.git
    masters: gentoo
    priority: 50

x11
    location: /var/lib/layman/x11
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/x11
    masters: gentoo
    priority: 50

Installed sets: @kde-plasma-live, @qt5-addons, @qt5-essentials, @qt5-tools
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA googleearth"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native -ggdb"
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 /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=native -ggdb"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://ftp.fi.muni.cz/pub/linux/gentoo/ http://gentoo.mirror.dkm.cz/pub/gentoo/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
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 aac aacplus acl alsa amd64 appstream berkdb bluetooth bzip2 clang cli colord cracklib crypt cryptsetup cups cxx dbus dia dri dvd editorconfig egl exif flac fontconfig gdbm gif glamor gnuefi gold gpg graphics hardened iconv icu ipv6 jit jpeg justify latex lcms libkms lzma modules mp3 multilib ncurses networkmanager nls nptl ocl-icd ocl20 ogg opencl opengl openmax openmp opus pam pax_kernel pcre pcre16 pdf pie plasma plotutils plymouth png pulseaudio qml qt5 readline seccomp session smp smpeg spell spice sppex ssl ssp svc svg sync-plugin-portage systemd tcpd theora tiff tracepath truetype udev unicode urandom usb v4l vaapi video vim-syntax vorbis vpx wayland webm webp widgets x264 x265 xattr xcb xetex xkb xmp xtpax zlib" ABI_X86="64" ALSA_CARDS="hda-intel" 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="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="canon" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput synaptics" KERNEL="linux" L10N="en cs" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en cs" LLVM_TARGETS="BPF ARM" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64 arm" RUBY_TARGETS="ruby21 ruby22" USERLAND="GNU" VIDEO_CARDS="i965 intel" 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, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

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

sys-devel/clang-4.0.0-r2::gentoo was built with the following:
USE="doc static-analyzer -debug -default-compiler-rt -default-libcxx -multitarget -test -xml" ABI_X86="64 -32 -x32" LLVM_TARGETS="ARM BPF X86 -AArch64 -AMDGPU -Hexagon -Lanai -MSP430 -Mips -NVPTX -PowerPC -RISCV -Sparc -SystemZ -XCore" PYTHON_TARGETS="python2_7"
CFLAGS="-O2 -pipe -march=native"
CXXFLAGS="-O2 -pipe -march=native"


sys-devel/llvm-4.0.0-r2::gentoo was built with the following:
USE="doc gold libffi ncurses -debug -libedit -test" ABI_X86="64 -32 -x32" LLVM_TARGETS="ARM BPF X86 -AArch64 -AMDGPU -Hexagon -Lanai -MSP430 -Mips -NVPTX -PowerPC -RISCV -Sparc -SystemZ -XCore"
CFLAGS="-O2 -pipe -march=native"
CXXFLAGS="-O2 -pipe -march=native"
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-06-08 18:04:13 UTC
Could you throw a simple test case at me? I.e. something I could try to compile to reproduce without installing extra stuff?
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-09-03 07:57:37 UTC
To be honest, I'm not sure if there is anything we can do here. If upstream is calling 'clang -cc1' directly, they're skipping the driver that is responsible for setting include paths up. Once they decide to do that, it's their responsibility to put the correct paths in place.

clang provides a -print-resource-dir option that gives you the correct prefix:

$ clang -print-resource-dir
/usr/lib/llvm/6/bin/../../../../lib/clang/6.0.0

i.e. adding "-I$(clang -print-resource-dir)/include" should fix the problem.