You can use an older version of the official cuda package. It has very few dependencies (gcc11, opencl-nvidia, nvidia-utils and python for cuda 11.8) so installing it on a recent system should work.
You can find old binary packages in the Arch Linux Archive: https://archive.archlinux.org/packages/c/cuda/, and install them with sudo pacman -U <package file>
You can also build an older version of the package. This way you can install that older cuda along with other versions.
For example, I installed cuda 11.8 by following these steps:
- clone the cuda package repository:
git clone https://gitlab.archlinux.org/archlinux/packaging/packages/cuda.git
cd cuda
- find the version you want in
git tag --list
- load that version into your working tree:
git switch --detach 11.8.0-1 (or git checkout 11.8.0-1)
- edit
PKGBUILD if necessary. I have changed the package name to avoid conflicts with the official package, changed the installation paths, and disabled the installation of files that conflict with the official package (anything related to pkgconfig or in /etc). Here's the diff:
diff --git a/PKGBUILD b/PKGBUILD
index e688b4c..0cffc67 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,9 +1,9 @@
# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Maintainer: Konstantin Gizdov <arch@kge.pw>
-pkgname=(cuda cuda-tools)
-pkgbase=cuda
+pkgname=(cuda11.8 cuda-tools11.8)
+pkgbase=cuda11.8
pkgver=11.8.0
_driverver=520.61.05
pkgrel=1
pkgdesc="NVIDIA's GPU programming toolkit"
arch=('x86_64')
@@ -83,84 +83,84 @@ build() {
local _prepdir="${srcdir}/prep"
cd "${srcdir}/builds"
rm -r NVIDIA*.run bin
- mkdir -p "${_prepdir}/opt/cuda/extras"
- mv integration nsight_compute nsight_systems EULA.txt "${_prepdir}/opt/cuda"
- mv cuda_demo_suite/extras/demo_suite "${_prepdir}/opt/cuda/extras/demo_suite"
- mv cuda_sanitizer_api/compute-sanitizer "${_prepdir}/opt/cuda/extras/compute-sanitizer"
+ mkdir -p "${_prepdir}/opt/cuda11.8/extras"
+ mv integration nsight_compute nsight_systems EULA.txt "${_prepdir}/opt/cuda11.8"
+ mv cuda_demo_suite/extras/demo_suite "${_prepdir}/opt/cuda11.8/extras/demo_suite"
+ mv cuda_sanitizer_api/compute-sanitizer "${_prepdir}/opt/cuda11.8/extras/compute-sanitizer"
rmdir cuda_sanitizer_api
for lib in *; do
if [[ "$lib" =~ .*"version.json".* ]]; then
continue
fi
- cp -r $lib/* "${_prepdir}/opt/cuda/"
+ cp -r $lib/* "${_prepdir}/opt/cuda11.8/"
done
# Delete some unnecessary files
- rm -r "${_prepdir}"/opt/cuda/bin/cuda-uninstaller
+ rm -r "${_prepdir}"/opt/cuda11.8/bin/cuda-uninstaller
# Define compilers for CUDA to use.
# This allows us to use older versions of GCC if we have to.
- ln -s /usr/bin/gcc-11 "${_prepdir}/opt/cuda/bin/gcc"
- ln -s /usr/bin/g++-11 "${_prepdir}/opt/cuda/bin/g++"
+ ln -s /usr/bin/gcc-11 "${_prepdir}/opt/cuda11.8/bin/gcc"
+ ln -s /usr/bin/g++-11 "${_prepdir}/opt/cuda11.8/bin/g++"
# Install profile and ld.so.config files
- install -Dm755 "${srcdir}/cuda.sh" "${_prepdir}/etc/profile.d/cuda.sh"
- install -Dm644 "${srcdir}/cuda.conf" "${_prepdir}/etc/ld.so.conf.d/cuda.conf"
+ #install -Dm755 "${srcdir}/cuda.sh" "${_prepdir}/etc/profile.d/cuda.sh"
+ #install -Dm644 "${srcdir}/cuda.conf" "${_prepdir}/etc/ld.so.conf.d/cuda.conf"
# Install pkgconfig files
- mkdir -p "$_prepdir"/usr/lib/pkgconfig
- cp "${srcdir}"/*.pc "${_prepdir}"/usr/lib/pkgconfig
+ #mkdir -p "$_prepdir"/usr/lib/pkgconfig
+ #cp "${srcdir}"/*.pc "${_prepdir}"/usr/lib/pkgconfig
mkdir -p "${_prepdir}/usr/share/licenses/${pkgname}"
- ln -s /opt/cuda/EULA.txt "${_prepdir}/usr/share/licenses/${pkgname}/EULA.txt"
- ln -s /opt/cuda/README "${_prepdir}/usr/share/licenses/${pkgname}/README"
+ ln -s /opt/cuda11.8/EULA.txt "${_prepdir}/usr/share/licenses/${pkgname}/EULA.txt"
+ ln -s /opt/cuda11.8/README "${_prepdir}/usr/share/licenses/${pkgname}/README"
# Allow newer compilers to work. This is not officially supported in the Arch package but
# if users want to try, let them try.
# See https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#system-requirements
# for official requirements
- sed -i "/.*unsupported GNU version.*/d" "${_prepdir}"/opt/cuda/targets/x86_64-linux/include/crt/host_config.h
- sed -i "/.*unsupported clang version.*/d" "${_prepdir}"/opt/cuda/targets/x86_64-linux/include/crt/host_config.h
+ sed -i "/.*unsupported GNU version.*/d" "${_prepdir}"/opt/cuda11.8/targets/x86_64-linux/include/crt/host_config.h
+ sed -i "/.*unsupported clang version.*/d" "${_prepdir}"/opt/cuda11.8/targets/x86_64-linux/include/crt/host_config.h
# Fix Makefile paths to CUDA
- for f in $(find "$_prepdir"/opt/cuda -name Makefile); do
- sed -i "s|/usr/local/cuda|/opt/cuda|g" "$f"
+ for f in $(find "$_prepdir"/opt/cuda11.8 -name Makefile); do
+ sed -i "s|/usr/local/cuda|/opt/cuda11.8|g" "$f"
done
}
-package_cuda() {
+package_cuda11.8() {
replaces=('cuda-toolkit' 'cuda-sdk' 'cuda-static')
provides=('cuda-toolkit' 'cuda-sdk' 'libcudart.so' 'libcublas.so' 'libcusolver.so' 'libcusparse.so')
optdepends=('gdb: for cuda-gdb'
'glu: required for some profiling tools in CUPTI')
local _prepdir="${srcdir}/prep"
cd "${_prepdir}"
cp -al * "${pkgdir}"
# remove broken links
- rm "${pkgdir}"/opt/cuda/include/include
- rm "${pkgdir}"/opt/cuda/lib64/lib64
+ rm "${pkgdir}"/opt/cuda11.8/include/include
+ rm "${pkgdir}"/opt/cuda11.8/lib64/lib64
- rm -r "${pkgdir}"/opt/cuda/{bin/nvvp,bin/computeprof,libnvvp,nsight*}
+ rm -r "${pkgdir}"/opt/cuda11.8/{bin/nvvp,bin/computeprof,libnvvp,nsight*}
}
-package_cuda-tools() {
+package_cuda-tools11.8() {
pkgdesc="NVIDIA's GPU programming toolkit (extra tools: nvvp, nsight)"
depends=('cuda' 'java-runtime=8' 'nss')
optdepends=('perl: required by some NVVP plugins')
local _prepdir="${srcdir}/prep"
- mkdir -p "${pkgdir}/opt/cuda/bin"
- mv "${_prepdir}"/opt/cuda/nsight* "${pkgdir}/opt/cuda"
- mv "${_prepdir}"/opt/cuda/bin/nvvp "${pkgdir}/opt/cuda/bin/nvvp"
- mv "${_prepdir}"/opt/cuda/bin/computeprof "${pkgdir}/opt/cuda/bin/computeprof"
- mv "${_prepdir}"/opt/cuda/libnvvp "${pkgdir}/opt/cuda"
+ mkdir -p "${pkgdir}/opt/cuda11.8/bin"
+ mv "${_prepdir}"/opt/cuda11.8/nsight* "${pkgdir}/opt/cuda11.8"
+ mv "${_prepdir}"/opt/cuda11.8/bin/nvvp "${pkgdir}/opt/cuda11.8/bin/nvvp"
+ mv "${_prepdir}"/opt/cuda11.8/bin/computeprof "${pkgdir}/opt/cuda11.8/bin/computeprof"
+ mv "${_prepdir}"/opt/cuda11.8/libnvvp "${pkgdir}/opt/cuda11.8"
# licenses
mkdir -p "${pkgdir}/usr/share/licenses"
ln -s /usr/share/licenses/cuda "${pkgdir}/usr/share/licenses/${pkgname}"
}
- build the package with
makepkg
- install it with
sudo pacman -U cuda11.8-11.8.0-1-x86_64.pkg.tar.zst and sudo pacman -U cuda-tools11.8-11.8.0-1-x86_64.pkg.tar.zst
- change the
PATH and CUDA_HOME in your shell so that other softwares use this version:
export PATH="/opt/cuda11.8/bin:$PATH"
export CUDA_HOME="/opt/cuda11.8"