diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-09-25 20:10:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-25 20:10:59 +0200 |
| commit | 81ac893d3bc872e9eb406512d5d23c7c5f05bc57 (patch) | |
| tree | eef3c4bea625736b757799ade3418ebb2a306825 | |
| parent | 0055895c307b1018b04c07a7b379446e6b57acb8 (diff) | |
| parent | 802bf71ece2b2ae41ba39068a8a7533544fc1106 (diff) | |
| download | rust-81ac893d3bc872e9eb406512d5d23c7c5f05bc57.tar.gz rust-81ac893d3bc872e9eb406512d5d23c7c5f05bc57.zip | |
Rollup merge of #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: https://github.com/rust-lang/rust/issues/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.
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/link.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 892dfb91201..69693230ce0 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -1087,16 +1087,17 @@ fn link_natively( let strip = sess.opts.cg.strip; if sess.target.is_like_osx { + let stripcmd = "/usr/bin/strip"; match (strip, crate_type) { (Strip::Debuginfo, _) => { - strip_symbols_with_external_utility(sess, "strip", out_filename, Some("-S")) + strip_symbols_with_external_utility(sess, stripcmd, out_filename, Some("-S")) } // Per the manpage, `-x` is the maximum safe strip level for dynamic libraries. (#93988) (Strip::Symbols, CrateType::Dylib | CrateType::Cdylib | CrateType::ProcMacro) => { - strip_symbols_with_external_utility(sess, "strip", out_filename, Some("-x")) + strip_symbols_with_external_utility(sess, stripcmd, out_filename, Some("-x")) } (Strip::Symbols, _) => { - strip_symbols_with_external_utility(sess, "strip", out_filename, None) + strip_symbols_with_external_utility(sess, stripcmd, out_filename, None) } (Strip::None, _) => {} } |
