Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 459306 - media-libs/mesa-9.0.3[r600-llvm-compiler] build failure against sys-devel/llvm[-debug] - undefined reference to `llvm::isCurrentDebugType(char const*)'
Summary: media-libs/mesa-9.0.3[r600-llvm-compiler] build failure against sys-devel/llv...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo X packagers
Depends on:
Blocks: 500368
  Show dependency tree
Reported: 2013-02-26 13:53 UTC by Paolo Pedroni
Modified: 2014-04-29 02:17 UTC (History)
3 users (show)

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

Build log for media-libs/mesa-9.0.3 (mesa-9.0.3:20130226-133732.log.gz,39.86 KB, application/x-gzip)
2013-02-26 13:55 UTC, Paolo Pedroni
Ebuild environment file (environment,126.91 KB, text/plain)
2013-02-26 13:56 UTC, Paolo Pedroni
mesa-9.0.3.ebuild.patch (mesa-9.0.3.ebuild.patch,492 bytes, patch)
2013-04-04 18:51 UTC, Alexander Tsoy
Details | Diff
mesa-9.0.3.ebuild.patch (mesa-9.0.3.ebuild.patch,544 bytes, patch)
2013-04-06 09:39 UTC, Alexander Tsoy
Details | Diff
mesa-9.0.3.ebuild.patch (mesa-9.0.3.ebuild.patch,509 bytes, patch)
2013-04-20 10:28 UTC, Alexander Tsoy
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paolo Pedroni 2013-02-26 13:53:54 UTC
After unsuccessfully trying to upgrade to mesa-9.1 I decided to settle down for mesa-9.0.3, but compilation yields the following error: undefined reference to `llvm::isCurrentDebugType(char const*)' undefined reference to `llvm::DebugFlag'
collect2: error: ld returned 1 exit status

media-libs/mesa-9.0.1 compiles, installs and works fine.

I will attach the full build log and the environment ASAP.

Reproducible: Always

Steps to Reproduce:
1. emerge -1v =media-libs/mesa-9.0.3
Actual Results:  
The error above.

Expected Results:  
Compilation and installation of the package

# emerge --info '=media-libs/mesa-9.0.3'
Portage (default/linux/amd64/13.0/desktop/kde, gcc-4.7.2, glibc-2.15-r3, 3.7.9-gentoo x86_64)
                         System Settings
System uname: Linux-3.7.9-gentoo-x86_64-Intel-R-_Core-TM-_i7-2600_CPU_@_3.40GHz-with-gentoo-2.2
KiB Mem:    16397644 total,   2359024 free
KiB Swap:    8173564 total,   8173564 free
Timestamp of tree: Tue, 26 Feb 2013 07:45:01 +0000
ld GNU ld (GNU Binutils) 2.22
distcc 3.1 x86_64-pc-linux-gnu [enabled]
ccache version 3.1.9 [enabled]
app-shells/bash:          4.2_p37
dev-java/java-config:     2.1.12-r1
dev-lang/python:          2.7.3-r2, 3.2.3
dev-util/ccache:          3.1.9
dev-util/cmake:           2.8.9
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.11.6
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.7.2-r1
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.6 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo x11 x-portage
CFLAGS="-march=corei7-avx -O2 -pipe -fomit-frame-pointer -flto"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=corei7-avx -O2 -pipe -fomit-frame-pointer -flto"
EMERGE_DEFAULT_OPTS="--keep-going y --with-bdeps y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs ccache compress-build-logs config-protect-if-modified distcc distlocks ebuild-locks merge-sync news parallel-fetch protect-owned sandbox sfperms split-elog split-log strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -flto"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTDIR_OVERLAY="/var/lib/layman/x11 /usr/local/portage"
USE="X a52 aac aalib acl acpi adns alsa amd64 ao audiofile bash-completion bluetooth branding bzip2 cairo caps cdda cddb cdparanoia cdr cli consolekit cracklib crypt css cups curl cxx dbus declarative dga djvu dri dts dvd dvdr emboss encode exif expat fam fbcon ffmpeg fftw firefox flac fontconfig foomaticdb fortran ftp gd gdbm geoip ggi gif gimp gmp gnutls gphoto2 gpm graphviz gstreamer gtk handbook iconv icu idn ieee1394 imagemagick imlib ipv6 java jbig jpeg jpeg2k kde kipi lame lcms libcaca libnotify libsamplerate lm_sensors lua lzma lzo mad mmap mmx mng modules mp3 mp4 mpeg mplayer mudflap multilib musicbrainz ncurses nls nptl nsplugin offensive ogg openal openexr opengl openmp pam pango pcre pdf phonon plasma png policykit postscript ppds qt3support qt4 rdesktop readline recode sdl semantic-desktop session smartcard sndfile sockets speex spell sqlite sqlite3 sse sse2 ssl startup-notification subversion svg symlink syslog sysvipc taglib tcpd theora threads tidy tiff truetype udev udisks unicode upower usb vcd vim-syntax vnc vorbis wmf wxwidgets x264 xattr xcb xcomposite xinerama xml xpm xscreensaver xv xvid yahoo zlib" ABI_X86="64" ALSA_CARDS="hda-intel virmidi" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" 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" CAMERAS="kodak ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-minimizer nlpsolver" LINGUAS="it" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="radeon r600" 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"

