Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 567200 - >=media-libs/mesa-11.0.6 installs libGL to /usr/${libdir} and breaks applications that dlopen() libGL from "known path"
Summary: >=media-libs/mesa-11.0.6 installs libGL to /usr/${libdir} and breaks applicat...
Status: RESOLVED DUPLICATE of bug 531990
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo X packagers
Depends on:
Reported: 2015-12-01 00:10 UTC by Maciej Mrozowski
Modified: 2016-01-13 07:32 UTC (History)
2 users (show)

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

emerge --info (file_567200.txt,3.46 KB, text/plain)
2015-12-01 00:10 UTC, Maciej Mrozowski

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Mrozowski gentoo-dev 2015-12-01 00:10:27 UTC
Created attachment 418252 [details]
emerge --info

When blob drivers are used (ati, nvidia), certain applications break, when mesa installs its own (in such configuration useless) libGL to /usr/<libdir>.
eselect-opengl just mangles LDPATH and that only handles applications that linked to libGL at build time. Those that dlopen() require LD_PRELOAD or other magic.

Symptoms with Steam:
maciek@liwardyna ~/opt/steampowered/bin $ LIBGL_DEBUG="verbose steam" ./steam
Couldn't find dpkg, please update steamdeps for your distribution.
Running Steam on gentoo  64-bit
STEAM_RUNTIME is enabled automatically
ILocalize::AddFile() failed to load file "public/steambootstrapper_english.txt".
[2015-12-01 00:54:03] Startup - updater built Jun 16 2014 11:16:02
Installing breakpad exception handler for appid(steam)/version(1447125378_client)
libGL: screen 0 does not appear to be DRI2 capable
libGL: OpenDriver: trying /usr/lib32/dri/tls/
libGL: OpenDriver: trying /usr/lib32/dri/
libGL: dlopen /usr/lib32/dri/ failed (/usr/lib32/dri/ cannot open shared object file: No such file or directory)
libGL error: unable to load driver:
libGL error: failed to load driver: swrast
SteamUpdateUI: An X Error occurred
X Error of failed request:  BadValue (integer parameter out of range for operation)

Likely wrong libGL is being dlopen()-ed (LD_PRELOAD fixes).

All in all, I think mesa should only optionally install libGL - for instance when there is at least one driver specified in VIDEO_CARDS for the package or when software rasterizer is explicitly requested to be built.
Comment 1 zzz 2015-12-01 04:54:03 UTC
Is there any good way to work around this until it's fixed?

I'm using the proprietary nvidia-drivers, and the update today left a lot of OpenGL programs broken because of this.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-12-01 11:39:45 UTC
Game developers will never cease to surprise me. Why dlopen safely by filename when you can instead hardcode path that is going to be wrong on every third system.

So, could you test the following:

1. Does setting LD_PRELOAD to the correct library path fix this?

2. Does setting (without explicit path) fix this?

3. Does removing from /usr/lib* fix this? (without LD_PRELOAD).

As far as I can recall, the issue with steam was not due to LD_PRELOAD but due to upstream dumbly prepending paths to LD_LIBRARY_PATH. though I think we fixed that somehow.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-12-01 14:10:56 UTC
Also I'd appreciate if you were more specific what is broken. Because I've started looking through game sources and they usually dlopen() libGL without path, so that won't be a problem.

As for steam, would be nice to mention where did you get it. I'm pretty sure there's more than one ebuild floating around.
Comment 4 zzz 2015-12-01 17:48:16 UTC
Originally I couldn't use steam, or glxgears after the update. I got similar errors as Maciej posted above with both.

At first I just tried to reinstall the newest nvidia-drivers, but that didn't help. I un-installed mesa, and then re-installed nvidia-drivers-352.63, everything works now. I don't think you need that specific version of nvidia-drivers though.

Sorry I'm not much help and couldn't answer your specific questions, just stating what eventually worked for me.
Comment 5 Maciej Mrozowski gentoo-dev 2015-12-01 23:59:54 UTC
> I un-installed mesa, and then re-installed nvidia-drivers-352.63, everything works now.

That will surely break again you re-emerge mesa back as it installs libGL to /usr/lib*.

This is standalone Steam installation in my case (unpacked .deb? run from user directory) - no ebuilds used.
Checking steam process environment, Steam indeed appends /usr/lib32 at the end of LD_LIBRARY_PATH so unless we strip it off somewhere in ld I don't see how to recover from this crap in automatic manner...

1. Does setting LD_PRELOAD to the correct library path fix this?
Fixes Steam.
Unreal SDK was fixed by removing and regenerating /etc/env.d/000opengl I think. Or I had added own LD_PRELOAD=/usr/ before that now broke, cannot narrow it down anymore unfortunately.

2. Does setting (without explicit path) fix this?
Does not fix Steam.

3. Does removing from /usr/lib* fix this? (without LD_PRELOAD).
Surely would fix, issue now clear once I know Steam appends /usr/lib* to LD_LIBRARY_PATH.

