build(packaging/Arch): fix cuda gcc version detection (#4442)

This commit is contained in:
Garmelon 2025-11-24 03:51:15 +01:00 committed by GitHub
commit fe07501820
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -134,10 +134,14 @@ build() {
# 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')"
_cuda_gcc_version="$(LC_ALL=C pacman -Si cuda | grep -Pom1 '^Depends On\s*:.*\bgcc\K[0-9]+\b' || true)"
export CUDA_PATH=/opt/cuda
export NVCC_CCBIN="/usr/bin/g++-${_cuda_gcc_version}"
if [ -n "$_cuda_gcc_version" ]; then
export NVCC_CCBIN="/usr/bin/g++-${_cuda_gcc_version}"
else
export NVCC_CCBIN="/usr/bin/g++"
fi
fi
fi