# emerge -pqv '=media-libs/mesa-9.0.3'
[ebuild     U ] media-libs/mesa-9.0.3 [9.0.1] USE="egl g3dvl gallium gbm gles1 gles2 llvm nptl openvg r600-llvm-compiler shared-glapi vdpau xa xorg xvmc -bindist -classic -debug -osmesa -pax_kernel -pic (-selinux) -wayland" VIDEO_CARDS="r600 -i915 -i965 -intel -nouveau -r100 -r200 -r300 -radeon -radeonsi -vmware"
Comment 1 Paolo Pedroni 2013-02-26 13:55:00 UTC
Created attachment 340168 [details]
Build log for media-libs/mesa-9.0.3
Comment 2 Paolo Pedroni 2013-02-26 13:56:00 UTC
Created attachment 340170 [details]
Ebuild environment file
Comment 3 Paolo Pedroni 2013-02-26 14:07:20 UTC
I forgot to say that the same error happens with media-libs/mesa-9.0.2 as well.
Comment 4 Bruce Guenter 2013-03-02 03:03:22 UTC
I just hit this problem as well. It works if you compile llvm with the debug use flag.
Comment 5 Francisco Blas Izquierdo Riera gentoo-dev 2013-03-10 21:57:59 UTC
I can confirm this issue too, it is caused by the r600-llvm-compiler USE if I'm not mistaken.

