Skip to content

cc <file> -o /dev/null fails on aarch64-darwin #154203

@abathur

Description

@abathur

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)
134

I'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:

# 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

@thefloweringash

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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions