Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGKILL 9 on aarch64-darwin after 1.83 upgrade #197

Closed
simonzkl opened this issue Dec 3, 2024 · 8 comments
Closed

SIGKILL 9 on aarch64-darwin after 1.83 upgrade #197

simonzkl opened this issue Dec 3, 2024 · 8 comments
Labels
help wanted Extra attention is needed

Comments

@simonzkl
Copy link

simonzkl commented Dec 3, 2024

Something between 9051466..3497106 is causing builds onaarch64-darwin getting SIGKILL-ed. Anything that requires a build script fails with:

       > error: failed to run custom build command for `proc-macro2 v1.0.87`
       >
       > Caused by:
       >   process didn't exit successfully: `/private/tmp/nix-build-cargo-llvm-cov-0.6.14.drv-0/source/target/release/build/proc-macro2-cc0987ae2e60fb30/build-script-build` (signal: 9, SIGKILL: kill)
       > warning: build failed, waiting for other jobs to finish...
       > error: failed to run custom build command for `serde v1.0.210`
       >
       > Caused by:
       >   process didn't exit successfully: `/private/tmp/nix-build-cargo-llvm-cov-0.6.14.drv-0/source/target/release/build/serde-a79c191d45e158fe/build-script-build` (signal: 9, SIGKILL: kill)
       > error: failed to run custom build command for `rustix v0.38.37`
       >
       > Caused by:
       >   process didn't exit successfully: `/private/tmp/nix-build-cargo-llvm-cov-0.6.14.drv-0/source/target/release/build/rustix-0d75d4ace3e7e5a5/build-script-build` (signal: 9, SIGKILL: kill)
       > error: failed to run custom build command for `anyhow v1.0.89`
       >
       > Caused by:
       >   process didn't exit successfully: `/private/tmp/nix-build-cargo-llvm-cov-0.6.14.drv-0/source/target/release/build/anyhow-a8439441284bc7bc/build-script-build` (signal: 9, SIGKILL: kill)
       > error: failed to run custom build command for `libc v0.2.159`
       >
       > Caused by:
       >   process didn't exit successfully: `/private/tmp/nix-build-cargo-llvm-cov-0.6.14.drv-0/source/target/release/build/libc-df0d4e5857f68e29/build-script-build` (signal: 9, SIGKILL: kill)
       For full logs, run 'nix log /nix/store/vvwpm8hsrgd7ww0pw6lcf62g7ap0fxls-cargo-llvm-cov-0.6.14.drv'.

Downgrading rust-overlay (keeping the same nixpkgs revision) solves the issue.

Possible candidates #196, #192, #190?

@simonzkl
Copy link
Author

simonzkl commented Dec 3, 2024

Narrowed it down to 3497106. The manifest update to Rust 1.83.

@simonzkl simonzkl changed the title Code signing broken on aarch64-darwin SIGKILL 9 on aarch64-darwin after 1.83 upgrade Dec 3, 2024
@simonzkl
Copy link
Author

simonzkl commented Dec 3, 2024

Possibly related to NixOS/nixpkgs#299606

@simonzkl
Copy link
Author

simonzkl commented Dec 3, 2024

I also tested a cross build with --sandbox and I noticed that 1.83 is now trying to use /usr/bin/strip which is unavailable of course. Reverting to 1.82 again fixes the issue.

Fun rabbithole:

@simonzkl
Copy link
Author

simonzkl commented Dec 4, 2024

Horrible binary patch to force it to use strip from PATH:

toolchain.overrideAttrs (prev: {
  buildCommand = ''
    ${prev.buildCommand}

    source ${pkgs.darwin.signingUtils}
    driver=$(echo $out/lib/librustc_driver-*.dylib)
    ${pkgs.bbe}/bin/bbe -e 's#/usr/bin/strip#strip-xxxxxxxx#' $driver > $driver.new
    mv $driver.new $driver
    signIfRequired $driver

    echo "#!${pkgs.bash}/bin/bash" >> $out/bin/strip-xxxxxxxx
    echo 'exec strip "$@"' >> $out/bin/strip-xxxxxxxx
    chmod +x $out/bin/strip-xxxxxxxx
  '';
});

This fixes the issue, though don't actually use this.

@oxalica oxalica added the help wanted Extra attention is needed label Dec 8, 2024
@saiintbrisson
Copy link

Also related: NixOS/nixpkgs#362388.

@simonzkl
Copy link
Author

simonzkl commented Dec 10, 2024

Not sure what we can really do about this. Some options that come to mind:

  • Wait for 1.84 (upstream switched to llvm-strip)
  • Use libredirect to redirect /usr/bin/strip
  • Binary patch it (a bit difficult to do because of Rust's non-null terminated strings)
  • Disable stripping (CARGO_PROFILE_RELEASE_STRIP=false). The stdenv strips the final binary anyway

The least hacky approach might be to suggest users to disable stripping and wait for 1.84.

@saiintbrisson
Copy link

The least hacky approach might be to suggest users to disable stripping and wait for 1.84.

This is what I've done. Pinned Rust to 1.82 for now. Not a big deal.

@simonzkl
Copy link
Author

No longer an issue in 1.84.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants