Segfaults when compiling with `--release`

Recently, my Rust installation started segfaulting when compiling with --release (luckily debug builds still work, so I wasn't hindered too much). This occurs with locally cloned projects and cargo install.

failed to run custom build command for `<crate-name> <crate-version>`

I'm getting this error in the build scripts of proc-macro2, quote, libc, and syn (there may be more, cargo just hasn't gotten that far). My cargo dependencies are up to date, and I'm using sparse-registry. I tried checking if the issue was pkg-config but I'm not sure how to test it. Here are the results of cargo -vV: (let me know if any additional diagnostics are required)

cargo 1.68.1 (115f34552 2023-02-26)
release: 1.68.1
commit-hash: 115f34552518a2f9b96d740192addbac1271e7e6
commit-date: 2023-02-26
host: x86_64-apple-darwin
libgit2: 1.5.0 (sys:0.16.0 vendored)
libcurl: 7.86.0 (sys:0.4.59+curl-7.86.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
os: Mac OS 13.2.1 [64-bit]
1 Like

What CPU does your Mac have?

Core i5-8210Y

I tried deleting my .cargo/git/ and .cargo/registry/ directories but it immediately fails with the same error.

Hmm if I disable strip everything compiles normally. I guess my local Xcode installation is broken or something?

Manually running strip on the resulting binary results in SIGSEGV (Address boundary error) when trying to run the stripped binary. Very curious.

This problem doesn't occur on another Mac I tested

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.