cudnn_cudatookit_11: add $ORIGIN/ to library RPATHs
Starting with version 8, CuDNN consists of multiple libraries.
Libraries (except libcudnn.so) are dlopen()ed on demand.
Since the CuDNN library path itself was not added to the rpath of the
libraries, use of CuDNN often fails with the following error:
Could not load library libcudnn_cnn_train.so.8.
Error: libcudnn_ops_train.so.8: cannot open shared object file: No such file or directory
Please make sure libcudnn_cnn_train.so.8 is in your library path!
This change fixes this by adding $ORIGIN/ to the rpath of all CuDNN
libraries.
commit8dad19aebeef4c8775df46e3485c73cfd126c2c6
authorDaniël de Kok <me@danieldk.eu>
dateSun 14 Feb 2021, 11:27 (6 years ago)
parent84786eb
pkgs/development/libraries/science/math/cudnn/generic.nix+5−2
@@ -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