summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorChih-Hsuan Yen2022-05-25 13:14:45 +0800
committerChih-Hsuan Yen2022-05-25 13:14:45 +0800
commitca0778e75788e00ea6be3cbcde08eabe79619321 (patch)
treef1a0f9a2b68b579de7f6721c837f11dec7f33069
parent7281798208c92e1cdbf7866d3114813929c22fd8 (diff)
downloadaur-ca0778e75788e00ea6be3cbcde08eabe79619321.tar.gz
allow this to build with CUDA
See discussions starting from https://aur.archlinux.org/packages/python-torchaudio#comment-864651
-rw-r--r--.SRCINFO1
-rw-r--r--PKGBUILD14
2 files changed, 11 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index faa9c0ae341b..a5a1958eb7ab 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -10,6 +10,7 @@ pkgbase = python-torchaudio
makedepends = python-setuptools
makedepends = cmake
makedepends = ninja
+ makedepends = gcc11
depends = python
depends = python-pytorch
optdepends = python-kaldi-io
diff --git a/PKGBUILD b/PKGBUILD
index 5ffee11fbae7..3ba90877f6a7 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -11,14 +11,11 @@ url="https://github.com/pytorch/audio"
license=('BSD')
depends=('python' 'python-pytorch')
optdepends=('python-kaldi-io')
-makedepends=('git' 'python-setuptools' 'cmake' 'ninja')
+makedepends=('git' 'python-setuptools' 'cmake' 'ninja' 'gcc11')
conflicts=('python-torchaudio-git')
source=("git+$url#tag=v${pkgver}")
sha512sums=('SKIP')
-# Temporarily disable CUDA as it does not build with GCC 12
-export USE_CUDA=0
-
prepare() {
cd "$srcdir/${_pkgname}"
# Use sourceforge url to fetch zlib
@@ -28,6 +25,15 @@ prepare() {
build() {
cd "$srcdir/${_pkgname}"
+
+ # Allow this to build with CUDA, which is not compatible with GCC 12 yet
+ export CC=/usr/bin/gcc-11
+ export CXX=/usr/bin/g++-11
+ export CUDAHOSTCXX=$CXX
+ # Follow architectures used by pytorch
+ # https://github.com/archlinux/svntogit-community/blob/packages/python-pytorch/trunk/PKGBUILD
+ export TORCH_CUDA_ARCH_LIST="5.2;6.0;6.2;7.0;7.2;7.5;8.0;8.6;8.6+PTX"
+
CUDA_HOME=/opt/cuda/ BUILD_SOX=1 python setup.py build
}