-
Notifications
You must be signed in to change notification settings - Fork 90
Description
Hi, I want to use Yara-x on Android NDK. I tried capi route but I can't success my goal. Also I tried using Cargo-NDK for this problem but I didn't make it. I build .so file with capi route on my workspace then I import it to NDK side. then I run .so file on My Android Project, throw this error.
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__start_linkm2_WASM_EXPORTS" referenced by "/data/app/~~5Fpt3ItyieLDSTQ_qcAjGQ==/com.example.rusttest-rX6ueNDFx7c4VTCEvqJ1WQ==/base.apk!/lib/x86_64/libyara.so"...
I researched WASM_EXPORTS linker and I understand what is that but I didn't disable this linker. I asked different LLM(ChatGPT & DeepSeek) but They didn't give me the correct results.
I build capi with this command.
cargo ndk -t arm64-v8a -t x86_64 -t i686-linux-android -t armv7-linux-androideabi -t aarch64-linux-android -o ./libs build --release
I added .so file to My Android Project this way.
`add_library(yara SHARED IMPORTED)
set_target_properties(yara PROPERTIES INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/include)
set_target_properties(yara PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}/libyara.so)
add_library(${CMAKE_PROJECT_NAME} SHARED
# List C/C++ source files with relative paths to this CMakeLists.txt.
native-lib.cpp)
target_link_libraries(${CMAKE_PROJECT_NAME}
library
yara
android
log)`
I think, I added successfully .so file to My Project but I didn't/can't resolve this problem.
I hope someone worked or tried Android implementation for Yara-x. Sorry for all grammer mistakes and Thanks all Helps.