Add driver library path to some packages to find CUDA libraries.
This is to avoid relying on LD_LIBRARY_PATH for finding the CUDA driver libraries.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
, lib
|
||||
, cudatoolkit
|
||||
, fetchurl
|
||||
, addOpenGLRunpath
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
@@ -19,6 +20,8 @@ stdenv.mkDerivation rec {
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ addOpenGLRunpath ];
|
||||
|
||||
installPhase = ''
|
||||
function fixRunPath {
|
||||
p=$(patchelf --print-rpath $1)
|
||||
@@ -31,6 +34,12 @@ stdenv.mkDerivation rec {
|
||||
cp -a lib64 $out/lib64
|
||||
'';
|
||||
|
||||
# Set RUNPATH so that libcuda in /run/opengl-driver(-32)/lib can be found.
|
||||
# See the explanation in addOpenGLRunpath.
|
||||
postFixup = ''
|
||||
addOpenGLRunpath $out/lib/lib*.so
|
||||
'';
|
||||
|
||||
propagatedBuildInputs = [
|
||||
cudatoolkit
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user