On macOS, strip=symbols
results in "error: symbols referenced by indirect symbol table entries that can't be stripped in <file>.dylib"
#93988
Labels
C-bug
Category: This is a bug.
When the new
strip
codegen option is used on OS X with mode"symbols"
(which is the highest strip mode, and what is used whenstrip=true
is passed to Cargo), the build emits the following warning for the testcase below:Doing any of the following stops the warning from appearing (see the workarounds section below for more details):
strip
to"debuginfo"
instead of"symbols"
(globally).build-override
forstrip
, to turn it off for proc-macros/... only, whilst leaving it set to"symbols"
for everything else.path
reference to the published crate. (The published crate is identical to the local version, so this seems significant?)This potentially seems like fallout from #88137 - cc @joshtriplett
Steps to reproduce
git clone https://github.com/Malax/libcnb.rs
(currently at11bdefc02d649fdde3ac5c1404e7d8d5f8f2681c
)cargo new testcase && cd $_
cargo add ../libcnb.rs/libcnb-proc-macros
CARGO_PROFILE_RELEASE_STRIP=symbols cargo build --release
Expected
The cargo build completes successfully (exit code 0), with no warnings/errors seen in the build output.
Actual
Whilst the build completes successfully (exit code 0), there is a warning/error about stripping in the build output. Ideally rustc would configure stripping so it "just works" with one of the presets like "symbols", or else suppress warnings if they are deemed expected in certain scenarios.
Workarounds
The warning does not appear if...
debuginfo
is used instead (ie: step 4 replaced withCARGO_PROFILE_RELEASE_STRIP=debuginfo cargo build --release
).CARGO_PROFILE_RELEASE_STRIP=symbols CARGO_PROFILE_RELEASE_BUILD_OVERRIDE=none cargo build --release
)libcnb-proc-macros
dependency is changed from a local path reference to the published crate (ie: step 3 changed tocargo add [email protected]
) - even though the published crate is identical to the local version?!Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: