-
Notifications
You must be signed in to change notification settings - Fork 248
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
backtrace
brings in std
even with std
feature disabled
#564
Comments
It looks like the gimli based symbilizer is unconditionally used on unix, even if the std feature is disabled. It requires fs libc calls to load debug info. If you are on neither Windows nor Unix you will get a noop symbolizer impl though which doesn't need libstd. |
Hm, are you sure? Here's what I see for
So gimli v0.28.0 comes in from addr2line v0.21.0.
So only the Putting those together, it seems like this indirect gimli dependency should still be |
The glue code in backtrace-rs which uses gimli/addr2line uses libstd: backtrace-rs/src/symbolize/gimli.rs Lines 17 to 27 in a390aa7
|
Ah, I see. So I guess it's not a goal for the crate to actually support |
I'm happy to accept PRs that improve the situation without breaking things for std-using programs, but it is very true it might be... challenging. |
I reproduced this with a minimal
#![no_std]
executable that does nothing but return an exit code:main.rs
cargo run
works as expected (exits with code 42) with the followingCargo.toml
, which includes thebacktrace
dependency (withdefault-features = false
so it doesn't have thestd
feature):Cargo.toml
At least in macOS, I needed to add compiler flags for this to run; here is my
.cargo/config.toml
.cargo/config.toml
At this point, if I actually try to use
backtrace
- doing nothing else but addinguse
tomain.rs
like so:...now
cargo check
fails, saying thatbacktrace
is bringing in thestd
crate which introduces a conflictingpanic_impl
implementation:Note that the
error[E0152]: found duplicate lang item 'panic_impl'
explicitly saysthe lang item is first defined in crate 'std' (which 'backtrace' depends on)
, and that everything worked until I added the (unused)use backtrace::trace_unsynchronized;
declaration. Also, I know thestd
feature is off, because if I try to import something that needs it (e.g.backtrace::Backtrace
), I get an error.This is with stable rustc 1.68.0 (2c8cc3432 2023-03-06) and cargo 1.68.0 (115f34552 2023-02-26).
Unfortunately, this seems to make it impossible to use
backtrace
in ano_std
executable - unless I'm missing something!The text was updated successfully, but these errors were encountered: