File tree 6 files changed +45
-15
lines changed
6 files changed +45
-15
lines changed Original file line number Diff line number Diff line change 29
29
, python3 # FIXME: CUDAToolkit 10 may still need python27
30
30
, pulseaudio
31
31
, requireFile
32
+ , stdenv
32
33
, backendStdenv # E.g. gcc11Stdenv, set in extension.nix
33
34
, unixODBC
34
35
, wayland
@@ -136,8 +137,8 @@ backendStdenv.mkDerivation rec {
136
137
( placeholder "lib" )
137
138
( placeholder "out" )
138
139
"${ placeholder "out" } /nvvm"
139
- # Is it not handled by autoPatchelf automatically?
140
- "${ lib . getLib backendStdenv . cc . cc } /lib64"
140
+ # NOTE: use the same libstdc++ as the rest of nixpkgs, not from backendStdenv
141
+ "${ lib . getLib stdenv . cc . cc } /lib64"
141
142
"${ placeholder "out" } /jre/lib/amd64/jli"
142
143
"${ placeholder "out" } /lib64"
143
144
"${ placeholder "out" } /nvvm/lib64"
@@ -219,6 +220,7 @@ backendStdenv.mkDerivation rec {
219
220
220
221
mv pkg/builds/nsight_systems/target-linux-x64 $out/target-linux-x64
221
222
mv pkg/builds/nsight_systems/host-linux-x64 $out/host-linux-x64
223
+ rm $out/host-linux-x64/libstdc++.so*
222
224
'' }
223
225
${ lib . optionalString ( lib . versionAtLeast version "11.8" )
224
226
# error: auto-patchelf could not satisfy dependency libtiff.so.5 wanted by /nix/store/.......-cudatoolkit-12.0.1/host-linux-x64/Plugins/imageformats/libqtiff.so
Original file line number Diff line number Diff line change @@ -10,11 +10,17 @@ final: prev: let
10
10
finalVersion = cudatoolkitVersions . ${ final . cudaVersion } ;
11
11
12
12
# Exposed as cudaPackages.backendStdenv.
13
- # We don't call it just "stdenv" to avoid confusion: e.g. this toolchain doesn't contain nvcc.
14
- # Instead, it's the back-end toolchain for nvcc to use.
15
- # We also use this to link a compatible libstdc++ (backendStdenv.cc.cc.lib)
13
+ # This is what nvcc uses as a backend,
14
+ # and it has to be an officially supported one (e.g. gcc11 for cuda11).
15
+ #
16
+ # It, however, propagates current stdenv's libstdc++ to avoid "GLIBCXX_* not found errors"
17
+ # when linked with other C++ libraries.
18
+ # E.g. for cudaPackages_11_8 we use gcc11 with gcc12's libstdc++
16
19
# Cf. https://github.com/NixOS/nixpkgs/pull/218265 for context
17
- backendStdenv = prev . pkgs . "${ finalVersion . gcc } Stdenv" ;
20
+ backendStdenv = final . callPackage ./stdenv.nix {
21
+ nixpkgsStdenv = prev . pkgs . stdenv ;
22
+ nvccCompatibleStdenv = prev . pkgs . buildPackages . "${ finalVersion . gcc } Stdenv" ;
23
+ } ;
18
24
19
25
### Add classic cudatoolkit package
20
26
cudatoolkit =
Original file line number Diff line number Diff line change 1
1
{ lib
2
+ , stdenv
2
3
, backendStdenv
3
4
, fetchurl
4
5
, autoPatchelfHook
@@ -30,11 +31,11 @@ backendStdenv.mkDerivation {
30
31
] ;
31
32
32
33
buildInputs = [
33
- # autoPatchelfHook will search for a libstdc++ and we're giving it a
34
- # "compatible" libstdc++ from the same toolchain that NVCC uses.
35
- #
34
+ # autoPatchelfHook will search for a libstdc++ and we're giving it
35
+ # one that is compatible with the rest of nixpkgs, even when
36
+ # nvcc forces us to use an older gcc
36
37
# NB: We don't actually know if this is the right thing to do
37
- backendStdenv . cc . cc . lib
38
+ stdenv . cc . cc . lib
38
39
] ;
39
40
40
41
dontBuild = true ;
Original file line number Diff line number Diff line change
1
+ { nixpkgsStdenv
2
+ , nvccCompatibleStdenv
3
+ , overrideCC
4
+ , wrapCCWith
5
+ } :
6
+
7
+ overrideCC nixpkgsStdenv ( wrapCCWith {
8
+ cc = nvccCompatibleStdenv . cc . cc ;
9
+
10
+ # This option is for clang's libcxx, but we (ab)use it for gcc's libstdc++.
11
+ # Note that libstdc++ maintains forward-compatibility: if we load a newer
12
+ # libstdc++ into the process, we can still use libraries built against an
13
+ # older libstdc++. This, in practice, means that we should use libstdc++ from
14
+ # the same stdenv that the rest of nixpkgs uses.
15
+ # We currently do not try to support anything other than gcc and linux.
16
+ libcxx = nixpkgsStdenv . cc . cc . lib ;
17
+ } )
Original file line number Diff line number Diff line change 1
- {
1
+ { stdenv ,
2
2
backendStdenv ,
3
3
lib ,
4
4
zlib ,
26
26
maxCudaVersion ,
27
27
} :
28
28
assert useCudatoolkitRunfile || ( libcublas != null ) ; let
29
- inherit ( backendStdenv ) cc ;
30
29
inherit ( lib ) lists strings trivial versions ;
31
30
32
31
# majorMinorPatch :: String -> String
63
62
64
63
# Used by autoPatchelfHook
65
64
buildInputs = [
66
- cc . cc . lib # libstdc++
65
+ # Note this libstdc++ isn't from the (possibly older) nvcc-compatible
66
+ # stdenv, but from the (newer) stdenv that the rest of nixpkgs uses
67
+ stdenv . cc . cc . lib
68
+
67
69
zlib
68
70
cudatoolkit_root
69
71
] ;
Original file line number Diff line number Diff line change 25
25
builtins . head optLevels
26
26
, faiss # To run demos in the tests
27
27
, runCommand
28
- } :
28
+ } @ inputs :
29
29
30
30
assert cudaSupport -> nvidia-thrust . cudaSupport ;
31
31
32
32
let
33
33
pname = "faiss" ;
34
34
version = "1.7.2" ;
35
35
36
- inherit ( cudaPackages ) cudaFlags ;
36
+ inherit ( cudaPackages ) cudaFlags backendStdenv ;
37
37
inherit ( cudaFlags ) cudaCapabilities dropDot ;
38
38
39
+ stdenv = if cudaSupport then backendStdenv else inputs . stdenv ;
40
+
39
41
cudaJoined = symlinkJoin {
40
42
name = "cuda-packages-unsplit" ;
41
43
paths = with cudaPackages ; [
You can’t perform that action at this time.
0 commit comments