Repository navigation
Open
Labels
Description
I noticed OfBorg failing to build oil-dev on aarch64-darwin.
It's failing on a ~sanity-check Oil's configure script is performing. I think I've successfully boiled the failing check down to a nix-shell oneliner that works on x86_64-darwin but fails on aarch64-darwin as below:
$ nix-shell -p stdenv --command 'cc -o /dev/null -x c <(echo "int main(void){ return 0; }"); echo $?'
libc++abi: terminating with uncaught exception of type SigTool::NotAMachOFileException: std::exception
/nix/store/r2pg5y3iyvsdx996iqynm4b414blbwpc-post-link-sign-hook: line 2: 95193 Abort trap: 6 CODESIGN_ALLOCATE=codesign_allocate /nix/store/pil07xvm57xbiczfqqj0cmrycwimapr5-sigtool-0.1.2/bin/codesign -f -s - "$linkerOutput"
clang-11: error: linker command failed with exit code 134 (use -v to see invocation)
134I'm not really familiar with anything at this level, but dropping -o /dev/null causes the invocation to work, and it seems plausible that the post-link-sign-hook trying to codesign /dev/null could cause trouble.
I don't know what the appropriate fix is, but I see where /dev/null would get picked up and set to $linkerOutput:
nixpkgs/pkgs/build-support/bintools-wrapper/ld-wrapper.sh
Lines 165 to 181 in 538a698
| # Determine linkerOutput | |
| prev= | |
| for p in \ | |
| ${extraBefore+"${extraBefore[@]}"} \ | |
| ${params+"${params[@]}"} \ | |
| ${extraAfter+"${extraAfter[@]}"} | |
| do | |
| case "$prev" in | |
| -o) | |
| # Informational for post-link-hook | |
| linkerOutput="$p" | |
| ;; | |
| *) | |
| ;; | |
| esac | |
| prev="$p" | |
| done |
Activity
abathur commentedon Jan 16, 2022
I've talked to @thefloweringash in matrix a bit (starting here), but we haven't quite unpicked this. I'm going to go ahead and work around it for my case, so I'll try to document what we've got so far.
The less-hacky way to fix this is probably updating cctools-port, since it looks like they've made progress on signing (especially the now-merged Use sigtool's codesign binary to sign in install_name_tool and strip tpoechtrager/cctools-port#114)
But, it seems like the SDK version is biting us again a bit on making this jump. I start seeing missing symbol failures for
open_memstream(on x86_64-darwin, at least) from tpoechtrager/cctools-port@86cf74fIt looks like they attempted to address this problem in Support macos<10.13 by disabling some diagnostics tpoechtrager/cctools-port#111, but my attempt to build still fails after this. I don't have a good grasp of the feature-checking API here and how it interacts with my system version and the SDK version nixpkgs is using, but here's what Andrew thought:
Andrew has some WIP towards this end already, visible in master...thefloweringash:cctools-update
resholve: work around nixpkgs aarch64-darwin issues
resholve: work around nixpkgs aarch64-darwin issues (#155251)
tanshihaj commentedon May 17, 2022
Maybe for now we can just wrap this hook https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/darwin-packages.nix#L123-L124 with
if [ "$linkerOutput" != "/dev/null" ]; then ...; fi?stephank commentedon Aug 8, 2022
I found this issue while trying a cctools upgrade myself. The PR for that is here: #185656
Unfortunately, this change causes segfaults when using
stripon non-binaries, which Nix does a lot. So the upgrade I did is up to the commit right before it. I didn't attempt a fix, only left a comment there.I read over this before starting. Would've saved some time. 🤦♂️ Good thing we ended up doing much of the same.
writers: make codesign_allocate available in PATH on aarch64-darwin
writers: make codesign_allocate available in PATH on aarch64-darwin
smancill commentedon Sep 27, 2026
It should have been fixed long ago: