diff options
Diffstat (limited to 'nixpkgs/pkgs/development/cuda-modules/cuda/overrides.nix')
-rw-r--r-- | nixpkgs/pkgs/development/cuda-modules/cuda/overrides.nix | 94 |
1 files changed, 83 insertions, 11 deletions
diff --git a/nixpkgs/pkgs/development/cuda-modules/cuda/overrides.nix b/nixpkgs/pkgs/development/cuda-modules/cuda/overrides.nix index d92e07bb1b0b..d8fab198208c 100644 --- a/nixpkgs/pkgs/development/cuda-modules/cuda/overrides.nix +++ b/nixpkgs/pkgs/development/cuda-modules/cuda/overrides.nix @@ -23,9 +23,9 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) { final.pkgs.rdma-core ]; # Before 11.7 libcufile depends on itself for some reason. - env.autoPatchelfIgnoreMissingDeps = - prevAttrs.env.autoPatchelfIgnoreMissingDeps - + strings.optionalString (cudaVersionOlder "11.7") " libcufile.so.0"; + autoPatchelfIgnoreMissingDeps = + prevAttrs.autoPatchelfIgnoreMissingDeps + ++ lists.optionals (cudaVersionOlder "11.7") [ "libcufile.so.0" ]; } ); @@ -44,6 +44,11 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) { cuda_cudart = prev.cuda_cudart.overrideAttrs ( prevAttrs: { + # Remove once cuda-find-redist-features has a special case for libcuda + outputs = + prevAttrs.outputs + ++ lists.optionals (!(builtins.elem "stubs" prevAttrs.outputs)) [ "stubs" ]; + allowFHSReferences = false; # The libcuda stub's pkg-config doesn't follow the general pattern: @@ -64,15 +69,26 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) { ln -s libcuda.so lib/stubs/libcuda.so.1 fi ''; + + postFixup = + prevAttrs.postFixup or "" + + '' + moveToOutput lib/stubs "$stubs" + ln -s "$stubs"/lib/stubs/* "$stubs"/lib/ + ln -s "$stubs"/lib/stubs "''${!outputLib}/lib/stubs" + ''; } ); cuda_compat = prev.cuda_compat.overrideAttrs ( prevAttrs: { - env.autoPatchelfIgnoreMissingDeps = - prevAttrs.env.autoPatchelfIgnoreMissingDeps + " libnvrm_gpu.so libnvrm_mem.so libnvdla_runtime.so"; + autoPatchelfIgnoreMissingDeps = prevAttrs.autoPatchelfIgnoreMissingDeps ++ [ + "libnvrm_gpu.so" + "libnvrm_mem.so" + "libnvdla_runtime.so" + ]; # `cuda_compat` only works on aarch64-linux, and only when building for Jetson devices. - brokenConditions = prevAttrs.brokenConditions // { + badPlatformsConditions = prevAttrs.badPlatformsConditions // { "Trying to use cuda_compat on aarch64-linux targeting non-Jetson devices" = !final.flags.isJetsonBuild; }; @@ -85,7 +101,20 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) { ); cuda_nvcc = prev.cuda_nvcc.overrideAttrs ( - oldAttrs: { + oldAttrs: + let + # This replicates the logic in stdenvAdapters.useLibsFrom, except we use + # gcc from pkgsHostTarget and not from buildPackages. + ccForLibs-wrapper = final.pkgs.stdenv.cc; + gccMajorVersion = final.nvccCompatibilities.${cudaVersion}.gccMaxMajorVersion; + cc = final.pkgs.wrapCCWith { + cc = final.pkgs."gcc${gccMajorVersion}".cc; + useCcForLibs = true; + gccForLibs = ccForLibs-wrapper.cc; + }; + cxxStdlibDir = ccForLibs-wrapper.cxxStdlib.solib; + in + { outputs = oldAttrs.outputs ++ lists.optionals (!(builtins.elem "lib" oldAttrs.outputs)) [ "lib" ]; @@ -119,8 +148,8 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) { cat << EOF >> bin/nvcc.profile # Fix a compatible backend compiler - PATH += ${lib.getBin final.backendStdenv.cc}/bin: - LIBRARIES += "-L${lib.getLib final.backendStdenv.nixpkgsCompatibleLibstdcxx}/lib" + PATH += ${lib.getBin cc}/bin: + LIBRARIES += "-L${cxxStdlibDir}/lib" # Expose the split-out nvvm LIBRARIES =+ -L''${!outputBin}/nvvm/lib @@ -184,20 +213,63 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) { ); nsight_systems = prev.nsight_systems.overrideAttrs ( - prevAttrs: { - nativeBuildInputs = prevAttrs.nativeBuildInputs ++ [final.pkgs.qt5.wrapQtAppsHook]; + prevAttrs: + let + qt = if lib.versionOlder prevAttrs.version "2022.4.2.1" then final.pkgs.qt5 else final.pkgs.qt6; + qtwayland = + if lib.versions.major qt.qtbase.version == "5" then + lib.getBin qt.qtwayland + else + lib.getLib qt.qtwayland; + qtWaylandPlugins = "${qtwayland}/${qt.qtbase.qtPluginPrefix}"; + in + { + # An ad hoc replacement for + # https://github.com/ConnorBaker/cuda-redist-find-features/issues/11 + env.rmPatterns = toString [ + "nsight-systems/*/*/libQt*" + "nsight-systems/*/*/libstdc*" + "nsight-systems/*/*/libboost*" + "nsight-systems/*/*/lib{ssl,ssh,crypto}*" + "nsight-systems/*/*/lib{arrow,jpeg}*" + "nsight-systems/*/*/Mesa" + "nsight-systems/*/*/python/bin/python" + "nsight-systems/*/*/libexec" + "nsight-systems/*/*/Plugins" + ]; + postPatch = + prevAttrs.postPatch or "" + + '' + for path in $rmPatterns ; do + rm -r "$path" + done + ''; + nativeBuildInputs = prevAttrs.nativeBuildInputs ++ [ qt.wrapQtAppsHook ]; buildInputs = prevAttrs.buildInputs ++ [ + final.cuda_cudart.stubs final.pkgs.alsa-lib + final.pkgs.boost178 final.pkgs.e2fsprogs + final.pkgs.gst_all_1.gst-plugins-base + final.pkgs.gst_all_1.gstreamer final.pkgs.nss final.pkgs.numactl final.pkgs.pulseaudio + final.pkgs.rdma-core + final.pkgs.ucx final.pkgs.wayland final.pkgs.xorg.libXcursor final.pkgs.xorg.libXdamage final.pkgs.xorg.libXrandr final.pkgs.xorg.libXtst + qt.qtbase + (qt.qtdeclarative or qt.full) + (qt.qtsvg or qt.full) + qtWaylandPlugins ]; + + # Older releases require boost 1.70 deprecated in Nixpkgs + meta.broken = prevAttrs.meta.broken or false || lib.versionOlder final.cudaVersion "11.8"; } ); |