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

Build failure: pkgsCross.aarch64-darwin.stdenv #273442

Closed
t0rr3sp3dr0 opened this issue Dec 11, 2023 · 9 comments
Closed

Build failure: pkgsCross.aarch64-darwin.stdenv #273442

t0rr3sp3dr0 opened this issue Dec 11, 2023 · 9 comments
Labels
0.kind: build failure A package fails to build 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 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related

Comments

@t0rr3sp3dr0
Copy link

t0rr3sp3dr0 commented Dec 11, 2023

Steps To Reproduce

Steps to reproduce the behavior:

  1. build pkgsCross.aarch64-darwin.stdenv

Build log

user@macos-sonoma ~ % nix-build '<nixpkgs>' -A pkgsCross.aarch64-darwin.stdenv -I nixpkgs=channel:nixpkgs-unstable --show-trace
error:
       … while calling the 'derivationStrict' builtin

         at /derivation-internal.nix:9:12:

            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|

       … while evaluating derivation 'stdenv-darwin'
         whose name attribute is located at /nix/store/js53b3xz6z97jv87knhw1mdgdc4p845z-source/pkgs/stdenv/generic/default.nix:93:14

       … while evaluating attribute 'defaultNativeBuildInputs' of derivation 'stdenv-darwin'

         at /nix/store/js53b3xz6z97jv87knhw1mdgdc4p845z-source/pkgs/stdenv/generic/default.nix:126:14:

          125|
          126|       inherit initialPath shell
             |              ^
          127|         defaultNativeBuildInputs defaultBuildInputs;

       … while evaluating derivation 'aarch64-apple-darwin-clang-wrapper-16.0.6'
         whose name attribute is located at /nix/store/js53b3xz6z97jv87knhw1mdgdc4p845z-source/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'depsTargetTargetPropagated' of derivation 'aarch64-apple-darwin-clang-wrapper-16.0.6'

         at /nix/store/js53b3xz6z97jv87knhw1mdgdc4p845z-source/pkgs/stdenv/generic/make-derivation.nix:403:7:

          402|       propagatedBuildInputs       = elemAt (elemAt propagatedDependencies 1) 1;
          403|       depsTargetTargetPropagated  = elemAt (elemAt propagatedDependencies 2) 0;
             |       ^
          404|

       … while evaluating derivation 'libcxx-aarch64-apple-darwin-16.0.6'
         whose name attribute is located at /nix/store/js53b3xz6z97jv87knhw1mdgdc4p845z-source/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'stdenv' of derivation 'libcxx-aarch64-apple-darwin-16.0.6'

         at /nix/store/js53b3xz6z97jv87knhw1mdgdc4p845z-source/pkgs/stdenv/generic/make-derivation.nix:377:14:

          376|       args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
          377|       inherit stdenv;
             |              ^
          378|

       … while evaluating derivation 'stdenv-darwin'
         whose name attribute is located at /nix/store/js53b3xz6z97jv87knhw1mdgdc4p845z-source/pkgs/stdenv/generic/default.nix:93:14

       … while evaluating attribute 'defaultNativeBuildInputs' of derivation 'stdenv-darwin'

         at /nix/store/js53b3xz6z97jv87knhw1mdgdc4p845z-source/pkgs/stdenv/generic/default.nix:126:14:

          125|
          126|       inherit initialPath shell
             |              ^
          127|         defaultNativeBuildInputs defaultBuildInputs;

       … while evaluating derivation 'aarch64-apple-darwin-clang-wrapper-16.0.6'
         whose name attribute is located at /nix/store/js53b3xz6z97jv87knhw1mdgdc4p845z-source/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'depsTargetTargetPropagated' of derivation 'aarch64-apple-darwin-clang-wrapper-16.0.6'

         at /nix/store/js53b3xz6z97jv87knhw1mdgdc4p845z-source/pkgs/stdenv/generic/make-derivation.nix:403:7:

          402|       propagatedBuildInputs       = elemAt (elemAt propagatedDependencies 1) 1;
          403|       depsTargetTargetPropagated  = elemAt (elemAt propagatedDependencies 2) 0;
             |       ^
          404|

       … while evaluating derivation 'compiler-rt-libc-aarch64-apple-darwin-16.0.6'
         whose name attribute is located at /nix/store/js53b3xz6z97jv87knhw1mdgdc4p845z-source/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'stdenv' of derivation 'compiler-rt-libc-aarch64-apple-darwin-16.0.6'

         at /nix/store/js53b3xz6z97jv87knhw1mdgdc4p845z-source/pkgs/stdenv/generic/make-derivation.nix:377:14:

          376|       args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
          377|       inherit stdenv;
             |              ^
          378|

       … while evaluating derivation 'stdenv-darwin'
         whose name attribute is located at /nix/store/js53b3xz6z97jv87knhw1mdgdc4p845z-source/pkgs/stdenv/generic/default.nix:93:14

       … while evaluating attribute 'defaultNativeBuildInputs' of derivation 'stdenv-darwin'

         at /nix/store/js53b3xz6z97jv87knhw1mdgdc4p845z-source/pkgs/stdenv/generic/default.nix:126:14:

          125|
          126|       inherit initialPath shell
             |              ^
          127|         defaultNativeBuildInputs defaultBuildInputs;

       error: infinite recursion encountered

