0

My code is crashing on System.loadLibrary("hypoboleus"); with an error that it cannot find an entry point. I have created a so file and included it in the app/src/main/jniLibs/arm64-v8a/ folder as libhypoboleus.so. The Java runtime is calling java.lang.Runtime.loadLibrary0, which is trying to run getThreadLocalsEv from my so file.

This used to work in an earlier version of the NDK, but I upgraded and then it made me change my build script. My current version of the NDK is 25.2.9519653.

The specific message text is java.lang.UnsatisfiedLinkError: dlopen failed: TLS symbol "_ZZN8gwp_asan15getThreadLocalsEvE6Locals" in dlopened "/data/app/~~nqWwoXRjQhq9nhyacG54hA==/hk.jennyemily.hypoboleus-EFD9ul4kulUwExi3Ee0LJQ==/base.apk!/lib/arm64-v8a/libhypoboleus.so" referenced from "/data/app/~~nqWwoXRjQhq9nhyacG54hA==/hk.jennyemily.hypoboleus-EFD9ul4kulUwExi3Ee0LJQ==/base.apk!/lib/arm64-v8a/libhypoboleus.so" using IE access model.

The entry point is present in the so file: nm -D gives 0000000000000000 W _ZZN8gwp_asan15getThreadLocalsEvE6Locals.

My build line is path-to-ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target aarch64-linux-android-clang -nostartfiles -shared path/hypoboleus_wrap.c path/libhypoboleus_c.a -lm -lz -o path/libhypoboleus.so -I path -fPIC [I have simplified the paths]

I've tried what I think is the obvious but nothing seems to work. All I can think of is that I am building C but the error refers tyo what looks to me like a C++ entry. The code is mainly written in Rust (pretending to be C) with a standard shim generated by SWIG.

Can anyone please advise me, or at least give me some idea how to investigate further?

Martin Ellison
  • 1,043
  • 1
  • 13
  • 25

0 Answers0