-
-
Notifications
You must be signed in to change notification settings - Fork 316
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
Can't get frida_libpng to work for android #1359
Comments
Try an older NDK. |
After trying NDK r22b, below is my error message
Any idea what I might be doing wrong? |
try cleaning with |
@s1341 thanks for reply. |
you can try bumping the frida-gum/frida-gum-sys versions to the latest frida-rust version. |
bumping versions with
|
why are you trying to include Did you set your linker path in a |
also, please put the fully qualified path in |
@s1341 thanks for your opinion, it was very helpful for me.
Is there any step missing? |
Looks like a linker error. I don't know why clang can't find libunwind. Maybe strace the compilation to try to see where it looks for it? |
The env I'm using is build from Dockerfile , Would you provide a docker image which frida_libpng can be build for android? |
I didn't use a Dockerfile. I used the anrdoid toolchain on nixos. |
@s1341 also use nixos to cross compile, below is my error message,
How could i fix this error ? |
I don't know what the last issue is, but the |
This may be helpful:
|
To fix this error (only for NDK below 23), you need to specify diff --git a/frida-gum-sys/build.rs b/frida-gum-sys/build.rs
index eb3fedd9..da75553d 100644
--- a/frida-gum-sys/build.rs
+++ b/frida-gum-sys/build.rs
@@ -67,10 +67,12 @@ fn main() {
let bindings = if std::env::var("DOCS_RS").is_ok() {
bindings.clang_arg("-Iinclude")
} else {
- bindings
+ bindings.clang_arg("-Iinclude")
};
let bindings = bindings
+ .clang_arg("--sysroot=/home/user/AndroidSDK/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/sysroot/")
.header_contents("gum.h", "#include \"frida-gum.h\"")
.header("event_sink.h")
.header("invocation_listener.h") |
To fix this problem, try workaround from here: rust-lang/rust#85806 (comment). |
My workaround for use std::env;
/// Adds a temporary workaround for an issue with the Rust compiler and Android
/// in x86_64/aarch64 devices: https://github.com/rust-lang/rust/issues/109717.
/// The workaround comes from: https://github.com/mozilla/application-services/pull/5442
fn setup_android_workaround() {
let target_os = env::var("CARGO_CFG_TARGET_OS").expect("CARGO_CFG_TARGET_OS not set");
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").expect("CARGO_CFG_TARGET_ARCH not set");
if (target_arch == "x86_64" || target_arch == "aarch64") && target_os == "android" {
let android_ndk_home = env::var("ANDROID_NDK_HOME").expect("ANDROID_NDK_HOME not set");
let build_os = match env::consts::OS {
"linux" => "linux",
"macos" => "darwin",
"windows" => "windows",
_ => panic!(
"Unsupported OS. You must use either Linux, MacOS or Windows to build the crate."
),
};
const DEFAULT_CLANG_VERSION: &str = "14.0.7";
let clang_version =
env::var("NDK_CLANG_VERSION").unwrap_or_else(|_| DEFAULT_CLANG_VERSION.to_owned());
let linux_x86_64_lib_dir = format!(
"toolchains/llvm/prebuilt/{build_os}-x86_64/lib64/clang/{clang_version}/lib/linux/"
);
println!("cargo:rustc-link-search={android_ndk_home}/{linux_x86_64_lib_dir}");
println!("cargo:rustc-link-lib=static=clang_rt.builtins-{target_arch}-android");
}
}
fn main() {
setup_android_workaround();
} |
Want to propse that as PR in the frida bindings (https://github.com/frida/frida-rust/) ? |
|
Think this was fixed in the meantime |
I follow the step to build frida_libpng, but still get some error.
The steps:
CLANG_PATH=aarch64-linux-android-clang cargo -v build --release --target=aarch64-linux-android
After build , this is what I see:
Any idea what I might be doing wrong?
The text was updated successfully, but these errors were encountered: