minor android fixes

This commit is contained in:
Christien Rioux 2024-04-05 21:22:29 -04:00
parent 40660c6b33
commit 0b587e8f04
2 changed files with 5 additions and 2 deletions

View File

@ -132,7 +132,9 @@ fn fix_android_emulator() {
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
if target_arch == "x86_64" && target_os == "android" {
let missing_library = "clang_rt.builtins-x86_64-android";
let android_home = env::var("ANDROID_HOME").expect("ANDROID_HOME not set");
let android_home = env::var("ANDROID_HOME")
.or(env::var("ANDROID_SDK_ROOT"))
.expect("ANDROID_HOME or ANDROID_SDK_ROOT not set");
let lib_path = glob(&format!(
"{android_home}/ndk/25.1.8937393/**/lib{missing_library}.a"
))

View File

@ -26,7 +26,7 @@ cfg_if! {
use std::convert::TryInto;
use std::ffi::CStr;
use std::io;
use std::os::raw::{c_char, c_int};
use std::os::raw::c_int;
use tools::*;
fn get_interface_name(index: u32) -> io::Result<String> {
@ -37,6 +37,7 @@ fn get_interface_name(index: u32) -> io::Result<String> {
bail_io_error_other!("if_indextoname returned null");
}
} else {
use std::os::raw::c_char;
if unsafe { if_indextoname(index, ifnamebuf.as_mut_ptr() as *mut c_char) }.is_null() {
bail_io_error_other!("if_indextoname returned null");
}