diff options
Diffstat (limited to 'pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh')
-rw-r--r-- | pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh b/pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh index a4a444fcd241..6e57c7b1072e 100644 --- a/pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh +++ b/pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh @@ -9,7 +9,7 @@ reason= [[ -n ${cudaSetupHookOnce-} ]] && guard=Skipping && reason=" because the hook has been propagated more than once" if (( "${NIX_DEBUG:-0}" >= 1 )) ; then - echo "$guard hostOffset=$hostOffset targetOffset=$targetOffset setupCudaHook$reason" >&2 + echo "$guard hostOffset=$hostOffset targetOffset=$targetOffset setup-cuda-hook$reason" >&2 else echo "$guard setup-cuda-hook$reason" >&2 fi @@ -24,16 +24,19 @@ extendcudaHostPathsSeen() { (( "${NIX_DEBUG:-0}" >= 1 )) && echo "extendcudaHostPathsSeen $1" >&2 local markerPath="$1/nix-support/include-in-cudatoolkit-root" - [[ ! -f "${markerPath}" ]] && return - [[ -v cudaHostPathsSeen[$1] ]] && return + [[ ! -f "${markerPath}" ]] && return 0 + [[ -v cudaHostPathsSeen[$1] ]] && return 0 cudaHostPathsSeen["$1"]=1 # E.g. cuda_cudart-lib local cudaOutputName - read -r cudaOutputName < "$markerPath" + # Fail gracefully if the file is empty. + # One reason the file may be empty: the package was built with strictDeps set, but the current build does not have + # strictDeps set. + read -r cudaOutputName < "$markerPath" || return 0 - [[ -z "$cudaOutputName" ]] && return + [[ -z "$cudaOutputName" ]] && return 0 local oldPath="${cudaOutputToPath[$cudaOutputName]-}" [[ -n "$oldPath" ]] && echo "extendcudaHostPathsSeen: warning: overwriting $cudaOutputName from $oldPath to $1" >&2 @@ -59,7 +62,7 @@ setupCUDAToolkitCompilers() { echo Executing setupCUDAToolkitCompilers >&2 if [[ -n "${dontSetupCUDAToolkitCompilers-}" ]] ; then - return + return 0 fi # Point NVCC at a compatible compiler @@ -99,7 +102,7 @@ preConfigureHooks+=(setupCUDAToolkitCompilers) propagateCudaLibraries() { (( "${NIX_DEBUG:-0}" >= 1 )) && echo "propagateCudaLibraries: cudaPropagateToOutput=$cudaPropagateToOutput cudaHostPathsSeen=${!cudaHostPathsSeen[*]}" >&2 - [[ -z "${cudaPropagateToOutput-}" ]] && return + [[ -z "${cudaPropagateToOutput-}" ]] && return 0 mkdir -p "${!cudaPropagateToOutput}/nix-support" # One'd expect this should be propagated-bulid-build-deps, but that doesn't seem to work |