From 5c11e174b243849bf896cf68a445f8564cbfd8cb Mon Sep 17 00:00:00 2001 From: Guillaume Bouchard Date: Mon, 3 Feb 2020 11:52:40 +0100 Subject: [PATCH] pythonPackages.pyopengl: fix runtime shared library loading failure This closes #76822. pyopengl 3.1.4 introduced a new logic for shared library loading: it tests a few combinations of library name and suffix (such as .so.X). Our previous patch was just replacing the library name (e.g. 'glut') by the full path to the nix store. This does not work anymore with pyopengl 3.1.4 new heuristic. This commit just keep the behavior of pyopengl but adds the nix store path to the list of tried paths. --- pkgs/development/python-modules/pyopengl/default.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/development/python-modules/pyopengl/default.nix b/pkgs/development/python-modules/pyopengl/default.nix index a425fcf5be96..ed643eb21983 100644 --- a/pkgs/development/python-modules/pyopengl/default.nix +++ b/pkgs/development/python-modules/pyopengl/default.nix @@ -19,6 +19,8 @@ buildPythonPackage rec { patchPhase = let ext = stdenv.hostPlatform.extensions.sharedLibrary; in '' + # Theses lines are patching the name of dynamic libraries + # so pyopengl can find them at runtime. substituteInPlace OpenGL/platform/glx.py \ --replace "'GL'" "'${pkgs.libGL}/lib/libGL${ext}'" \ --replace "'GLU'" "'${pkgs.libGLU}/lib/libGLU${ext}'" \ @@ -26,6 +28,16 @@ buildPythonPackage rec { substituteInPlace OpenGL/platform/darwin.py \ --replace "'OpenGL'" "'${pkgs.libGL}/lib/libGL${ext}'" \ --replace "'GLUT'" "'${pkgs.freeglut}/lib/libglut${ext}'" + + # https://github.com/NixOS/nixpkgs/issues/76822 + # pyopengl introduced a new "robust" way of loading libraries in 3.1.4. + # The later patch of the filepath does not work anymore because + # pyopengl takes the "name" (for us: the path) and tries to add a + # few suffix during its loading phase. + # The following patch put back the "name" (i.e. the path) in the + # list of possible files. + substituteInPlace OpenGL/platform/ctypesloader.py \ + --replace "filenames_to_try = []" "filenames_to_try = [name]" ''; # Need to fix test runner