Skip to content

llvmPackages.libc: fix infinite recursion#375330

Open
RossComputerGuy wants to merge 2 commits intoNixOS:masterfrom
RossComputerGuy:fix/pkgsllvmlibc
Open

llvmPackages.libc: fix infinite recursion#375330
RossComputerGuy wants to merge 2 commits intoNixOS:masterfrom
RossComputerGuy:fix/pkgsllvmlibc

Conversation

@RossComputerGuy
Copy link
Member

Things done

Fix nix-community/infra#1676, still need to fix which comes from curl which comes from cmake:

       … in the right operand of the AND (&&) operator
         at /nix/store/85v74j29midz064radxs2kcr1xzzgbq9-source/pkgs/development/libraries/openssl/default.nix:101:82:
          100|       separateDebugInfo =
          101|         !stdenv.hostPlatform.isDarwin && !(stdenv.hostPlatform.useLLVM or false) && stdenv.cc.isGNU;
             |                                                                                  ^
          102|

       … while evaluating the attribute 'cc.isGNU'
         at /nix/store/85v74j29midz064radxs2kcr1xzzgbq9-source/pkgs/stdenv/generic/default.nix:208:15:
          207|
          208|       inherit cc hasCC;
             |               ^
          209|

       error: infinite recursion encountered
       at /nix/store/85v74j29midz064radxs2kcr1xzzgbq9-source/pkgs/development/libraries/openssl/default.nix:101:85:
          100|       separateDebugInfo =
          101|         !stdenv.hostPlatform.isDarwin && !(stdenv.hostPlatform.useLLVM or false) && stdenv.cc.isGNU;
             |                                                                                     ^
          102
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 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 Jan 20, 2025
@infinisil
Copy link
Member

How to reproduce the failure? llvmPackages.libc doesn't exist, and llvmPackages_git.libc doesn't inf rec.

@RossComputerGuy
Copy link
Member Author

How to reproduce the failure?

Very reproducible in pkgsLLVMLibc.stdenv.

@RossComputerGuy
Copy link
Member Author

This PR + #365057 and this patch applied has the effect of fixing the problem:

diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index f6022fb2258a..96babb27e2b1 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -99,7 +99,7 @@ let
       setOutputFlags = false;
       separateDebugInfo =
         # Using "cc.isClang" causes infinite recursion.
-        !stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.cc != "clang" && stdenv.cc.isGNU;
+        !stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.cc != "clang" && stdenv.hostPlatform.cc != "gcc";
 
       nativeBuildInputs =
         lib.optional (!stdenv.hostPlatform.isWindows) makeBinaryWrapper
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e8d96d53214a..e429b6730338 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -9051,18 +9051,18 @@ with pkgs;
   glibcLocales =
     if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isGnu
     then callPackage ../development/libraries/glibc/locales.nix {
-      stdenv = if (!stdenv.cc.isGNU) then
+      stdenv = if (stdenv.hostPlatform.cc != "gcc") then
         gccStdenv
       else stdenv;
-      withLinuxHeaders = !stdenv.cc.isGNU;
+      withLinuxHeaders = stdenv.hostPlatform.cc != "gcc";
     } else null;
   glibcLocalesUtf8 =
     if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isGnu
     then callPackage ../development/libraries/glibc/locales.nix {
-      stdenv = if (!stdenv.cc.isGNU) then
+      stdenv = if (stdenv.hostPlatform.cc != "gcc") then
         gccStdenv
       else stdenv;
-      withLinuxHeaders = !stdenv.cc.isGNU;
+      withLinuxHeaders = stdenv.hostPlatform.cc != "gcc";
       allLocales = false;
     } else null;

@zowoq
Copy link
Contributor

zowoq commented Jan 21, 2025

This PR + #365057 and this patch applied has the effect of fixing the problem:

Is all of this actually able to be merged soon? If not I'd rather revert the original PR breakage so I can turn the update bot back on.

@RossComputerGuy
Copy link
Member Author

Is all of this actually able to be merged soon?

I'm expecting it to be soon, there's been discussions on Matrix on further action which I did complete just like an hour ago. Just need reviews.

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Feb 15, 2025
@wolfgangwalther
Copy link
Contributor

