chromium: Fix running with --use-gl=egl.

When Chromium is using EGL, it dlopen's libGLESv2. Before this fix, this failed
with a not-found error. Fix it by adding libGL to the RUNPATH of the binary.

This problem does not have a visible impact on typical desktop system because
Chromium uses GLX by default. It only matters when Chromium is started with
--use-gl=egl (which makes it use OpenGL ES via EGL instead of desktop OpenGL
via GLX), and probably on certain embedded systems which only support OpenGL
ES.

With this fix, Chromium runs fine for me with --use-gl=egl and the NVidia
driver, and the about:gpu page indicates that it is indeed using OpenGL ES and
EGL.
This commit is contained in:
Ambroz Bizjak 2019-07-15 08:35:03 +02:00
parent 31c38894c9
commit 6a0a073187

View File

@ -13,7 +13,7 @@
, bison, gperf
, glib, gtk3, dbus-glib
, glibc
, libXScrnSaver, libXcursor, libXtst, libGLU_combined
, libXScrnSaver, libXcursor, libXtst, libGLU_combined, libGL
, protobuf, speechd, libXdamage, cups
, ffmpeg, libxslt, libxml2, at-spi2-core
, jdk
@ -308,6 +308,13 @@ let
targets = extraAttrs.buildTargets or [];
commands = map buildCommand targets;
in concatStringsSep "\n" commands;
postFixup = ''
# Make sure that libGLESv2 is found by dlopen (if using EGL).
chromiumBinary="$libExecPath/$packageName"
origRpath="$(patchelf --print-rpath "$chromiumBinary")"
patchelf --set-rpath "${libGL}/lib:$origRpath" "$chromiumBinary"
'';
};
# Remove some extraAttrs we supplied to the base attributes already.