I'll try to report it upstream...
Comment 6 Maciej Mrozowski gentoo-dev 2015-12-02 00:49:57 UTC
Related to bug 531990.
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-12-02 07:10:26 UTC
So. Do you have any real case of dlopen() with absolute path or was this purely steam which is case of LD_LIBRARY_PATH hackery?
Comment 8 zzz 2015-12-02 08:15:52 UTC
@Maciej Mrozowski
>That will surely break again you re-emerge mesa back as it installs libGL to /usr/lib*.

Yeah I figured it would. I just added mesa to package.provided until something gets worked out on someone's end.

@Michał Górny
>So. Do you have any real case of dlopen() with absolute path or was this purely steam which is case of LD_LIBRARY_PATH hackery?

The update did break glxgears for me too, with near identical error.
Comment 9 orionbelt2 2015-12-06 02:34:04 UTC
I am wondering whether this forum thread might also be related:
Comment 10 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-12-06 06:52:46 UTC
If you can come up with non-steam problem, please reopen. Otherwise, I'm closing this as duplicate of the original (fixed in overlay) Steam bug.

*** This bug has been marked as a duplicate of bug 531990 ***
Comment 11 ben.simons 2016-01-13 03:03:07 UTC

No I think there's still an issue with media-libs/mesa-11.0.6

It installs a into /usr/lib64/  (!) when i think that should be a symbolic link. The link is being clobbered. With the nvidia drivers and mesa installed, was a sym-link:
/usr/lib64/ -> opengl/nvidia/lib/

media-libs/mesa-10.3.7-r1  installs into:

That's what I'd like vers 11.0.6 to do as well.

right now, with vers 11.0.6, "glxinfo" reports a libGL error!

The bug is is simply that Mesa's is clobbering the link at /usr/lib64 when it should be installing it in /usr/lib64/opengl/xorg-x11/lib


$ emerge --info
Portage 2.2.26 (python 2.7.10-final-0, default/linux/amd64/13.0/desktop/kde, gcc-4.8.4, glibc-2.21-r1, 4.1.12-gentoo x86_64)
System uname: Linux-4.1.12-gentoo-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q6600_@_2.40GHz-with-gentoo-2.2
KiB Mem:     3987680 total,    861344 free
KiB Swap:   33554428 total,  33554248 free
Timestamp of repository gentoo: Tue, 12 Jan 2016 05:45:01 +0000
sh bash 4.3_p42-r1
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p42-r1::gentoo
dev-java/java-config:     2.2.0::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.10-r1::gentoo, 3.3.5-r1::gentoo, 3.4.3-r1::gentoo
dev-util/cmake:           3.3.1-r1::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.18.4::gentoo
sys-apps/sandbox:         2.6-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.10.3::gentoo, 1.11.6-r1::gentoo, 1.12.6::gentoo, 1.13.4::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.3.6-r1::gentoo, 4.4.7::gentoo, 4.7.3-r1::gentoo, 4.8.4::gentoo, 4.9.3::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 3.18::gentoo (virtual/os-headers)
sys-libs/glibc:           2.21-r1::gentoo

    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://
    priority: -1000

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

Installed sets: @ben
CFLAGS="-O2 -pipe"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
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"
USE="X a52 aac acl acpi alsa amd64 berkdb bindist bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus declarative dri dts dvd dvdr emboss encode exif fam ffmpeg firefox flac fortran gdbm gif git glamor gpm gtk iconv ipv6 jpeg kde kipi lcms ldap libnotify mad mmx mmxext mng modules mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf phonon plasma png policykit ppds qt3support qt4 readline sdl seccomp semantic-desktop session spell sse sse2 ssl startup-notification subversion svg tcpd tiff truetype udev udisks unicode upower usb vorbis wxwidgets x264 xattr xcb xcomposite xinerama xml xscreensaver xv xvid zlib" ABI_X86="64" 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="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3" 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 ublox ubx" INPUT_DEVICES="evdev" 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="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" 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"
USE_PYTHON="2.7 3.3"
Comment 12 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-01-13 06:36:51 UTC
Did you use eselect-opengl? Did you source new /etc/profile? I would appreciate if you focused on facts rather than 'I think things should never change because they were like this before'.
Comment 13 ben.simons 2016-01-13 07:32:05 UTC
(In reply to Michał Górny from comment #12)
> Did you use eselect-opengl? Did you source new /etc/profile? I would
> appreciate if you focused on facts rather than 'I think things should never
> change because they were like this before'.

Hi Yes ok sorry.. I didn't mean things should never change. I was just trying to help in case they'd accidentally changed. I did not expect mesa clobbering links in /usr/lib64 to be correct behaviour. But it's not about me. :)

Yes 'eselect opengl' was used previously. Need it be done again? Yes, i think the /etc/profile was sourced .. (though the shell is gone, and new ones do).

 $ eselect opengl list
Available OpenGL implementations:
  [1]   nvidia *
  [2]   xorg-x11

Ah. We have a global LD_LIBRARY_PATH set. Perhaps it interferes?

 $ env|grep LD

Apologies: looks like this is just the old way of doing things, and ldconfig takes care of runtime linking these days (? sorry: old skool). I've cleared LD_LIBRARY_PATH and glxinfo & houdini etc works fine now.