Skip to content

Darwin: codesign_allocate not found #148189

@Smaug123

Description

@Smaug123

Describe the bug

A build of the Lean4 flake (leanprover/lean4@0df78cf) fails with:

> ld: warning: directory not found for option '-L/nix/store/smpng2rrp1dfnik729h4gg917mm0y4ws-leanc/lib/lean'
> libc++abi: terminating with uncaught exception of type std::runtime_error: Failed to spawn codesign_allocate: No such file or directory
       > /nix/store/apxhw055i0z86i3m27xn81w0qg2ssp1q-post-link-sign-hook: line 2: 50824 Abort trap: 6           CODESIGN_ALLOCATE=codesign_allocate /nix/store/hr987fj9ib6v70mmi9jiw5iykkc0zi2f-sigtool-0.1.2/bin/codesign -f -s - "$linkerOutput"

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 Smaug123/nix-dotfiles@13e0ea2):

  1. git clone https://github.com/leanprover/lean4 && git checkout 0df78cf801e2e6950c78e57825244e1d0b289a8e
  2. 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

${self.sigtool}/bin/codesign -f -s - "$linkerOutput"
, which I believe is referring to an ambient codesign_allocate rather than one obtained from cctools. I attempted a fix (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.

nix-shell -p nix-info --run "nix-info -m"                                                                                                                                                                    ~/Documents/GitHub/nixpkgs
 - system: `"aarch64-darwin"`
 - host os: `Darwin 21.1.0, macOS 12.0.1`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.4`
 - channels(patrick): `"darwin, home-manager"`
 - channels(root): `"nixpkgs-22.05pre334335.9c191ebcdfe"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: darwinRunning or building packages on Darwin

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions