From 2312d0f9f03a296adcdfb4bd2b066c07c9fafa35 Mon Sep 17 00:00:00 2001 From: Charles Duffy Date: Wed, 7 Jun 2023 16:42:51 -0500 Subject: [PATCH] python3Packages.torch-bin: only include Linux-specific dependencies when building on Linux This fixes a build regression on aarch64-darwin that has prevented torch-bin from being buildable since the merge of #227420. --- pkgs/development/python-modules/torch/bin.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/torch/bin.nix b/pkgs/development/python-modules/torch/bin.nix index b830b41527fd..ec8ec52b2430 100644 --- a/pkgs/development/python-modules/torch/bin.nix +++ b/pkgs/development/python-modules/torch/bin.nix @@ -40,18 +40,19 @@ in buildPythonPackage { nativeBuildInputs = [ addOpenGLRunpath + patchelf + ] ++ lib.optionals stdenv.isLinux [ autoPatchelfHook cudaPackages.autoAddOpenGLRunpathHook - patchelf ]; - buildInputs = with cudaPackages; [ + buildInputs = lib.optionals stdenv.isLinux (with cudaPackages; [ # $out/${sitePackages}/nvfuser/_C*.so wants libnvToolsExt.so.1 but torch/lib only ships # libnvToolsExt-$hash.so.1 cuda_nvtx - ]; + ]); - autoPatchelfIgnoreMissingDeps = [ + autoPatchelfIgnoreMissingDeps = lib.optionals stdenv.isLinux [ # This is the hardware-dependent userspace driver that comes from # nvidia_x11 package. It must be deployed at runtime in # /run/opengl-driver/lib or pointed at by LD_LIBRARY_PATH variable, rather @@ -79,7 +80,7 @@ in buildPythonPackage { rm -rf $out/bin ''; - postFixup = '' + postFixup = lib.optionalString stdenv.isLinux '' addAutoPatchelfSearchPath "$out/${python.sitePackages}/torch/lib" patchelf $out/${python.sitePackages}/torch/lib/libcudnn.so.8 --add-needed libcudnn_cnn_infer.so.8