git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #113105 from danieldk/cudnn-fixes

cudnn_cudatookit_11: add $ORIGIN/ to library RPATHs

commit406c33bb3dd79fd467aed63473b80b4442b5997f authorDaniël de Kok <me@danieldk.eu> dateMon 15 Feb 2021, 14:51 (6 years ago) parent2489d958dad19a
1 file changed+6−9
pkgs/development/libraries/science/math/cudnn/generic.nix+6−9
pkgs/development/libraries/science/math/cudnn/generic.nix+6−9
@@ -25,9 +25,12 @@ stdenv.mkDerivation {
2525 installPhase = ''
2626 function fixRunPath {
2727 p=$(patchelf --print-rpath $1)
28− patchelf --set-rpath "$p:${lib.makeLibraryPath [ stdenv.cc.cc ]}" $1
28+ patchelf --set-rpath "''${p:+$p:}${lib.makeLibraryPath [ stdenv.cc.cc ]}:\$ORIGIN/" $1
2929 }
30− fixRunPath lib64/libcudnn.so
30+
31+ for lib in lib64/lib*.so; do
32+ fixRunPath $lib
33+ done
3134
3235 mkdir -p $out
3336 cp -a include $out/include
@@ -38,13 +41,7 @@ stdenv.mkDerivation {
3841 # See the explanation in addOpenGLRunpath.
3942 postFixup = ''
4043 for lib in $out/lib/lib*.so; do
41− # patchelf fails on libcudnn_cnn_infer due to it being too big.
42− # Most programs will still get the RPATH since they link to
43− # other things.
44− # (https://github.com/NixOS/patchelf/issues/222)
45− if [ "$(basename $lib)" != libcudnn_cnn_infer.so ]; then
46− addOpenGLRunpath $lib
47− fi
44+ addOpenGLRunpath $lib
4845 done
4946 '';
5047