Fix up setting strip = true in Cargo.toml makes build scripts fail in… · rust-lang/rust@802bf71 (original) (raw)

Original file line number Diff line number Diff line change
@@ -1087,16 +1087,17 @@ fn link_natively(
1087 1087 let strip = sess.opts.cg.strip;
1088 1088
1089 1089 if sess.target.is_like_osx {
1090 +let stripcmd = "/usr/bin/strip";
1090 1091 match (strip, crate_type) {
1091 1092 (Strip::Debuginfo, _) => {
1092 -strip_symbols_with_external_utility(sess, "strip", out_filename, Some("-S"))
1093 +strip_symbols_with_external_utility(sess, stripcmd, out_filename, Some("-S"))
1093 1094 }
1094 1095 // Per the manpage, `-x` is the maximum safe strip level for dynamic libraries. (#93988)
1095 1096 (Strip::Symbols, CrateType::Dylib | CrateType::Cdylib CrateType::ProcMacro) => {
1096 -strip_symbols_with_external_utility(sess, "strip", out_filename, Some("-x"))
1097 +strip_symbols_with_external_utility(sess, stripcmd, out_filename, Some("-x"))
1097 1098 }
1098 1099 (Strip::Symbols, _) => {
1099 -strip_symbols_with_external_utility(sess, "strip", out_filename, None)
1100 +strip_symbols_with_external_utility(sess, stripcmd, out_filename, None)
1100 1101 }
1101 1102 (Strip::None, _) => {}
1102 1103 }