Rust: nix-installed `strip` is crashing `cargo install`

Cross-posting from the rust discourse, since I haven’t gotten much input there: Nix-installed `strip` is crashing `cargo install` - help - The Rust Programming Language Forum

The tl;dr is that I’m on aarch64-darwin and tried to build a project today that has dependencies requiring a build script: GitHub - richardanaya/wasm-service: HTMX, WebAssembly, Rust, ServiceWorkers

I noticed that several deps failed to build with SIGKILL:

error: failed to run custom build command for `serde v1.0.145`

Caused by:
  process didn't exit successfully: `/Users/n8henrie/git/wasm-service/target/release/build/serde-52fda57659567c24/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_derive v1.0.145`

In this project’s Cargo.toml, you’ll see that strip is enabled.

Unfortunately it tries to use my nix-installed strip which precedes it on the path, and crashes:

$ type -a strip
strip is /run/current-system/sw/bin/strip
strip is /usr/bin/strip

This is a known issue and it looks like the recommendation is to just not have nix’s strip first in PATH.

I’m not sure yet why the nix-installed strip crashes things.

Since there is a large rust / nix community, I thought I’d see if others have run into this and what their process is. TIA for any ideas. Unfortunately I don’t see a way to specify a path to strip in Cargo.toml, which would have made for an easy workaround.

1 Like