Can't we just make mesa with said use flag depend on llvm with the debug use enabled? My memory may be failing but this should be doable since, at least, EAPI 4
Comment 6 Alexander Tsoy 2013-04-04 09:59:59 UTC
(In reply to comment #5)
> I can confirm this issue too, it is caused by the r600-llvm-compiler USE if
> I'm not mistaken.

This also happen with video_cards_radeonsi USE flag enabled: undefined reference to `llvm::isCurrentDebugType(char const*)' undefined reference to `llvm::DebugFlag'
Comment 7 Alexander Tsoy 2013-04-04 10:03:32 UTC
$ emerge -pqv mesa
[ebuild     U ] media-libs/mesa-9.0.3 [9.0.1] USE="classic egl g3dvl gallium gbm gles1 gles2 llvm nptl openvg pax_kernel shared-glapi vdpau -bindist -debug -osmesa -pic -r600-llvm-compiler (-selinux) -wayland -xa -xorg -xvmc" VIDEO_CARDS="intel radeon radeonsi -i915 -i965 -nouveau -r100 -r200 -r300 -r600 -vmware"
Comment 8 Alexander Tsoy 2013-04-04 18:50:17 UTC

"the isCurrentDebugType and DebugFlag errors are cause by -DNDEBUG.  The problem with -DNDEBUG is that LLVM defines DNDEBUG in public headers, so if you compiled LLVM with it, you have have to compile Mesa with it as well."

Mesa's build system doesn't preserve -DNDEBUG flag from llvm-config:

# pwd
# grep 'LLVM_C.*FLAGS=' ./configure
        LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed -e 's/-DNDEBUG\>//g' -e 's/-pedantic//g' -e 's/-Wcovered-switch-default//g'`
        LLVM_CXXFLAGS=`$LLVM_CONFIG --cxxflags|sed -e 's/-DNDEBUG\>//g' -e 's/-pedantic//g' -e 's/-Wcovered-switch-default//g'`
        LLVM_CPPFLAGS=`$LLVM_CONFIG --cppflags|sed -e 's/-DNDEBUG\>//g' -e 's/-pedantic//g' -e 's/-Wcovered-switch-default//g'`

So -DNDEBUG flag should be explicitly appended by a mesa ebuild if USE="-debug". And debug USE flag should match between mesa and llvm.
Comment 9 Alexander Tsoy 2013-04-04 18:51:19 UTC
Created attachment 344440 [details, diff]

This patch works for me.
Comment 10 Alexander Tsoy 2013-04-05 04:38:58 UTC
I didn't check, but if mesa with -DNDEBUG compiles fine against llvm[debug], then append-flags could be called unconditionaly and no need to change dependency llvm -> llvm[debug?].
Comment 11 Alexander Tsoy 2013-04-06 09:39:27 UTC
Created attachment 344614 [details, diff]

Updated patch with fixed deps. Please, ignore my comment 10.
Comment 12 Chí-Thanh Christopher Nguyễn gentoo-dev 2013-04-06 12:31:49 UTC
Problems may arise when mesa is built against non-debug llvm, then that llvm is rebuilt with debug enabled (or vice versa).

Possibly a dependeny on llvm[debug=] is needed.
Comment 13 Alexander Tsoy 2013-04-08 12:24:32 UTC
(In reply to comment #12)
> Possibly a dependeny on llvm[debug=] is needed.

This is what I wanted in the first patch, but I've mistakenly used llvm[debug?] for this. As a result both of my patches does exactly the same thing. %)
Comment 14 Alexander Tsoy 2013-04-20 10:28:25 UTC
Created attachment 346078 [details, diff]
Comment 15 Chí-Thanh Christopher Nguyễn gentoo-dev 2013-05-02 13:38:06 UTC
So did you verify whether it is actually needed or not? If not then there is no reason to make the dependencies so strict.
Comment 16 Alexander Tsoy 2013-05-14 18:05:52 UTC
(In reply to comment #15)
> So did you verify whether it is actually needed or not? If not then there is
> no reason to make the dependencies so strict.

I only tested compilation, and in this regard dependency on llvm[debug?] is enough.

I can't test mesa with VIDEO_CARDS="radeonsi", because the only version that works with my HD 7750 is mesa-9.2*. Earlier versions cause Xorg to segfault at startup.

I can try to test mesa with USE="r600-llvm-compiler" on a HD 6450 card, but how? Is succesfuly running gnome-shell after recompilation of llvm with switched debug use flag is enough?
Comment 17 Alexander Tsoy 2013-08-12 14:33:24 UTC
I explained one reason to have dependency on llvm[debug=] in bug 480732.
Comment 18 Chí-Thanh Christopher Nguyễn gentoo-dev 2014-02-24 19:43:03 UTC
A warning message was added to the ebuild if a mismatch between mesa and llvm debug flags is detected.
Comment 19 Luke-Jr 2014-04-29 02:17:01 UTC
FWIW, this no longer seems to be an issue with Mesa 10