It seems like #381065 was supposed to work around this, but maintainers/scripts/rebuild-amount.sh has been broken for a few months now with the infinite recursion error mentioned here.

Is there a real fix anywhere in sight? I'd really like to use the rebuild-amount script again.

@RossComputerGuy
Copy link
Member Author

What's the stack trace? That PR worked around it so pkgsLLVM.pkgsLLVMLibc.stdenv evals. I think I have an idea why pkgsLLVMLibc.stdenv itself is failing and it's the same reason why I had to add isClang = true. It's a kinda hacky workaround that #365057 would provide a pathway to a proper fix.

@wolfgangwalther
Copy link
Contributor

What's the stack trace?

Here it is:

Details
error:
       … from call site
         at /tmp/nix-rebuild-amount-nEIx4iq5:13:14:
           12|           tweak = lib.mapAttrs
           13|             (name: val:
             |              ^
           14|               if name == "recurseForDerivations" then true

       … while calling anonymous lambda
         at /tmp/nix-rebuild-amount-nEIx4iq5:13:20:
           12|           tweak = lib.mapAttrs
           13|             (name: val:
             |                    ^
           14|               if name == "recurseForDerivations" then true

       … while evaluating a branch condition
         at /tmp/nix-rebuild-amount-nEIx4iq5:15:20:
           14|               if name == "recurseForDerivations" then true
           15|               else if lib.isAttrs val && val.type or null != "derivation"
             |                    ^
           16|                       then recurseIntoAttrs (tweak val)

       … in the left operand of the AND (&&) operator
         at /tmp/nix-rebuild-amount-nEIx4iq5:15:39:
           14|               if name == "recurseForDerivations" then true
           15|               else if lib.isAttrs val && val.type or null != "derivation"
             |                                       ^
           16|                       then recurseIntoAttrs (tweak val)

       … while calling the 'isAttrs' builtin
         at /tmp/nix-rebuild-amount-nEIx4iq5:15:23:
           14|               if name == "recurseForDerivations" then true
           15|               else if lib.isAttrs val && val.type or null != "derivation"
             |                       ^
           16|                       then recurseIntoAttrs (tweak val)

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/attrsets.nix:1219:62:
         1218|   */
         1219|   genAttrs = names: f: listToAttrs (map (n: nameValuePair n (f n)) names);
             |                                                              ^
         1220|

       … while calling anonymous lambda
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/release-lib.nix:183:38:
          182|     crossSystem: metaPatterns: f:
          183|     forMatchingSystems metaPatterns (system: hydraJob' (f (pkgsForCross crossSystem system)));
             |                                      ^
          184|

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/release-lib.nix:183:46:
          182|     crossSystem: metaPatterns: f:
          183|     forMatchingSystems metaPatterns (system: hydraJob' (f (pkgsForCross crossSystem system)));
             |                                              ^
          184|

       … while calling 'hydraJob'
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:445:5:
          444|   hydraJob =
          445|     drv:
             |     ^
          446|     let

       … while calling the 'deepSeq' builtin
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:479:35:
          478|     in
          479|     if drv == null then null else deepSeq drv' drv';
             |                                   ^
          480|

       … while evaluating the attribute 'outPath'
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:468:13:
          467|           value = commonAttrs // {
          468|             outPath = output.outPath;
             |             ^
          469|             drvPath = output.drvPath;

       … while calling the 'getAttr' builtin
         at /builtin/derivation.nix:1:500:
       … while calling the 'derivationStrict' builtin
         at /builtin/derivation.nix:1:208:
       … while evaluating derivation 'stdenv-linux'
         whose name attribute is located at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/default.nix:105:17

       … while evaluating attribute 'defaultNativeBuildInputs' of derivation 'stdenv-linux'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/default.nix:151:11:
          150|           shell
          151|           defaultNativeBuildInputs
             |           ^
          152|           defaultBuildInputs

       … while evaluating the attribute 'gcc'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/all-packages.nix:6017:3:
         6016|   default-gcc-version = 14;
         6017|   gcc = pkgs.${"gcc${toString default-gcc-version}"};
             |   ^
         6018|   gccFun = callPackage ../development/compilers/gcc;

       … while evaluating the attribute 'gcc14'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/all-packages.nix:6166:5:
         6165|     gcc13
         6166|     gcc14
             |     ^
         6167|     ;

       … while evaluating the attribute 'gcc14'
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/attrsets.nix:977:47:
          976|   */
          977|   nameValuePair = name: value: { inherit name value; };
             |                                               ^
          978|

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/development/compilers/gcc/all.nix:22:13:
           21|       attrName = "gcc${lib.replaceStrings [ "." ] [ "" ] majorMinorVersion}";
           22|       pkg = lowPrio (
             |             ^
           23|         wrapCC (

       … while calling 'addMetaAttrs'
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/meta.nix:47:28:
           46|   */
           47|   addMetaAttrs = newAttrs: drv: drv // { meta = (drv.meta or { }) // newAttrs; };
             |                            ^
           48|

       … in the left operand of the update (//) operator
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/meta.nix:47:37:
           46|   */
           47|   addMetaAttrs = newAttrs: drv: drv // { meta = (drv.meta or { }) // newAttrs; };
             |                                     ^
           48|

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/development/compilers/gcc/all.nix:23:9:
           22|       pkg = lowPrio (
           23|         wrapCC (
             |         ^
           24|           callPackage ./default.nix {

       … while calling 'wrapCC'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/all-packages.nix:7215:5:
         7214|   wrapCC =
         7215|     cc:
             |     ^
         7216|     wrapCCWith {

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/all-packages.nix:7216:5:
         7215|     cc:
         7216|     wrapCCWith {
             |     ^
         7217|       inherit cc;

       … while calling 'wrapCCWith'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/all-packages.nix:7165:5:
         7164|   wrapCCWith =
         7165|     {
             |     ^
         7166|       cc,

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/all-packages.nix:7187:5:
         7186|     }@extraArgs:
         7187|     callPackage ../build-support/cc-wrapper (
             |     ^
         7188|       let

       … while calling 'callPackageWith'
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:240:19:
          239|   callPackageWith =
          240|     autoArgs: fn: args:
             |                   ^
          241|     let

       … while calling a functor (an attribute set with a '__functor' attribute)
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:306:7:
          305|     if missingArgs == { } then
          306|       makeOverridable f allArgs
             |       ^
          307|     # This needs to be an abort so it can't be caught with `builtins.tryEval`,

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/trivial.nix:989:5:
          988|     # TODO: Should we add call-time "type" checking like built in?
          989|     __functor = self: f;
             |     ^
          990|     __functionArgs = args;

       … while calling anonymous lambda
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:161:7:
          160|     mirrorArgs (
          161|       origArgs:
             |       ^
          162|       let

       … while evaluating a branch condition
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:173:7:
          172|       in
          173|       if isAttrs result then
             |       ^
          174|         result

       … while calling the 'isAttrs' builtin
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:173:10:
          172|       in
          173|       if isAttrs result then
             |          ^
          174|         result

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:163:18:
          162|       let
          163|         result = f origArgs;
             |                  ^
          164|

       … while calling anonymous lambda
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/build-support/cc-wrapper/default.nix:8:1:
            7|
            8| {
             | ^
            9|   name ? "",

       … in the condition of the assert statement
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/build-support/cc-wrapper/default.nix:345:1:
          344| # Ensure bintools matches
          345| assert libc_bin == bintools.libc_bin;
             | ^
          346| assert libc_dev == bintools.libc_dev;

       … while calling the 'getAttr' builtin
         at /builtin/derivation.nix:1:500:
       … while calling the 'derivationStrict' builtin
         at /builtin/derivation.nix:1:208:
       … while evaluating derivation 'libc-x86_64-unknown-linux-llvm-20.1.2'
         whose name attribute is located at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/make-derivation.nix:438:13

       … while evaluating attribute 'nativeBuildInputs' of derivation 'libc-x86_64-unknown-linux-llvm-20.1.2'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/make-derivation.nix:490:13:
          489|             depsBuildBuild = elemAt (elemAt dependencies 0) 0;
          490|             nativeBuildInputs = elemAt (elemAt dependencies 0) 1;
             |             ^
          491|             depsBuildTarget = elemAt (elemAt dependencies 0) 2;

       … while calling the 'getAttr' builtin
         at /builtin/derivation.nix:1:500:
       … while calling the 'derivationStrict' builtin
         at /builtin/derivation.nix:1:208:
       … while evaluating derivation 'cmake-3.31.5'
         whose name attribute is located at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/make-derivation.nix:438:13

       … while evaluating attribute 'buildInputs' of derivation 'cmake-3.31.5'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/make-derivation.nix:493:13:
          492|             depsHostHost = elemAt (elemAt dependencies 1) 0;
          493|             buildInputs = elemAt (elemAt dependencies 1) 1;
             |             ^
          494|             depsTargetTarget = elemAt (elemAt dependencies 2) 0;

       … while calling the 'getAttr' builtin
         at /builtin/derivation.nix:1:500:
       … while calling the 'derivationStrict' builtin
         at /builtin/derivation.nix:1:208:
       … while evaluating derivation 'curl-8.12.1'
         whose name attribute is located at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/make-derivation.nix:438:13

       … while evaluating attribute 'configureFlags' of derivation 'curl-8.12.1'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/make-derivation.nix:504:13:
          503|             # This parameter is sometimes a string, sometimes null, and sometimes a list, yuck
          504|             configureFlags =
             |             ^
          505|               configureFlags

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/by-name/cu/curlMinimal/package.nix:197:8:
          196|       (lib.withFeatureAs idnSupport "libidn2" (lib.getDev libidn2))
          197|       (lib.withFeatureAs opensslSupport "openssl" (lib.getDev openssl'))
             |        ^
          198|       (lib.withFeatureAs scpSupport "libssh2" (lib.getDev libssh2))

       … while calling 'withFeatureAs'
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/strings.nix:2248:20:
         2247|   withFeatureAs =
         2248|     flag: feature: value:
             |                    ^
         2249|     withFeature flag feature + optionalString flag "=${value}";

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/strings.nix:2249:32:
         2248|     flag: feature: value:
         2249|     withFeature flag feature + optionalString flag "=${value}";
             |                                ^
         2250|

       … while calling 'optionalString'
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/strings.nix:701:26:
          700|   */
          701|   optionalString = cond: string: if cond then string else "";
             |                          ^
          702|

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/by-name/cu/curlMinimal/package.nix:197:52:
          196|       (lib.withFeatureAs idnSupport "libidn2" (lib.getDev libidn2))
          197|       (lib.withFeatureAs opensslSupport "openssl" (lib.getDev openssl'))
             |                                                    ^
          198|       (lib.withFeatureAs scpSupport "libssh2" (lib.getDev libssh2))

       … while calling 'getOutput'
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/attrsets.nix:1745:13:
         1744|   getOutput =
         1745|     output: pkg:
             |             ^
         1746|     if !pkg ? outputSpecified || !pkg.outputSpecified then pkg.${output} or pkg.out or pkg else pkg;

       … while evaluating a branch condition
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/attrsets.nix:1746:5:
         1745|     output: pkg:
         1746|     if !pkg ? outputSpecified || !pkg.outputSpecified then pkg.${output} or pkg.out or pkg else pkg;
             |     ^
         1747|

       … in the left operand of the OR (||) operator
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/attrsets.nix:1746:31:
         1745|     output: pkg:
         1746|     if !pkg ? outputSpecified || !pkg.outputSpecified then pkg.${output} or pkg.out or pkg else pkg;
             |                               ^
         1747|

       … in the argument of the not operator
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/attrsets.nix:1746:9:
         1745|     output: pkg:
         1746|     if !pkg ? outputSpecified || !pkg.outputSpecified then pkg.${output} or pkg.out or pkg else pkg;
             |         ^
         1747|

       … in the right operand of the update (//) operator
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:79:13:
           78|             augmentedValue
           79|             // spliceReal {
             |             ^
           80|               pkgsBuildBuild = tryGetOutputs valueBuildBuild;

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:79:16:
           78|             augmentedValue
           79|             // spliceReal {
             |                ^
           80|               pkgsBuildBuild = tryGetOutputs valueBuildBuild;

       … while calling 'spliceReal'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:22:5:
           21|   spliceReal =
           22|     {
             |     ^
           23|       pkgsBuildBuild,

       … while calling the 'listToAttrs' builtin
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:103:5:
          102|     in
          103|     lib.listToAttrs (map merge (lib.attrNames mash));
             |     ^
          104|

       … while calling the 'map' builtin
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:103:22:
          102|     in
          103|     lib.listToAttrs (map merge (lib.attrNames mash));
             |                      ^
          104|

       … while calling the 'attrNames' builtin
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:103:33:
          102|     in
          103|     lib.listToAttrs (map merge (lib.attrNames mash));
             |                                 ^
          104|

       … in the right operand of the update (//) operator
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:34:9:
           33|         pkgsBuildBuild
           34|         // pkgsBuildTarget
             |         ^
           35|         // pkgsHostHost

       … in the right operand of the update (//) operator
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:35:9:
           34|         // pkgsBuildTarget
           35|         // pkgsHostHost
             |         ^
           36|         // pkgsTargetTarget

       … in the right operand of the update (//) operator
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:36:9:
           35|         // pkgsHostHost
           36|         // pkgsTargetTarget
             |         ^
           37|         # The same pkgs sets one probably intends

       … in the left operand of the update (//) operator
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:38:9:
           37|         # The same pkgs sets one probably intends
           38|         // pkgsBuildHost
             |         ^
           39|         // pkgsHostTarget;

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:85:34:
           84|               pkgsHostTarget = getOutputs valueHostTarget;
           85|               pkgsTargetTarget = tryGetOutputs valueTargetTarget;
             |                                  ^
           86|               # Just recur on plain attrsets

       … while calling 'tryGetOutputs'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:67:15:
           66|             tryGetOutputs =
           67|               value0:
             |               ^
           68|               let

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:71:15:
           70|               in
           71|               getOutputs (lib.optionalAttrs success value);
             |               ^
           72|             getOutputs =

       … while calling 'getOutputs'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:73:15:
           72|             getOutputs =
           73|               value: lib.genAttrs (value.outputs or (lib.optional (value ? out) "out")) (output: value.${output});
             |               ^
           74|           in

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:73:22:
           72|             getOutputs =
           73|               value: lib.genAttrs (value.outputs or (lib.optional (value ? out) "out")) (output: value.${output});
             |                      ^
           74|           in

       … while calling 'genAttrs'
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/attrsets.nix:1219:21:
         1218|   */
         1219|   genAttrs = names: f: listToAttrs (map (n: nameValuePair n (f n)) names);
             |                     ^
         1220|

       … while calling the 'listToAttrs' builtin
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/attrsets.nix:1219:24:
         1218|   */
         1219|   genAttrs = names: f: listToAttrs (map (n: nameValuePair n (f n)) names);
             |                        ^
         1220|

       … while calling the 'map' builtin
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/attrsets.nix:1219:37:
         1218|   */
         1219|   genAttrs = names: f: listToAttrs (map (n: nameValuePair n (f n)) names);
             |                                     ^
         1220|

       … while evaluating 'value' to select 'outputs' on it
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:73:36:
           72|             getOutputs =
           73|               value: lib.genAttrs (value.outputs or (lib.optional (value ? out) "out")) (output: value.${output});
             |                                    ^
           74|           in

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:71:27:
           70|               in
           71|               getOutputs (lib.optionalAttrs success value);
             |                           ^
           72|             getOutputs =

       … while calling 'optionalAttrs'
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/attrsets.nix:1316:25:
         1315|   */
         1316|   optionalAttrs = cond: as: if cond then as else { };
             |                         ^
         1317|

       … while evaluating a branch condition
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/attrsets.nix:1316:29:
         1315|   */
         1316|   optionalAttrs = cond: as: if cond then as else { };
             |                             ^
         1317|

       … while evaluating '(/* expanded inherit (expr) */ ((builtins).tryEval value0))' to select 'success' on it
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:69:51:
           68|               let
           69|                 inherit (builtins.tryEval value0) success value;
             |                                                   ^
           70|               in

       … while calling the 'tryEval' builtin
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/splice.nix:69:26:
           68|               let
           69|                 inherit (builtins.tryEval value0) success value;
             |                          ^
           70|               in

       … while evaluating the attribute 'openssl'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/all-packages.nix:10874:3:
        10873|
        10874|   openssl = openssl_3_4;
             |   ^
        10875|

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/top-level/all-packages.nix:10883:5:
        10882|     openssl_3
        10883|     openssl_3_4
             |     ^
        10884|     ;

       … while calling 'mkAttrOverridable'
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:347:33:
          346|       pkgs = f origArgs;
          347|       mkAttrOverridable = name: _: makeOverridable (mirrorArgs (newArgs: (f newArgs).${name})) origArgs;
             |                                 ^
          348|     in

       … while calling a functor (an attribute set with a '__functor' attribute)
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:347:36:
          346|       pkgs = f origArgs;
          347|       mkAttrOverridable = name: _: makeOverridable (mirrorArgs (newArgs: (f newArgs).${name})) origArgs;
             |                                    ^
          348|     in

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/trivial.nix:989:5:
          988|     # TODO: Should we add call-time "type" checking like built in?
          989|     __functor = self: f;
             |     ^
          990|     __functionArgs = args;

       … while calling anonymous lambda
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:161:7:
          160|     mirrorArgs (
          161|       origArgs:
             |       ^
          162|       let

       … while evaluating a branch condition
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:173:7:
          172|       in
          173|       if isAttrs result then
             |       ^
          174|         result

       … while calling the 'isAttrs' builtin
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:173:10:
          172|       in
          173|       if isAttrs result then
             |          ^
          174|         result

       … while calling a functor (an attribute set with a '__functor' attribute)
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:163:18:
          162|       let
          163|         result = f origArgs;
             |                  ^
          164|

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/trivial.nix:989:5:
          988|     # TODO: Should we add call-time "type" checking like built in?
          989|     __functor = self: f;
             |     ^
          990|     __functionArgs = args;

       … while calling anonymous lambda
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:347:65:
          346|       pkgs = f origArgs;
          347|       mkAttrOverridable = name: _: makeOverridable (mirrorArgs (newArgs: (f newArgs).${name})) origArgs;
             |                                                                 ^
          348|     in

       … while evaluating the attribute 'openssl_3_4'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/development/libraries/openssl/default.nix:369:3:
          368|
          369|   openssl_3_4 = common {
             |   ^
          370|     version = "3.4.1";

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/development/libraries/openssl/default.nix:369:17:
          368|
          369|   openssl_3_4 = common {
             |                 ^
          370|     version = "3.4.1";

       … while calling 'common'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/development/libraries/openssl/default.nix:32:5:
           31|   common =
           32|     {
             |     ^
           33|       version,

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/development/libraries/openssl/default.nix:39:5:
           38|     }:
           39|     stdenv.mkDerivation (finalAttrs: {
             |     ^
           40|       pname = "openssl";

       … while calling 'mkDerivation'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/make-derivation.nix:65:5:
           64|   mkDerivation =
           65|     fnOrAttrs:
             |     ^
           66|     if builtins.isFunction fnOrAttrs then

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/make-derivation.nix:67:7:
           66|     if builtins.isFunction fnOrAttrs then
           67|       makeDerivationExtensible fnOrAttrs
             |       ^
           68|     else

       … while calling 'makeDerivationExtensible'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/make-derivation.nix:80:5:
           79|   makeDerivationExtensible =
           80|     rattrs:
             |     ^
           81|     let

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/make-derivation.nix:92:22:
           91|
           92|       finalPackage = mkDerivationSimple overrideAttrs args;
             |                      ^
           93|

       … while calling 'mkDerivationSimple'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/make-derivation.nix:633:5:
          632|     # * [package attributes]: https://nixos.org/manual/nix/stable/glossary#package-attribute-set
          633|     {
             |     ^
          634|

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/make-derivation.nix:733:5:
          732|
          733|     extendDerivation validity.handled (
             |     ^
          734|       {

       … while calling 'extendDerivation'
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:383:26:
          382|   extendDerivation =
          383|     condition: passthru: drv:
             |                          ^
          384|     let

       … in the left operand of the update (//) operator
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:417:5:
          416|     commonAttrs
          417|     // {
             |     ^
          418|       drvPath =

       … in the left operand of the update (//) operator
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/customisation.nix:388:13:
          387|       commonAttrs =
          388|         drv // (listToAttrs outputsList) // ({ all = map (x: x.value) outputsList; }) // passthru;
             |             ^
          389|

       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/make-derivation.nix:805:8:
          804|         passthru
          805|     ) (derivation (derivationArg // optionalAttrs envIsExportable checkedEnv));
             |        ^
          806|

       … while calling anonymous lambda
         at /builtin/derivation.nix:1:148:
       … while evaluating '((builtins).head outputsList)' to select 'value' on it
         at /builtin/derivation.nix:1:690:
       … while calling the 'head' builtin
         at /builtin/derivation.nix:1:691:
       … while calling the 'map' builtin
         at /builtin/derivation.nix:1:650:
       … from call site
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/make-derivation.nix:302:29:
          301|       separateDebugInfo' = separateDebugInfo && stdenv.hostPlatform.isLinux;
          302|       outputs' = outputs ++ optional separateDebugInfo' "debug";
             |                             ^
          303|

       … while calling 'optional'
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/lists.nix:777:20:
          776|   */
          777|   optional = cond: elem: if cond then [ elem ] else [ ];
             |                    ^
          778|

       … while evaluating a branch condition
         at /tmp/nix-rebuild-amount-pDGZvbg9/lib/lists.nix:777:26:
          776|   */
          777|   optional = cond: elem: if cond then [ elem ] else [ ];
             |                          ^
          778|

       … in the left operand of the AND (&&) operator
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/make-derivation.nix:301:46:
          300|
          301|       separateDebugInfo' = separateDebugInfo && stdenv.hostPlatform.isLinux;
             |                                              ^
          302|       outputs' = outputs ++ optional separateDebugInfo' "debug";

       … in the right operand of the AND (&&) operator
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/development/libraries/openssl/default.nix:101:82:
          100|       separateDebugInfo =
          101|         !stdenv.hostPlatform.isDarwin && !(stdenv.hostPlatform.useLLVM or false) && stdenv.cc.isGNU;
             |                                                                                  ^
          102|

       … while evaluating the attribute 'cc.isGNU'
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/stdenv/generic/default.nix:209:15:
          208|
          209|       inherit cc hasCC;
             |               ^
          210|

       … while evaluating 'stdenv.cc' to select 'isGNU' on it
         at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/development/libraries/openssl/default.nix:101:85:
          100|       separateDebugInfo =
          101|         !stdenv.hostPlatform.isDarwin && !(stdenv.hostPlatform.useLLVM or false) && stdenv.cc.isGNU;
             |                                                                                     ^
          102|

       error: infinite recursion encountered
       at /tmp/nix-rebuild-amount-pDGZvbg9/pkgs/development/libraries/openssl/default.nix:101:85:
          100|       separateDebugInfo =
          101|         !stdenv.hostPlatform.isDarwin && !(stdenv.hostPlatform.useLLVM or false) && stdenv.cc.isGNU;
             |                                                                                     ^
          102|

@zowoq
Copy link
Contributor

zowoq commented Apr 18, 2025

@RossComputerGuy When is this going to be fixed?

If it isn't fixed soon I think it would be appropriate to revert the commits that caused the breakage.

@RossComputerGuy
Copy link
Member Author

I came up with a hacky solution

@RossComputerGuy RossComputerGuy marked this pull request as ready for review April 18, 2025 07:56
@github-actions github-actions bot removed the 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related label Apr 18, 2025
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Apr 18, 2025
@nix-owners nix-owners bot requested a review from Ericson2314 April 18, 2025 07:57
@wolfgangwalther
Copy link
Contributor

I came up with a hacky solution

There is no description in the commit message, no comments. It's not possible to tell why removing the isGnu condition for openssl is not a problem for other things. The only thing that I can tell is, that the current state of this PR fixes the rebuild script. Is that enough, though? Will random failures pop up again, because the underlying problem has not been solved?

IIUC, the breakage has been caused by adding the pkgsLLVMLibc package set to stage.nix, which is something that should be easily revertable until this is fixed properly? We might not want to ship pkgsLLVMLibc in 25.05 if it has the potential for that breakage.

@wolfgangwalther
Copy link
Contributor

That PR worked around it so pkgsLLVM.pkgsLLVMLibc.stdenv evals. I think I have an idea why pkgsLLVMLibc.stdenv itself is failing

Is pkgsLLVMLibc alone actually useful? Why does it not imply everything pkgsLLVM does already?

@RossComputerGuy
Copy link
Member Author

CC @NixOS/llvm so the rest of the LLVM team looks at this.

There is no description in the commit message, no comments. It's not possible to tell why removing the isGnu condition for openssl is not a problem for other things. The only thing that I can tell is, that the current state of this PR fixes the rebuild script. Is that enough, though? Will random failures pop up again, because the underlying problem has not been solved?

Random failures are not likely to come up. The problems are mostly regarding the build dependencies, like expat and CMake. I could try finding a better solution but this is what I was able to come up with.

IIUC, the breakage has been caused by adding the pkgsLLVMLibc package set to stage.nix, which is something that should be easily revertable until this is fixed properly? We might not want to ship pkgsLLVMLibc in 25.05 if it has the potential for that breakage.

Yeah though I don't want to remove pkgsLLVMLibc if we're able to fix it.

Is pkgsLLVMLibc alone actually useful?

Yes and no. It's very useful for trying to see how an LLVM libc stdenv works.

Why does it not imply everything pkgsLLVM does already?

This is something @alyssais and I agreed upon. We shouldn't be conflating a libc and a toolchain.

@wolfgangwalther
Copy link
Contributor

wolfgangwalther commented Apr 19, 2025

Why does it not imply everything pkgsLLVM does already?

This is something @alyssais and I agreed upon. We shouldn't be conflating a libc and a toolchain.

I can see how you don't want to conflate those in settings like useLLVM etc. - fully agree.

But at the "top-level package set" level? It really makes no sense to expose something that is not useful to many. Those package sets don't enable any functionality, they are just a shorthand for those who don't (want to) know about the details.

Yes and no. It's very useful for trying to see how an LLVM libc stdenv works.

You could still achieve the same with a manual override for crossSystem right? Which seems good enough if you're not using this regularly.

Edit: Additionally, there comes a certain degree of "support" with defining a top-level package set. The support level is tiny, of course, but making this a top-level package set at least indicates, that someone cared about making this thing work in principle at some point in time. Which seems not to be the case for an "experiment" like this, where the actual goal (IIUC) is to make pkgsLLVM.pkgsLLVMLibc work.

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one person. label Apr 19, 2025
@zowoq
Copy link
Contributor

zowoq commented Apr 24, 2025

To move this forward I've opened a PR to revert. #401317

I don't care which PR is merged but I do want this breakage fixed.

@nix-owners nix-owners bot requested review from Artturin and reckenrode April 24, 2025 14:23
@emilazy
Copy link
Member

emilazy commented Apr 24, 2025

I don’t have time to review this for 25.05, but copying initial impressions from #401317 (comment):

it’s unclear to me why we want to override libxml2, python3, and ninja in the general LLVM bulld. Bootstrapping concerns like that are usually handled in stdenv stage overlays, such as in the Darwin stdenv. python3.pkgs.pyyaml instead of python3Packages.pyyaml likely breaks splicing.

@github-actions github-actions bot added 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. and removed 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 Apr 24, 2025
@RossComputerGuy
Copy link
Member Author

I don’t have time to review this for 25.05

That's fine, I just will need it eventually to help with more LLVM libc development upstream.

@RossComputerGuy
Copy link
Member Author

Rebased + redid the way the infinite recursion was worked around. Now it shouldn't break every time someone adds something to python.

@github-actions github-actions bot added the 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. label Jun 5, 2025
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jul 28, 2025
@nixpkgs-ci nixpkgs-ci bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 1, 2025
@RossComputerGuy RossComputerGuy force-pushed the fix/pkgsllvmlibc branch 2 times, most recently from 0a1ace9 to 4350497 Compare September 1, 2025 06:31
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/5855

@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 16, 2025
@RossComputerGuy
Copy link
Member Author

Fixed conflicts, again

@nixpkgs-ci nixpkgs-ci bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 27, 2025
@philiptaron philiptaron removed their request for review October 7, 2025 16:05
@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: lib The Nixpkgs function library 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nixpkgs-update is broken

9 participants