Additional context

I've tried building aarch64-darwin bash on x86_64-darwin with nix-build '<nixpkgs>' -A pkgsCross.aarch64-darwin.stdenv -I nixpkgs=channel:${CHANNEL} and found the following:

  • The build works as expected when CHANNEL=nixpkgs-22.11-darwin.
  • It builds from source when CHANNEL=nixpkgs-23.05-darwin.
  • Fails with "infinite recursion encountered" when CHANNEL=nixpkgs-23.11-darwin or CHANNEL=nixpkgs-unstable.

This breaks everything cross-building from x86_64-darwin to aarch64-darwin.

Notify maintainers

@Artturin
@Ericson2314
@RaitoBezarius
@alyssais
@amjoseph-nixpkgs
@dtzWill
@lovek323
@primeos
@reckenrode
@rrbutani
@sternenseemann
@szlend
@toonn
@trofi
@vcunat

Metadata

user@macos-sonoma ~ % nix-shell -p nix-info --run 'nix-info -m'
 - system: `"x86_64-darwin"`
 - host os: `Darwin 23.1.0, macOS 10.16`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.19.2`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Add a 👍 reaction to issues you find important.

@t0rr3sp3dr0 t0rr3sp3dr0 added the 0.kind: build failure A package fails to build label Dec 11, 2023
@vcunat vcunat added 6.topic: darwin Running or building packages on Darwin 6.topic: cross-compilation Building packages on a different platform than they will be used on labels Dec 11, 2023
@trofi
Copy link
Contributor

trofi commented Dec 11, 2023

Running $ nix-instantiate . -A pkgsCross.aarch64-darwin.stdenv --argstr system x86_64-darwin on linux confirms the infinite recursion.

Bisecting:

$ git bisect start origin/master origin/nixpkgs-23.05-darwin
$ git bisect run nix-instantiate . -A pkgsCross.aarch64-darwin.stdenv --argstr system x86_64-darwin

commit bcbdb800cf7659d6ff36ac114121a056fe8c9656
Date:   Sun Jun 11 13:14:08 2023 -0400

    llvmPackages: 11 -> 16 on Darwin

 pkgs/top-level/all-packages.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

bcbdb80 sounds very plausible.

@reckenrode
Copy link
Contributor

The fix is probably in #256590, but I need to rebase it. I plan on looking at it more later this week.

@lolbinarycat
Copy link
Contributor

this also happens when trying to cross-compile from linux to x86_64-darwin

@reckenrode
Copy link
Contributor

reckenrode commented Mar 30, 2024

Unfortunately, cross-compilation from Linux to Darwin is unlikely to be supported anytime soon. There are some challenges with tooling that would need to be solved (beyond just what needs fixing in nixpkgs). 😕

@lolbinarycat
Copy link
Contributor

maybe a warning should be added to pkgsCross.*-darwin then instead of letting it infinity recurse.

@soywod
Copy link
Contributor

soywod commented Apr 10, 2024

I have the same issue cross compiling aarch64-darwin but from x86_64-darwin: #177557

@reckenrode
Copy link
Contributor

I’m currently working on updating cctools and ld64, which should address part of the tooling issue on Linux. These updated packages are building from Apple’s upstream source drop with patches to replace private and platform-specific API usage. After that, I need to work on the SDK update/refactor because it’s likely that x86_64-darwin will need an updated SDK (10.14).

If someone wants to take my draft PR and fix the compiler-rt issue, they’re welcome to do that. My bandwidth is limited, and updating the SDK and tooling is a higher priority for me. There were already packages in the bootstrap needing a newer SDK to build, but cctools and ld64 are the first ones to require it at runtime.

However, before I start working on the SDK stuff, I can take a look at my cross-compilation to see if it’s an easy fix to get it building again. One caveat is it was mentioned in #302481 that the LLVM packages are being reworked to build from common derivations, the my cross PR may have to wait on that work to land.

@rrbutani rrbutani added the 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related label May 27, 2024
@reckenrode
Copy link
Contributor

This should be fixed by #346043.

@aviallon
Copy link
Contributor

Closed by #346043

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: build failure A package fails to build 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 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related
Projects
None yet
Development

No branches or pull requests

8 participants