Open Smaug123 opened 2 years ago
Very (very) novice Nix user who was just trying to learn through the Nix Pills series but I ended up running into this exact error when trying to build the sample C program included in Pill #7.
error: builder for '/nix/store/r3xdz1s0jkrlvabi3q2j9a0lrjliwk1i-simple.drv' failed with exit code 1;
last 10 log lines:
> /nix/store/9sll05wmn9b05f0pm1pwfmmq92fg0syh-simple.c: In function 'main':
> /nix/store/9sll05wmn9b05f0pm1pwfmmq92fg0syh-simple.c:2:3: warning: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
> 2 | puts("Simple!");
> | ^~~~
> /nix/store/9sll05wmn9b05f0pm1pwfmmq92fg0syh-simple.c:1:1: note: include '<stdio.h>' or provide a declaration of 'puts'
> +++ |+#include <stdio.h>
> 1 | void main() {
> libc++abi: terminating with uncaught exception of type std::runtime_error: Failed to spawn codesign_allocate: No such file or directory
> /nix/store/7000rh8ksvy4g3fcn563l0pad883iqdq-post-link-sign-hook: line 2: 33532 Abort trap: 6 CODESIGN_ALLOCATE=codesign_allocate /nix/store/cvbl5h2kvznizbc668rirn2q377jlw41-sigtool-0.1.2/bin/codesign -f -s - "$linkerOutput"
> collect2: error: ld returned 134 exit status
For full logs, run 'nix log /nix/store/r3xdz1s0jkrlvabi3q2j9a0lrjliwk1i-simple.drv'.
@jmgilman This isn't quite the fix you might expect but at least it will enable you to run the simple
example.
In Pill #8 the author creates another derivation, but this time he points out that there are some differences when you try running the example on darwin.
To build the derivation you need to change the PATH
variable to look like this:
export PATH="$coreutils/bin:$clang/bin:$binutils/bin"
And when building the derivation in the nix repl
you need to have the following values set:
clang = clang; coreutils = coreutils; binutils = clang.bintools.bintools_bin
I'm sorry in advance if this is not the place for this sort of comment.
Describe the bug
A build of the Lean4 flake (https://github.com/leanprover/lean4/pull/838/commits/0df78cf801e2e6950c78e57825244e1d0b289a8e) fails with:
Steps To Reproduce
Steps to reproduce the behaviour on Darwin, macOS Monterey, no developer tools installed, nix 2.4 (Nix is set up as in https://github.com/Smaug123/nix-dotfiles/commit/13e0ea2511e78e0172526c8bc391b6b3f8976f49):
git clone https://github.com/leanprover/lean4 && git checkout 0df78cf801e2e6950c78e57825244e1d0b289a8e
nix build
Expected behavior
The Lean4 build completes successfully and signs the resulting binaries.
Actual behaviour
The Lean4 build completes successfully, but code signing fails.
Additional context
I believe the cause of the problem is https://github.com/NixOS/nixpkgs/blob/283d622397539f196416657da9dc804a4ca89846/pkgs/top-level/darwin-packages.nix#L124, which I believe is referring to an ambient
codesign_allocate
rather than one obtained fromcctools
. I attempted a fix (https://github.com/NixOS/nixpkgs/compare/master...Smaug123:aarch-signing-2) but my Nix knowledge isn't good enough to get it right.Notify maintainers
@matthewbauer @thefloweringash @Ericson2314
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Maintainer information: