Skip to content

Commit

Permalink
fix: android build in 32-bit devices (rust-rocksdb#869)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 authored Jul 13, 2024
1 parent 9e24ed8 commit 1c36046
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion librocksdb-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ fn build_rocksdb() {
config.define("OS_ANDROID", None);
config.define("ROCKSDB_PLATFORM_POSIX", None);
config.define("ROCKSDB_LIB_IO_POSIX", None);

if &target == "armv7-linux-androideabi" {
config.define("_FILE_OFFSET_BITS", Some("32"));
}
} else if target.contains("linux") {
config.define("OS_LINUX", None);
config.define("ROCKSDB_PLATFORM_POSIX", None);
Expand Down Expand Up @@ -224,7 +228,9 @@ fn build_rocksdb() {
config.define("ROCKSDB_IOURING_PRESENT", Some("1"));
}

if env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() != "64" {
if &target != "armv7-linux-androideabi"
&& env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() != "64"
{
config.define("_FILE_OFFSET_BITS", Some("64"));
config.define("_LARGEFILE64_SOURCE", Some("1"));
}
Expand Down

0 comments on commit 1c36046

Please sign in to comment.