From e9269d82f7842c0c3050c402ee98ebfdc20524bb Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 4 Dec 2023 15:40:22 +0100 Subject: [PATCH] python311Packages.torchaudio: fix build when cudaSupport is enabled --- .../0001-setup.py-propagate-cmakeFlags.patch | 32 +++++++++++++++++++ .../python-modules/torchaudio/default.nix | 4 +++ 2 files changed, 36 insertions(+) create mode 100644 pkgs/development/python-modules/torchaudio/0001-setup.py-propagate-cmakeFlags.patch diff --git a/pkgs/development/python-modules/torchaudio/0001-setup.py-propagate-cmakeFlags.patch b/pkgs/development/python-modules/torchaudio/0001-setup.py-propagate-cmakeFlags.patch new file mode 100644 index 000000000000..a1f6b5ea8aeb --- /dev/null +++ b/pkgs/development/python-modules/torchaudio/0001-setup.py-propagate-cmakeFlags.patch @@ -0,0 +1,32 @@ +From 789ec77d09171f22d82006493cafbcf2496b4f8f Mon Sep 17 00:00:00 2001 +From: Someone Serge +Date: Sat, 2 Dec 2023 12:47:00 +0000 +Subject: [PATCH] setup.py: propagate cmakeFlags + +--- + tools/setup_helpers/extension.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/tools/setup_helpers/extension.py b/tools/setup_helpers/extension.py +index 2415bbae..7c2a9351 100644 +--- a/tools/setup_helpers/extension.py ++++ b/tools/setup_helpers/extension.py +@@ -1,6 +1,7 @@ + import distutils.sysconfig + import os + import platform ++import shlex + import subprocess + from pathlib import Path + +@@ -141,6 +142,8 @@ class CMakeBuild(build_ext): + f"-DUSE_OPENMP:BOOL={'ON' if _USE_OPENMP else 'OFF'}", + f"-DUSE_FFMPEG:BOOL={'ON' if _USE_FFMPEG else 'OFF'}", + ] ++ if "cmakeFlags" in os.environ: ++ cmake_args.extend(shlex.split(os.environ["cmakeFlags"])) + build_args = ["--target", "install"] + # Pass CUDA architecture to cmake + if _TORCH_CUDA_ARCH_LIST is not None: +-- +2.42.0 diff --git a/pkgs/development/python-modules/torchaudio/default.nix b/pkgs/development/python-modules/torchaudio/default.nix index 4ff44d123a48..1014ab523821 100644 --- a/pkgs/development/python-modules/torchaudio/default.nix +++ b/pkgs/development/python-modules/torchaudio/default.nix @@ -24,6 +24,10 @@ buildPythonPackage rec { hash = "sha256-5UlnOGXXFu1p9M5B+Ixc9DW5hLZ1nskv81Y+McbWu6Q="; }; + patches = [ + ./0001-setup.py-propagate-cmakeFlags.patch + ]; + postPatch = '' substituteInPlace setup.py \ --replace 'print(" --- Initializing submodules")' "return" \