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

Remove build.rs for Android when assuming API level is always >=21 #82

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MarijnS95
Copy link

@MarijnS95 MarijnS95 commented Jan 9, 2025

Since Rust 1.82 the minimum Android API level is 21. In backtrace, this warranted the removal of the API version check via __ANDROID_API__ in rust-lang/backtrace-rs#656 since it is now always known to be >=21. When findshlibs bumps its MSRV the same could be done.

Important

This is a draft to remind us to remove the code some day when the MSRV is bumped. I completely understand that's likely not desired now or soon, but at least we have it tracked until that time comes.

This change is sparked by a long search for why backtraces always had <unknown> symbols on Android - and when solving that by upgrading Rust (for std::backtrace) or our backtrace dependency, why Sentry reports did not record what images/libraries were loaded at which offsets to resolve stack addresses back to function symbols. It turned out that the xbuild build tool never set __ANDROID_API__ (by not telling clang about the target API level via the triple) which would cause this code to never set feature = "dl_iterate_phdr" to search for libraries on Android: rust-mobile/xbuild#209

Since Rust 1.82 the minimum Android API level is 21.  In
`backtrace`, this warranted the removal of the API version check via
`__ANDROID_API__` in rust-lang/backtrace-rs#656
since it is now always known to be >=21.  When `findshlibs` bumps its
MSRV the same could be done.

This change is sparked by a long search for why backtraces always had
`<unknown>` symbols on Android - and when solving that by upgrading Rust
(for `std::backtrace`) or our `backtrace` dependency, why Sentry reports
did not record what images/libraries were loaded at which offsets to
resolve stack addresses back to function symbols.  It turned out that
the `xbuild` build tool never set `__ANDROID_API__` (by not telling
`clang` about the target API level via the triple) which would cause
this code to never set `feature = "dl_iterate_phdr"` to search for
libraries on Android: rust-mobile/xbuild#209
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant