Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 711780 - x11-base/xorg-server-1.20.7[libglvnd]: error: ld:[...]../lib64/ undefined reference to `_glapi_tls_Current'
Summary: x11-base/xorg-server-1.20.7[libglvnd]: error: ld:[...]../lib64/ unde...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 2 votes (vote)
Assignee: Gentoo X packagers
Depends on:
Reported: 2020-03-07 10:58 UTC by Christopher Frömmel
Modified: 2020-06-18 06:48 UTC (History)
9 users (show)

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

build log (tar gz) (build.log.tar.gz,43.70 KB, application/gzip)
2020-03-07 11:04 UTC, Christopher Frömmel

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Frömmel 2020-03-07 10:58:28 UTC
libglvnd use flag has been enabled per default. This causes rebuilding of mesa, nvidia-drivers and the xorg-server which fails at make[3]: *** [Makefile:696: Xvfb] Error 1

Reproducible: Always

Steps to Reproduce:
1. emerge --sync && emerge -NuDva --with-bdeps=y --keep-going @world
Actual Results:  
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib64/ undefined reference to `_glapi_tls_Current'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:696: Xvfb] Error 1
make[3]: Leaving directory '/var/tmp/portage/x11-base/xorg-server-1.20.7/work/xorg-server-1.20.7/hw/vfb'
make[2]: *** [Makefile:762: all-recursive] Error 1
make[2]: Leaving directory '/var/tmp/portage/x11-base/xorg-server-1.20.7/work/xorg-server-1.20.7/hw/vfb'
make[1]: *** [Makefile:615: all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/x11-base/xorg-server-1.20.7/work/xorg-server-1.20.7/hw'
make: *** [Makefile:816: all-recursive] Error 1
 * ERROR: x11-base/xorg-server-1.20.7::gentoo failed (compile phase):
 *   emake failed

Expected Results:  

emerge --info
Portage 2.3.92 (python 3.6.10-final-0, default/linux/amd64/17.1/desktop, gcc-9.2.0, glibc-2.30-r4, 5.5.8-gentoo+ x86_64)
System uname: Linux-5.5.8-gentoo+-x86_64-Intel-R-_Core-TM-_i7-4790K_CPU_@_4.00GHz-with-gentoo-2.7
KiB Mem:    32848896 total,  24229048 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Sat, 07 Mar 2020 10:00:01 +0000
Head commit of repository gentoo: b759b2f51c33735cbbe9c6371f70d42171ea37d1
Head commit of repository steam-overlay: 55f315c7e9aafb1975d0ff519fab96b39342c76c

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.6::gentoo, 3.8.2::gentoo
dev-util/cmake:           3.16.5::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.1-r2::gentoo
sys-devel/binutils:       2.34::gentoo
sys-devel/gcc:            9.2.0-r4::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-r4::gentoo

    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-jobs: 1

    location: /usr/local/portage/steam-overlay
    sync-type: git
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /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="-march=native -O2 -pipe -fomit-frame-pointer"
FCFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
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"
USE="X a52 aac aacs acpi addc airplay alsa amd64 appindicator archive asm ayatana bash-completion bcache bdplus berkdb bittorrent bluetooth bluray branding bzip2 cairo calf cdda cdio cdr cgroups chromium clamav clamdtop clang cli client creds cron crypt cryptsetup cups curl custom-cflags custom-optimization cxx dav1d dbus device-mapper dga dhcp dhcpcd dos dri dri3 dts dvb dvd dvdr editor efi egl elogind emboss encode evdev exif f2fs faad fasttrack fat fdk ffmpeg fftw flac flambda fluidsynth fontconfig fortran fribidi fullscreen fuse gcrypt gdbm geoclue geolocation gif gles gles2 glib glut gme gnome-keyring gnutella gnutls gold googledrive gpg gpgme gpm graph graphite gssapi gstreamer gtk gtk3 haptic hddtemp highlight hostonly hpn http http2 hunspell iconv icq icu id3tag idn imagemagick imap inotify inspector ios ipp_autosetup ipv6 java jit joystick jpeg json jumbo-build kbd kerberos kms lcms libcanberra libdrm libevent libinput libnotify libreoffice libtirpc libuvc libv4l lightdm live lm-sensors lm_sensors logrotate lto lv2 lvm lz4 lzma lzo mad magic man matroska media memcached messages metalink midi mikmod minizip mjpeg mmap mms mng mod modern-top mp3 mp4 mpeg mpeg2 mtp multilib multimedia native-headset ncurses netapi network networkmanager nls nntp nptl nss ntfs ntfsdecrypt ntlm ntp nvenc nvidia oauth ocamlopt odf offensive office ogg openal opencl openconnect opengl openh264 openmp openssl openvpn opus pam pango pci pclm pcre pdf pdfimport pgo pidgin plugin-sysinfo png policykit portaudio postproc postscript ppds pptp pulseaudio qml qt5 qtaudio rar rdp readline samba sasl scanner script sdl seccomp secure-delete sensors sftp shout silc sip sipe skins smpeg snappy sound speex spell split-usr sqlite srt ssh ssl startup-notification steam steamfonts svg sync-plugin-portage syslog systray taglib tcpd tdb theora threads thunar tiff tpm tray trayicon truetype udev udf udisks unicode update_drivedb upnp upnp-av upower usb uvm v4l v4lutils vaapi vcd vdo vdpau video videoeffects vlc vnc voice vorbis vpnc vpx vte vulkan wayland wayland-compositor webcam webdav webp webserver widevine widgets winbind wxwidgets x264 x265 xa xcb xcomposite xfce xinerama xml xps xrandr xv xvfb xvid xvmc xwayland zlib zstd zvbi" ABI_X86="64" ADA_TARGET="gnat_2019" ALSA_CARDS="hda-intel usb-audio" 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" INPUT_DEVICES="libinput joystick" KERNEL="linux" L10N="de" LCD_DEVICES="ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="BPF x86 NVPTX" 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" SANE_BACKENDS="net" USERLAND="GNU" VIDEO_CARDS="nvidia"
Comment 1 Christopher Frömmel 2020-03-07 11:04:42 UTC
Created attachment 617396 [details]
build log (tar gz)
Comment 2 Ionen Wolkens 2020-03-07 17:33:18 UTC
That was before it became default, but I ran into the same error when I flipped libglvnd all at once (with nvidia-drivers included). I also use [xvfb]

I don't remember the specifics but I thought it may be an order issue, so I rebuilt one by one using --nodeps to force it, and finally xorg-server _last_, which built with no errors.

I wasn't sure if it was just me doing weird things at the time so I opted not to fill a bug without further testing.
Comment 3 Arfrever Frehtes Taifersar Arahesis 2020-03-07 19:41:39 UTC
_glapi_tls_Current symbol is supposed to be defined in, and should be linked against

# (cd /var/tmp/portage/media-libs/libglvnd-1.3.1/image; scanelf -qyRF "%F: %s" -s "+_glapi_tls_Current" *)
usr/lib64/ _glapi_tls_Current
# (cd /var/tmp/portage/media-libs/libglvnd-1.3.1/image; scanelf -qyRF "%F: %s" -s "-_glapi_tls_Current" *)
usr/lib64/ _glapi_tls_Current
usr/lib64/ _glapi_tls_Current
usr/lib64/ _glapi_tls_Current
usr/lib64/ _glapi_tls_Current
# (cd /var/tmp/portage/media-libs/libglvnd-1.3.1/image; scanelf -qyRF "%F: %n" *)

Can you check linking and symbols in your libraries?
Comment 4 Ionen Wolkens 2020-03-07 19:57:58 UTC
In my case, mid-way into the transition, I think it may have tried to use /usr/lib/opengl/nvidia/lib/libGL* libraries

I vaguely recall my emerge -uUD @world did xorg-server _before_ nvidia+libglnvd. Thus why emerging it with --nodeps first, and then building xorg-server fixed it. But that means anyone with a similar setup may run into the same problem.
Comment 5 Daniel Salas 2020-03-07 21:40:12 UTC
Had the same problem, and I can confirm that Ionen's solution fixes the problem.
Comment 6 Ionen Wolkens 2020-03-08 01:03:44 UTC
I've heard this also happen with other packages that use opengl if built before nvidia-drivers[+libglvnd] is rebuilt.

nvidia-drivers[+libglvnd] is essentially a mesa alternative (headers + libraries), but almost nothing depends on it so orders likely get wrong.

Well, it does lack GL/internal/dri_interface.h (provided by mesa) that xorg-server uses for it's non-vendor-independant GLX that nvidia users aren't even using. Otherwise everything works without mesa on nvidia-only.
Comment 7 Christopher Frömmel 2020-03-08 10:52:45 UTC
Thanks for your useful informations!

Simple steps that fixed that build order problem (with +libglvnd) for me:

1) emerge --nodeps -1 nvidia-drivers
2) emerge -1 mesa xorg-server
Comment 8 Thibaud "thican" CANALE 2020-03-08 11:03:24 UTC
Hello Christopher,

I think you shouldn’t close this bug yet, until it is resolved (or marked as) by a Gentoo dev, and for people trying to find this bug when requesting the string " undefined reference to `_glapi_tls_Current'", by default Bugzilla only seek for opened issues.

Best regards,
Comment 9 Christopher Frömmel 2020-03-08 11:14:56 UTC
You are right.
In my world WORKSFORME was not a true "resolved".
Comment 10 Matt Turner gentoo-dev 2020-03-08 19:01:12 UTC
Hm, I guess I need to put some blocker dependencies in place to ensure nvidia-drivers is rebuilt before xorg-server.
Comment 11 dechcaudron 2020-03-08 23:13:11 UTC
I'm affected by this issue as well. Thanks to Christopher for the WA.
Comment 12 Larry the Git Cow gentoo-dev 2020-03-09 00:07:55 UTC
The bug has been closed via the following commit(s):

commit cb625716155c239585d752e7c19d113afdeb91af
Author:     Matt Turner <>
AuthorDate: 2020-03-09 00:04:45 +0000
Commit:     Matt Turner <>
CommitDate: 2020-03-09 00:07:22 +0000

    x11-base/xorg-server: Block on nvidia-drivers[-libglvnd]
    If nvidia-drivers are installed without libglvnd support, the Xserver
    will fail to build.
    Signed-off-by: Matt Turner <>

 x11-base/xorg-server/xorg-server-1.20.7.ebuild | 1 +
 x11-base/xorg-server/xorg-server-9999.ebuild   | 1 +
 2 files changed, 2 insertions(+)
Comment 13 Matt Turner gentoo-dev 2020-03-09 00:08:24 UTC
Added a blocker. Let's see if that solves it.
Comment 14 Bjoern Olausson 2020-03-09 11:58:46 UTC
(In reply to Matt Turner from comment #13)
> Added a blocker. Let's see if that solves it.

Adding the blocker solved the issue for me
The "ebuild -uDNv world" - which failed yesterday - completes successfully in the right order:

$ emerge -uDNva world

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild     U  ] media-libs/mesa-19.3.4-r1::gentoo [19.3.4::gentoo] USE="X classic dri3 egl gallium gbm gles2 libglvnd llvm vaapi vdpau xvmc -d3d9 -debug -gles1 -lm-sensors -opencl -osmesa -pax_kernel (-selinux) -test -unwind -valgrind -vulkan -vulkan-overlay -wayland -xa" ABI_X86="(64) -32 (-x32)" VIDEO_CARDS="i965 intel (-freedreno) -i915 -iris (-lima) -nouveau (-panfrost) -r100 -r200 -r300 -r600 -radeon -radeonsi (-vc4) -virgl (-vivante) -vmware" 0 KiB
[ebuild   R    ] x11-drivers/nvidia-drivers-440.59:0/440::gentoo  USE="X acpi driver gtk3 kms libglvnd* multilib tools uvm -compat -static-libs -wayland" ABI_X86="32 (64) (-x32)" 0 KiB
[ebuild   R    ] x11-base/xorg-server-1.20.7:0/1.20.7::gentoo  USE="ipv6 libglvnd* suid udev xorg xvfb -debug -dmx -doc -elogind -kdrive -libressl -minimal (-selinux) -static-libs -systemd -unwind -wayland -xcsecurity -xephyr -xnest" 0 KiB
[uninstall     ] app-eselect/eselect-opengl-1.3.1-r4::gentoo 
[blocks b      ] app-eselect/eselect-opengl ("app-eselect/eselect-opengl" is blocking x11-drivers/nvidia-drivers-440.59, media-libs/mesa-19.3.4-r1, x11-base/xorg-server-1.20.7)

Total: 3 packages (1 upgrade, 2 reinstalls, 1 uninstall), Size of downloads: 0 KiB
Conflict: 1 block

Would you like to merge these packages? [Yes/No] 
>>> Verifying ebuild manifests
>>> Running pre-merge checks for media-libs/mesa-19.3.4-r1
 * Ignoring USE=vaapi      since VIDEO_CARDS does not contain r600, radeonsi, or nouveau
 * Ignoring USE=vdpau      since VIDEO_CARDS does not contain r300, r600, radeonsi, or nouveau
 * Ignoring USE=xvmc       since VIDEO_CARDS does not contain r600 or nouveau
>>> Running pre-merge checks for x11-drivers/nvidia-drivers-440.59
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found sources for kernel version:
 *     5.5.8-x86_64
 * Checking for suitable kernel configuration options...                                                                                                                                                         [ ok ]
>>> Emerging (1 of 3) media-libs/mesa-19.3.4-r1::gentoo
>>> Installing (1 of 3) media-libs/mesa-19.3.4-r1::gentoo
>>> Emerging (2 of 3) x11-drivers/nvidia-drivers-440.59::gentoo
>>> Installing (2 of 3) x11-drivers/nvidia-drivers-440.59::gentoo
>>> Emerging (3 of 3) x11-base/xorg-server-1.20.7::gentoo
>>> Installing (3 of 3) x11-base/xorg-server-1.20.7::gentoo
>>> Uninstalling app-eselect/eselect-opengl-1.3.1-r4::gentoo
>>> Jobs: 3 of 3 complete                           Load avg: 1.93, 1.35, 0.72

 * Messages for package media-libs/mesa-19.3.4-r1:
 * Log file: /var/log/portage/media-libs:mesa-19.3.4-r1:20200309-115217.log

 * Ignoring USE=vaapi      since VIDEO_CARDS does not contain r600, radeonsi, or nouveau
 * Ignoring USE=vdpau      since VIDEO_CARDS does not contain r300, r600, radeonsi, or nouveau
 * Ignoring USE=xvmc       since VIDEO_CARDS does not contain r600 or nouveau
>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.

 * GNU info directory index is up-to-date.
 * After world updates, it is important to remove obsolete packages with
 * emerge --depclean. Refer to `man emerge` for more information.

Comment 15 Matt Turner gentoo-dev 2020-03-09 18:10:38 UTC
Excellent! Thanks a ton for confirming!
Comment 16 Ivan Fedyanin 2020-03-12 16:19:01 UTC
Unfortunately the solution also affects =x11-drivers/nvidia-drivers-340.108 that is still in the tree, stable and is used for older cards. This version does not have a `libglvnd' flag and blocks break a build. Probably <x11-drivers/nvidia-drivers-435.21-r1 won't build as well.
Comment 17 augustin 2020-06-18 06:31:40 UTC
In reply to comment #6 by Ionen Wolkens:
> I've heard this also happen with other packages that use opengl if built
> before nvidia-drivers[+libglvnd] is rebuilt.

I had the exact same error message with another package:

>>> Failed to emerge dev-qt/qtdeclarative-5.14.2-r2:
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib64/ undefined reference to `_glapi_tls_Current'
collect2: error: ld returned 1 exit status

At that time, media-libs/libglvnd had already successfully emerged.
However neither
x11-base/xorg-server-1.20.8  [1.20.7] USE="elogind* libglvnd*"
had emerged yet.

The solution by Christopher Frömmel in comment #7 worked for me:
1) emerge --nodeps -1 nvidia-drivers
2) continue emerge --update, during which dev-qt/qtdeclarative emerged successfully.

So, it appears that there are other instances of this bug that are not yet fixed.

Also, I am grateful for the comments above, that provided the solution in my specific situation.
However, I am wondering, given the error message above (undefined symbol in how would someone deduce that the nvidia-drivers needed to be rebuilt first?
What kind of educated guess could I make in the future to deduce how to solve similar problems in the future?

Thank you all.
Comment 18 augustin 2020-06-18 06:48:43 UTC
If anybody has some answers or pointers to my last question (previous comment), I'd like to document it here: