From 19babad080d08bfef8bfb641a1981dfc4dcff6e5 Mon Sep 17 00:00:00 2001 From: Andrew Moore Date: Sun, 14 Sep 2025 13:42:58 +0930 Subject: [PATCH] fix(packaging/Arch): do not fail if cuda was freshly installed (#4257) --- packaging/linux/Arch/PKGBUILD | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packaging/linux/Arch/PKGBUILD b/packaging/linux/Arch/PKGBUILD index 3fa2fe0e..4d1238fe 100644 --- a/packaging/linux/Arch/PKGBUILD +++ b/packaging/linux/Arch/PKGBUILD @@ -130,6 +130,16 @@ build() { if [[ "${_use_cuda::1}" != "t" ]]; then _cmake_options+=(-DSUNSHINE_ENABLE_CUDA=OFF -DCUDA_FAIL_ON_MISSING=OFF) + else + # If cuda has just been installed, its variables will not be available in the environment + # therefore, set them manually to the expected values on Arch Linux + if [ -z "${CUDA_PATH:-}" ] && pacman -Qi cuda &> /dev/null; then + local _cuda_gcc_version + _cuda_gcc_version="$(LC_ALL=C pacman -Si cuda | grep -Pom1 '^Depends On\s*:.*\bgcc\K[0-9]+\b')" + + export CUDA_PATH=/opt/cuda + export NVCC_CCBIN="/usr/bin/g++-${_cuda_gcc_version}" + fi fi if [[ "${_run_unit_tests::1}" != "t" ]]; then