NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.57k stars 13.73k forks source link

Build failure: ncdu on aarch64-darwin on nixos release branch #290512

Open charlie-collard opened 7 months ago

charlie-collard commented 7 months ago

Steps To Reproduce

Steps to reproduce the behavior:

  1. On aarch64-darwin: nix build 'github:NixOS/nixpkgs/526d051b128b82ae045a70e5ff1adf8e6dafa560#ncdu'

This commit is the latest on the nixos-23.11 release branch at time of writing

Build log

@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpacking source archive /nix/store/s7smxibjail9wlambl6ylbi0ifvrpi2h-ncdu-2.3.tar.gz
source root is ncdu-2.3
setting SOURCE_DATE_EPOCH to timestamp 1691157970 of file ncdu-2.3/ncdu.1
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
Running phase: configurePhase
no configure script, doing nothing
@nix { "action": "setPhase", "phase": "buildPhase" }
Running phase: buildPhase
zig build flags: -Dcpu=baseline -Doptimize=ReleaseSafe -Dpie=true
Semantic Analysis [3922] Semantic Analysis [4279] Semantic Analysis [4567] Semantic Analysis [4749] Semantic Analysis [4835] Semantic Analysis [4970] Semantic Analysis [5063] compiler_rt... Semantic Analysis [376] Semantic Analysis [1398] LLVM Emit Object... LLVM Emit Object... LLVM Emit Object... LLVM Emit Object... MachO Flush... zig build-exe ncdu ReleaseSafe native-native: error: warning: Unrecognized C flag from NIX_CFLAGS_COMPILE: -F/nix/store/vwa5dgabynm829k8zcw6majig9cdkfv9-apple-framework-CoreFoundation-11.0.0/Library/Frameworks
warning: Unrecognized C flag from NIX_LDFLAGS: /nix/store/vwa5dgabynm829k8zcw6majig9cdkfv9-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/CoreFoundation.tbd
error: unable to find Dynamic system library 'ncursesw' using strategy 'paths_first'. searched paths: none

zig build-exe ncdu ReleaseSafe native-native: error: the following command exited with error code 1:
/nix/store/c7s02c14blw60n9a3k6w7xiv1knzynf2-zig-0.11.0/bin/zig build-exe /private/tmp/nix-build-ncdu-2.3.drv-0/ncdu-2.3/src/main.zig -lncursesw /private/tmp/nix-build-ncdu-2.3.drv-0/ncdu-2.3/src/ncurses_refs.c -lc -OReleaseSafe --cache-dir /private/tmp/nix-build-ncdu-2.3.drv-0/ncdu-2.3/zig-cache --global-cache-dir /private/tmp/nix-build-ncdu-2.3.drv-0/tmp.jr0FM9OVqm --name ncdu -headerpad_max_install_names -target native-native -mcpu generic -fPIE --listen=- 
Build Summary: 0/3 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
(0mq(B install ncdu transitive failure
   (0mq(B zig build-exe ncdu ReleaseSafe native-native failure
error: the following build command failed with exit code 1:
/private/tmp/nix-build-ncdu-2.3.drv-0/ncdu-2.3/zig-cache/o/2cdaf9ba989cf63f2c94847c39163f3b/build /nix/store/c7s02c14blw60n9a3k6w7xiv1knzynf2-zig-0.11.0/bin/zig /private/tmp/nix-build-ncdu-2.3.drv-0/ncdu-2.3 /private/tmp/nix-build-ncdu-2.3.drv-0/ncdu-2.3/zig-cache /private/tmp/nix-build-ncdu-2.3.drv-0/tmp.jr0FM9OVqm -Dcpu=baseline -Doptimize=ReleaseSafe -Dpie=true

Additional context

There is another issue open here: https://github.com/NixOS/nixpkgs/issues/287861, but the error is different and they were using x86_64-darwin so I figured it was better to open another issue.

The build seems to be fixed on the unstable branch so I think something needs to be backported to the release branch:

nix build 'github:NixOS/nixpkgs/526d051b128b82ae045a70e5ff1adf8e6dafa560#ncdu'

Notify maintainers

Metadata

 - system: `"aarch64-darwin"`
 - host os: `Darwin 23.3.0, macOS 14.3.1`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.9.1`
 - channels(root): `"nixpkgs"`
 - channels(charliecollard): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Add a :+1: reaction to issues you find important.

charlie-collard commented 7 months ago

I ran a bisect on the nixos-23.11 branch and it identified this commit as causing the failure.

iFreilicht commented 5 months ago

ncdu is broken on unstable for aarch64-darwin as well.

iFreilicht commented 5 months ago

@bspammer Hmm, that seems to be a red herring. Indeed, the build of the commit before that on hydra worked, but I can't reproduce it:

$ git checkout ac60eaff15a3a96bbec69d4316ab538f8f00d235
$ nix run .#ncdu -- --version
ncdu 2.3
$ nix build --rebuild .#ncdu
error: builder for '/nix/store/kvvdj4x6z1fcq3npnky1qx9q1v17l5cg-ncdu-2.3.drv' failed with exit code 1;
       last 10 log lines:
       > unpacking source archive /nix/store/s7smxibjail9wlambl6ylbi0ifvrpi2h-ncdu-2.3.tar.gz
       > source root is ncdu-2.3
       > setting SOURCE_DATE_EPOCH to timestamp 1691157970 of file ncdu-2.3/ncdu.1
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > no configure script, doing nothing
       > Running phase: buildPhase
       > zig build flags: -Dcpu=baseline -Doptimize=ReleaseSafe -Dpie=true
       > error: unable to create compilation: DarwinSdkNotFound
       For full logs, run 'nix log /nix/store/kvvdj4x6z1fcq3npnky1qx9q1v17l5cg-ncdu-2.3.drv'.

Interestingly, the same is true for zig itself:

$ nix build --rebuild .#zig
error: builder for '/nix/store/9437b781qs7zr12sqf9pwismjlksm5bw-zig-0.11.0.drv' failed with exit code 2;
       last 10 log lines:
       > static inline bool zig_subo_u64(uint64_t *res, uint64_t lhs, uint64_t rhs, uint8_t bits) {
       >                                           ^
       > 44 warnings generated.
       > [ 94%] Linking CXX executable zig2
       > [ 94%] Built target zig2
       > [100%] Building stage3
       > error: unable to create compilation: DarwinSdkNotFound
       > make[2]: *** [CMakeFiles/stage3.dir/build.make:73: stage3/bin/zig] Error 1
       > make[1]: *** [CMakeFiles/Makefile2:196: CMakeFiles/stage3.dir/all] Error 2
       > make: *** [Makefile:136: all] Error 2
       For full logs, run 'nix log /nix/store/9437b781qs7zr12sqf9pwismjlksm5bw-zig-0.11.0.drv'.

So this might be caused by https://github.com/NixOS/nixpkgs/issues/299091