Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[24.05] cudnn: Fix referring to deprecated alias #335400

Merged

Conversation

nh2
Copy link
Contributor

@nh2 nh2 commented Aug 17, 2024

Similar to commit

ae5074ef cudaPackages: fix an annoying warning caused by alias

CC @wrvsrx @niklaskorz @drupol from #316594

Can be verified with:

NIX_ABORT_ON_WARN=true NIXPKGS_ALLOW_UNFREE=1 NIX_PATH=nixpkgs=. nix-instantiate -A cudaPackages.cudnn

Without this change, it prints

trace: warning: cudaPackages.autoAddDriverRunpath is deprecated, use pkgs.autoAddDriverRunpath instead

for cudnn and any package that depends on it.

Not necessary on master because commit bb429ba already removed the alias in PR:

Things done


Add a 👍 reaction to pull requests you find important.

Similar to commit

    ae5074e cudaPackages: fix an annoying warning caused by alias

Can be verified with:

    NIX_ABORT_ON_WARN=true NIXPKGS_ALLOW_UNFREE=1 NIX_PATH=nixpkgs=. nix-instantiate -A cudaPackages.cudnn
@nh2 nh2 requested review from drupol and niklaskorz August 17, 2024 15:26
@nh2 nh2 self-assigned this Aug 17, 2024
@nh2
Copy link
Contributor Author

nh2 commented Aug 17, 2024

Taking this also as an opportunity to show how very useless nix's --show-trace is here:

The relevant file that needed to be changed appears nowhere in the stack trace, nor did cudnn (at least it was mentioned in of the derivation 'cudnn-8.9.7.29', but that one's nativeBuildInputs are also to be found in a file that doesn't appear in the trace, namely pkgs/development/cuda-modules/generic-builders/manifest.nix).

# NIX_ABORT_ON_WARN=true NIXPKGS_ALLOW_UNFREE=1 NIX_PATH=nixpkgs=. nix-instantiate -A cudaPackages.cudnn --show-trace
trace: warning: cudaPackages.autoAddDriverRunpath is deprecated, use pkgs.autoAddDriverRunpath instead
error:
       … while evaluating the attribute 'nativeBuildInputs' of the derivation 'cudnn-8.9.7.29'

       at /root/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:333:7:

          332|     // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          333|       name =
             |       ^
          334|         let

       … while evaluating call site

       at «none»:0: (source not available)

       … while calling anonymous lambda

       at /root/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:304:13:

          303|       (map (drv: getDev drv.__spliced.buildBuild or drv) (checkDependencyList "depsBuildBuild" depsBuildBuild))
          304|       (map (drv: getDev drv.__spliced.buildHost or drv) (checkDependencyList "nativeBuildInputs" nativeBuildInputs'))
             |             ^
          305|       (map (drv: getDev drv.__spliced.buildTarget or drv) (checkDependencyList "depsBuildTarget" depsBuildTarget))

       … while evaluating call site

       at /root/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:304:18:

          303|       (map (drv: getDev drv.__spliced.buildBuild or drv) (checkDependencyList "depsBuildBuild" depsBuildBuild))
          304|       (map (drv: getDev drv.__spliced.buildHost or drv) (checkDependencyList "nativeBuildInputs" nativeBuildInputs'))
             |                  ^
          305|       (map (drv: getDev drv.__spliced.buildTarget or drv) (checkDependencyList "depsBuildTarget" depsBuildTarget))

       … while calling 'getOutput'

       at /root/src/nixpkgs/lib/attrsets.nix:1796:23:

         1795|   */
         1796|   getOutput = output: pkg:
             |                       ^
         1797|     if ! pkg ? outputSpecified || ! pkg.outputSpecified

       … while evaluating call site

       at «none»:0: (source not available)

       … while calling anonymous lambda

       at /root/src/nixpkgs/lib/lists.nix:334:29:

          333|   */
          334|   imap1 = f: list: genList (n: f (n + 1) (elemAt list n)) (length list);
             |                             ^
          335|

       … while evaluating call site

       at /root/src/nixpkgs/lib/lists.nix:334:32:

          333|   */
          334|   imap1 = f: list: genList (n: f (n + 1) (elemAt list n)) (length list);
             |                                ^
          335|

       … while calling anonymous lambda

       at /root/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:278:15:

          277|     imap1
          278|       (index: dep:
             |               ^
          279|         if isDerivation dep || dep == null || builtins.isString dep || builtins.isPath dep then dep

       … while evaluating call site

       at /root/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:279:12:

          278|       (index: dep:
          279|         if isDerivation dep || dep == null || builtins.isString dep || builtins.isPath dep then dep
             |            ^
          280|         else if isList dep then checkDependencyList' ([index] ++ positions) name dep

       … while calling 'isDerivation'

       at /root/src/nixpkgs/lib/attrsets.nix:1283:5:

         1282|   isDerivation =
         1283|     value: value.type or null == "derivation";
             |     ^
         1284|

       … while evaluating call site

       at /root/src/nixpkgs/pkgs/development/cuda-modules/aliases.nix:13:5:

           12|   autoAddDriverRunpath =
           13|     mkRenamed "autoAddDriverRunpath" "pkgs.autoAddDriverRunpath"
             |     ^
           14|       final.pkgs.autoAddDriverRunpath; # Added 2024-03-30

       … while calling 'mkRenamed'

       at /root/src/nixpkgs/pkgs/development/cuda-modules/aliases.nix:5:23:

            4|   mkRenamed =
            5|     oldName: newName: newPkg:
             |                       ^
            6|     final.lib.warn "cudaPackages.${oldName} is deprecated, use ${newName} instead" newPkg;

       … while evaluating call site

       at /root/src/nixpkgs/pkgs/development/cuda-modules/aliases.nix:6:5:

            5|     oldName: newName: newPkg:
            6|     final.lib.warn "cudaPackages.${oldName} is deprecated, use ${newName} instead" newPkg;
             |     ^
            7| in

       … while calling anonymous lambda

       at /root/src/nixpkgs/lib/trivial.nix:702:10:

          701|     if lib.elem (builtins.getEnv "NIX_ABORT_ON_WARN") ["1" "true" "yes"]
          702|     then msg: builtins.trace "warning: ${msg}" (abort "NIX_ABORT_ON_WARN=true; warnings are treated as unrecoverable errors.")
             |          ^
          703|     else msg: builtins.trace "warning: ${msg}";

       error: evaluation aborted with the following error message: 'NIX_ABORT_ON_WARN=true; warnings are treated as unrecoverable errors.'

@nh2 nh2 mentioned this pull request Aug 17, 2024
13 tasks
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Aug 17, 2024
@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Aug 20, 2024
@@ -127,6 +127,8 @@ let
inherit pname;
redistName = pname;
inherit (shims) redistribRelease featureRelease;
# get `autoAddDriverRunpath` from pkgs instead of cudaPackages' alias to avoid warning
inherit (final.callPackage ({ pkgs }: pkgs) { }) autoAddDriverRunpath;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why such an indirect way to refer to pkgs.autoAddDriverRunpath?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copied it from ae5074e

@wrvsrx Can you explain why you did it this way in that commit?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this file doesn't get pkgs from outside, so I get pkgs via callPackage

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good enough for me for 24.05, given that this whole thing is no longer necessary for 24.11.

@SomeoneSerge Good to merge?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for blacking out, yes it's alright

@nh2
Copy link
Contributor Author

nh2 commented Oct 8, 2024

Merging as ofborg shows no rebuilds as expected.

@nh2 nh2 merged commit 9a8e772 into NixOS:release-24.05 Oct 8, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux 12.approvals: 1 This PR was reviewed and approved by one reputable person
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants