Skip to content

Commit e943ece

Browse files
committed
Remove build.rs for Android when assuming API level is always >=21
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
1 parent 42f4833 commit e943ece

File tree

4 files changed

+5
-61
lines changed

4 files changed

+5
-61
lines changed

Cargo.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@ keywords = ["dyld", "dylib", "shared", "library", "dl_iterate_phdr"]
88
license = "MIT OR Apache-2.0"
99
readme = "./README.md"
1010
repository = "https://github.com/gimli-rs/findshlibs"
11+
rust-version = "1.82"
1112

1213
[dependencies]
1314
libc = "0.2.104"
1415

15-
[build-dependencies]
16-
# Only needed for Android, but cannot be target dependent
17-
# https://github.com/rust-lang/cargo/issues/4932
18-
cc = "1.0.67"
19-
2016
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
2117
lazy_static = "1.4"
2218

build.rs

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/android-api.c

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/lib.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,25 +100,18 @@
100100
#[cfg(any(target_os = "macos", target_os = "ios"))]
101101
pub mod macos;
102102

103-
#[cfg(any(
104-
target_os = "linux",
105-
all(target_os = "android", feature = "dl_iterate_phdr")
106-
))]
103+
#[cfg(any(target_os = "linux", target_os = "android"))]
107104
pub mod linux;
108105

109106
#[cfg(target_os = "windows")]
110107
pub mod windows;
111108

112109
use std::ffi::OsStr;
113110
use std::fmt::{self, Debug};
114-
use std::usize;
115111

116112
pub mod unsupported;
117113

118-
#[cfg(any(
119-
target_os = "linux",
120-
all(target_os = "android", feature = "dl_iterate_phdr")
121-
))]
114+
#[cfg(any(target_os = "linux", target_os = "android"))]
122115
use crate::linux as native_mod;
123116

124117
#[cfg(any(target_os = "macos", target_os = "ios"))]
@@ -131,7 +124,7 @@ use crate::windows as native_mod;
131124
target_os = "macos",
132125
target_os = "ios",
133126
target_os = "linux",
134-
all(target_os = "android", feature = "dl_iterate_phdr"),
127+
target_os = "android",
135128
target_os = "windows"
136129
)))]
137130
use unsupported as native_mod;
@@ -145,7 +138,7 @@ pub const TARGET_SUPPORTED: bool = cfg!(any(
145138
target_os = "macos",
146139
target_os = "ios",
147140
target_os = "linux",
148-
all(target_os = "android", feature = "dl_iterate_phdr"),
141+
target_os = "android",
149142
target_os = "windows"
150143
));
151144

0 commit comments

Comments
 (0)