File tree Expand file tree Collapse file tree 3 files changed +14
-8
lines changed
pkgs/development/cuda-modules/packages Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 88 cuda_cccl ,
99 lib ,
1010 libnvvm ,
11+ makeBinaryWrapper ,
1112} :
1213buildRedist ( finalAttrs : {
1314 redistName = "cuda" ;
@@ -22,6 +23,10 @@ buildRedist (finalAttrs: {
2223 # The nvcc and cicc binaries contain hard-coded references to /usr
2324 allowFHSReferences = true ;
2425
26+ nativeBuildInputs = [
27+ makeBinaryWrapper
28+ ] ;
29+
2530 # Entries here will be in nativeBuildInputs when cuda_nvcc is in nativeBuildInputs
2631 propagatedBuildInputs = [ setupCudaHook ] ;
2732
@@ -144,13 +149,19 @@ buildRedist (finalAttrs: {
144149 EOF
145150 ''
146151 # Add the dependency on backendStdenv.cc to the nvcc.profile.
152+ # NOTE: NVCC explodes in horrifying fashion if GCC is not on PATH -- it fails even before
153+ # reading nvcc.profile!
147154 + ''
148- nixLog "adding backendStdenv.cc to nvcc.profile"
155+ nixLog "setting compiler-bindir to backendStdenv.cc in nvcc.profile"
149156 cat << EOF >> "'' ${!outputBin:?}/bin/nvcc.profile"
150-
151157 # Fix a compatible backend compiler
152- PATH += " ${ backendStdenv . cc } /bin":
158+ compiler-bindir = ${ backendStdenv . cc } /bin
153159 EOF
160+
161+ nixLog "wrapping nvcc to add backendStdenv.cc to its PATH"
162+ wrapProgramBinary \
163+ "'' ${!outputBin:?}/bin/nvcc" \
164+ --prefix PATH : ${ lib . makeBinPath [ backendStdenv . cc ] }
154165 ''
155166 ) ;
156167
Original file line number Diff line number Diff line change @@ -5,9 +5,6 @@ makeSetupHook {
55
66 substitutions . setupCudaHook = placeholder "out" ;
77
8- # Point NVCC at a compatible compiler
9- substitutions . ccRoot = "${ backendStdenv . cc } " ;
10-
118 # Required in addition to ccRoot as otherwise bin/gcc is looked up
129 # when building CMakeCUDACompilerId.cu
1310 substitutions . ccFullPath = "${ backendStdenv . cc } /bin/${ backendStdenv . cc . targetPrefix } c++" ;
Original file line number Diff line number Diff line change @@ -92,8 +92,6 @@ setupCUDAToolkitCompilers() {
9292 export CUDAHOSTCXX=" @ccFullPath@"
9393 fi
9494
95- appendToVar NVCC_PREPEND_FLAGS " --compiler-bindir=@ccRoot@/bin"
96-
9795 # NOTE: We set -Xfatbin=-compress-all, which reduces the size of the compiled
9896 # binaries. If binaries grow over 2GB, they will fail to link. This is a problem for us, as
9997 # the default set of CUDA capabilities we build can regularly cause this to occur (for
You can’t perform that action at this time.
0 commit comments