Unverified Commit 2312d0f9 authored by Charles Duffy's avatar Charles Duffy
Browse files

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.
parent 54ea6f60
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -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