From 6a0a07318763375dd90125fdf73f690e6c49687e Mon Sep 17 00:00:00 2001 From: Ambroz Bizjak Date: Mon, 15 Jul 2019 08:35:03 +0200 Subject: [PATCH] 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. --- .../applications/networking/browsers/chromium/common.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index ea0e0184340..7779c981d6c 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -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.