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

Setting strip = true in Cargo.toml makes build scripts fail in release mode on MacOS #110536

Closed
fschutt opened this issue Apr 19, 2023 · 5 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness O-macos Operating system: macOS P-medium Medium priority regression-untriaged Untriaged performance or correctness regression.

Comments

@fschutt
Copy link
Contributor

fschutt commented Apr 19, 2023

git clone https://github.com/fschutt/azul --depth=1 --branch macbug
cd azul/azul-dll
cargo build --release

fails with:

$ cargo clean && cargo build --release
   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.36
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.92
   Compiling libc v0.2.119
   Compiling cfg-if v1.0.0
   Compiling lazy_static v1.4.0
   Compiling serde_derive v1.0.140
   Compiling serde v1.0.140
   Compiling bitflags v1.3.2
   Compiling crossbeam-utils v0.8.7
   Compiling adler v1.0.2
error: failed to run custom build command for `syn v1.0.92`

Caused by:
  process didn't exit successfully: `/Users/fs/Development/azul/target/release/build/syn-2cd6b288f9ab7997/build-script-build` (signal: 9, SIGKILL: kill)
warning: build failed, waiting for other jobs to finish...

but when running it with cargo build, it works:

   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.36
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.92
   Compiling libc v0.2.119
   Compiling cfg-if v1.0.0
   Compiling lazy_static v1.4.0
   Compiling serde_derive v1.0.140
   Compiling serde v1.0.140
   Compiling bitflags v1.3.2

[...]

    Finished dev [optimized   debuginfo] target(s) in 54.78s

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (c609da59d 2023-04-18)
binary: rustc
commit-hash: c609da59d9fc05b1c7dc879d79700ccd8140b5fc
commit-date: 2023-04-18
host: aarch64-apple-darwin
release: 1.71.0-nightly
LLVM version: 16.0.2

There was a time when cargo build --release worked, since I have old release builds of libazul.dylib from 22/08/22 (last August). It seems that upgrading my Mac has broken it (potentially an XCode upgrade). Currently I am on macOS 13.3.1 (22E261), I remember that it worked on Monterey (release date 24/10/22). It is very likely that it doesn't have anything to do with Rust / cargo itself, but it is weird that build scripts work in debug mode, but not in release mode.

@fschutt fschutt added the C-bug Category: This is a bug. label Apr 19, 2023
@fschutt
Copy link
Contributor Author

fschutt commented Apr 19, 2023

I "solved" this by changing strip = false in the [profile.release] section. Seems to be that some symbols are being stripped prematurely!

@fschutt fschutt changed the title cargo build --release fails to run build scripts on M1 Macs, but cargo build (debug) works Setting strip = true in Cargo.toml makes build scripts fail in release mode on MacOS Apr 19, 2023
@jyn514 jyn514 added O-macos Operating system: macOS I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness regression-untriaged Untriaged performance or correctness regression. labels Apr 20, 2023
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Apr 20, 2023
@jyn514 jyn514 added A-linkage Area: linking into static, shared libraries and binaries A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) labels Apr 20, 2023
@apiraino
Copy link
Contributor

@fschutt can you report if this happens also on the stable or a beta rustc channel? Can you also report when it did stop working for you? Ideally we'd want to bisect this to the Rust release where it actually stopped working. Thanks!

@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion). Also needs to be bisected

@rustbot label -I-prioritize P-high E-needs-bisect

@apiraino apiraino added P-high High priority E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc labels Apr 20, 2023
@apiraino apiraino added P-medium Medium priority and removed P-high High priority I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels May 17, 2023
@n8henrie
Copy link
Contributor

Are you perhaps running into #122902 (comment) ?

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Sep 25, 2024
…le_osx, r=davidtwco

Fix up setting strip = true in Cargo.toml makes build scripts fail in…

Fix issue: rust-lang#110536
Strip binary is PATH dependent which breaks builds in MacOS.
For example, on my Mac, the output of 'which strip' is '/opt/homebrew/opt/binutils/bin/strip', which leads to incorrect 'strip' results. Therefore, just like on other systems, it is also necessary to specify 'stripcmd' on macOS. However, it seems that there is a bug in binutils [bugzilla-Bug 31571](https://sourceware.org/bugzilla/show_bug.cgi?id=31571), which leads to the problem mentioned above.
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Sep 25, 2024
Rollup merge of rust-lang#130781 - monkeydbobo:mdb/fix_up_cross_compile_osx, r=davidtwco

Fix up setting strip = true in Cargo.toml makes build scripts fail in…

Fix issue: rust-lang#110536
Strip binary is PATH dependent which breaks builds in MacOS.
For example, on my Mac, the output of 'which strip' is '/opt/homebrew/opt/binutils/bin/strip', which leads to incorrect 'strip' results. Therefore, just like on other systems, it is also necessary to specify 'stripcmd' on macOS. However, it seems that there is a bug in binutils [bugzilla-Bug 31571](https://sourceware.org/bugzilla/show_bug.cgi?id=31571), which leads to the problem mentioned above.
@madsmtm
Copy link
Contributor

madsmtm commented Oct 10, 2024

Fixed by #130781.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness O-macos Operating system: macOS P-medium Medium priority regression-untriaged Untriaged performance or correctness regression.
Projects
None yet
Development

No branches or pull requests

7 participants