Skip to content

openssl: fix Darwin cross infinite recursion#126844

Merged
domenkozar merged 1 commit intoNixOS:masterfrom
alyssais:openssl-darwin
Jun 14, 2021
Merged

openssl: fix Darwin cross infinite recursion#126844
domenkozar merged 1 commit intoNixOS:masterfrom
alyssais:openssl-darwin

Conversation

@alyssais
Copy link
Member

stdenv depends on openssl, and isGNU depends on stdenv.

Motivation for this change

Fixes #126829.
Thanks to @sternenseemann for figuring out what was going on here.
Haven't tested myself because I don't have Darwin.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • 21.11 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.

stdenv depends on openssl, and isGNU depends on stdenv.

Thanks-to: sternenseemann <[email protected]>
Fixes: NixOS#126829
@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label Jun 14, 2021
@alyssais alyssais added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Jun 14, 2021
@alyssais
Copy link
Member Author

@ofborg build pkgsCross.aarch64-darwin.nix

@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 Jun 14, 2021
@sternenseemann
Copy link
Member

Eval looks good:

$ nix-instantiate -A pkgsCross.aarch64-darwin.hello --argstr system x86_64-darwin
warning: you did not specify '--add-root'; the result might be removed by the garbage collector
/nix/store/r5zq68sqm7qbwkfq9yflwwq00pg5qgwd-hello-aarch64-apple-darwin-2.10.drv

But this will fail when not using darwin as the build platform as well, so it is a fragile fix in any case (not sure if we need to care about this cross compilation direction?).

$ nix-instantiate -A pkgsCross.aarch64-darwin.hello --argstr system x86_64-linux
error: infinite recursion encountered, at undefined position
(use '--show-trace' to show detailed location information)

@sternenseemann
Copy link
Member

For reference this is the full trace:

$ nix-instantiate -A pkgsCross.aarch64-darwin.hello --argstr system x86_64-linux --show-trace
error: while evaluating the attribute 'stdenv' of the derivation 'hello-aarch64-apple-darwin-2.10' at /home/lukas/src/nix/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:201:11:
while evaluating the attribute 'defaultBuildInputs' of the derivation 'stdenv-linux' at /home/lukas/src/nix/nixpkgs/pkgs/stdenv/generic/default.nix:93:14:
while evaluating the attribute 'disallowedRequisites' of the derivation 'apple-framework-CoreFoundation-11.0.0' at /home/lukas/src/nix/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:201:11:
while evaluating the attribute 'nativeBuildInputs' of the derivation 'MacOSX-SDK-11.0.0' at /home/lukas/src/nix/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:201:11:
while evaluating the attribute 'buildInputs' of the derivation 'pbzx-1.0.2' at /home/lukas/src/nix/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:201:11:
while evaluating the attribute 'buildInputs' of the derivation 'xar-1.6.1' at /home/lukas/src/nix/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:201:11:
while evaluating the attribute 'buildInputs' of the derivation 'libxml2-2.9.12' at /home/lukas/src/nix/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:201:11:
while evaluating the attribute 'postPatch' of the derivation 'python3-3.8.9' at /home/lukas/src/nix/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:201:11:
while evaluating 'spliceReal' at /home/lukas/src/nix/nixpkgs/pkgs/top-level/splice.nix:28:16, called from /home/lukas/src/nix/nixpkgs/pkgs/top-level/splice.nix:72:65:
while evaluating 'tryGetOutputs' at /home/lukas/src/nix/nixpkgs/pkgs/top-level/splice.nix:63:25, called from /home/lukas/src/nix/nixpkgs/pkgs/top-level/splice.nix:78:30:
while evaluating 'getOutputs' at /home/lukas/src/nix/nixpkgs/pkgs/top-level/splice.nix:66:22, called from /home/lukas/src/nix/nixpkgs/pkgs/top-level/splice.nix:65:12:
while evaluating 'genAttrs' at /home/lukas/src/nix/nixpkgs/lib/attrsets.nix:313:21, called from /home/lukas/src/nix/nixpkgs/pkgs/top-level/splice.nix:66:29:
while evaluating 'optionalAttrs' at /home/lukas/src/nix/nixpkgs/lib/attrsets.nix:353:25, called from /home/lukas/src/nix/nixpkgs/pkgs/top-level/splice.nix:65:24:
while evaluating the attribute 'bash' at /home/lukas/src/nix/nixpkgs/pkgs/top-level/all-packages.nix:10236:3:
while evaluating 'addMetaAttrs' at /home/lukas/src/nix/nixpkgs/lib/meta.nix:15:28, called from /home/lukas/src/nix/nixpkgs/pkgs/top-level/all-packages.nix:10236:10:
while evaluating 'callPackageWith' at /home/lukas/src/nix/nixpkgs/lib/customisation.nix:117:35, called from /home/lukas/src/nix/nixpkgs/pkgs/top-level/all-packages.nix:10236:19:
while evaluating 'makeOverridable' at /home/lukas/src/nix/nixpkgs/lib/customisation.nix:67:24, called from /home/lukas/src/nix/nixpkgs/lib/customisation.nix:121:8:
while evaluating anonymous function at /home/lukas/src/nix/nixpkgs/pkgs/shells/bash/4.4.nix:1:1, called from /home/lukas/src/nix/nixpkgs/lib/customisation.nix:69:16:
while evaluating the attribute 'cc.bintools' at /home/lukas/src/nix/nixpkgs/pkgs/stdenv/generic/default.nix:166:14:
while evaluating the attribute 'llvmPackages.clang' at /home/lukas/src/nix/nixpkgs/pkgs/development/compilers/llvm/11/default.nix:107:5:
while evaluating the attribute 'libstdcxxClang' at /home/lukas/src/nix/nixpkgs/pkgs/development/compilers/llvm/11/default.nix:109:5:
while evaluating 'wrapCCWith' at /home/lukas/src/nix/nixpkgs/pkgs/top-level/all-packages.nix:12077:5, called from /home/lukas/src/nix/nixpkgs/pkgs/development/compilers/llvm/11/default.nix:109:22:
while evaluating 'callPackageWith' at /home/lukas/src/nix/nixpkgs/lib/customisation.nix:117:35, called from /home/lukas/src/nix/nixpkgs/pkgs/top-level/all-packages.nix:12091:7:
while evaluating 'makeOverridable' at /home/lukas/src/nix/nixpkgs/lib/customisation.nix:67:24, called from /home/lukas/src/nix/nixpkgs/lib/customisation.nix:121:8:
while evaluating anonymous function at /home/lukas/src/nix/nixpkgs/pkgs/build-support/cc-wrapper/default.nix:8:1, called from /home/lukas/src/nix/nixpkgs/lib/customisation.nix:69:16:
while evaluating the attribute 'installPhase' of the derivation 'libSystem-11.0.0' at /home/lukas/src/nix/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:201:11:
infinite recursion encountered, at undefined position

@domenkozar
Copy link
Member

Nix still doesn't build but that's out of scope for this fix. Thanks!

@github-actions
Copy link
Contributor

Successfully created backport PR #126852 for release-21.05.

@sternenseemann
Copy link
Member

For the record, I think we need to solve this differently. I fear that this workaround which only tackles one specific case may not be enough in the long run. I'll try to have a look at the new trace tomorrow and see if I can come up with anything.

I think at the very least we should keep #126829 (with a modified title) open for now.

@alyssais alyssais deleted the openssl-darwin branch June 23, 2021 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: darwin Running or building packages on Darwin 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cross-compiling Nix to aarch64-darwin fails with infinite recursion

3 participants