From d1226bff8ec0ce78a798f23f06c9a35d0e9ff3c3 Mon Sep 17 00:00:00 2001 From: Ambroz Bizjak Date: Sat, 8 Jun 2019 15:23:05 +0200 Subject: [PATCH] nvidia-x11: Set 32-bit library paths for 32-bit libraries. Patchelf was being called to point RUNPATH to 64-bit library paths even for 32-bit libraries. --- pkgs/os-specific/linux/nvidia-x11/builder.sh | 6 +++++- pkgs/os-specific/linux/nvidia-x11/generic.nix | 9 ++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pkgs/os-specific/linux/nvidia-x11/builder.sh b/pkgs/os-specific/linux/nvidia-x11/builder.sh index 56012aafea9..a30f1d7f593 100755 --- a/pkgs/os-specific/linux/nvidia-x11/builder.sh +++ b/pkgs/os-specific/linux/nvidia-x11/builder.sh @@ -102,7 +102,11 @@ installPhase() { do # I'm lazy to differentiate needed libs per-library, as the closure is the same. # Unfortunately --shrink-rpath would strip too much. - patchelf --set-rpath "$out/lib:$libPath" "$libname" + if [[ -n $lib32 && $libname == "$lib32/lib/"* ]]; then + patchelf --set-rpath "$lib32/lib:$libPath32" "$libname" + else + patchelf --set-rpath "$out/lib:$libPath" "$libname" + fi libname_short=`echo -n "$libname" | sed 's/so\..*/so/'` diff --git a/pkgs/os-specific/linux/nvidia-x11/generic.nix b/pkgs/os-specific/linux/nvidia-x11/generic.nix index 4bbb9d92930..eeb7b99bbaa 100644 --- a/pkgs/os-specific/linux/nvidia-x11/generic.nix +++ b/pkgs/os-specific/linux/nvidia-x11/generic.nix @@ -13,8 +13,8 @@ , broken ? false }: -{ stdenv, callPackage, pkgsi686Linux, fetchurl -, kernel ? null, xorg, zlib, perl, nukeReferences +{ stdenv, callPackage, pkgs, pkgsi686Linux, fetchurl +, kernel ? null, perl, nukeReferences , # Whether to build the libraries only (i.e. not the kernel module or # nvidia-settings). Used to support 32-bit binaries on 64-bit # Linux. @@ -32,6 +32,8 @@ let pkgSuffix = optionalString (versionOlder version "304") "-pkg0"; i686bundled = versionAtLeast version "391"; + libPathFor = pkgs: pkgs.lib.makeLibraryPath [ pkgs.xorg.libXext pkgs.xorg.libX11 + pkgs.xorg.libXv pkgs.xorg.libXrandr pkgs.xorg.libxcb pkgs.zlib pkgs.stdenv.cc.cc ]; self = stdenv.mkDerivation { name = "nvidia-x11-${version}${nameSuffix}"; @@ -70,7 +72,8 @@ let dontStrip = true; dontPatchELF = true; - libPath = makeLibraryPath [ xorg.libXext xorg.libX11 xorg.libXv xorg.libXrandr xorg.libxcb zlib stdenv.cc.cc ]; + libPath = libPathFor pkgs; + libPath32 = optionalString i686bundled (libPathFor pkgsi686Linux); nativeBuildInputs = [ perl nukeReferences ] ++ optionals (!libsOnly) kernel.moduleBuildDependencies;