I have a JNI library that was used for an Android application with NDK. I have no sources, only compiled .so files for some arches.
I want to call functions from this library in a simple Java console application on a 64-bit x86 Linux machine.
What I've done:
- I took the library from the x86_64 folder and loaded it into my Java program using
System.loadLibrary - I tried to run the program and received an UnsatisfiedLinkError with details
liblog.so: cannot open shared object file: No such file or directory. - So, I took liblog.so for x86_64 arch from the official NDK and downloaded it and then got the same error with
libstdc++.so: cannot open shared object file: No such file or directory - I did the same for libstdC ++, so the library got it
/usr/lib/x86_64-linux-gnu/libc.so: invalid ELF header. - I opened libc.so and turned out to be just a text file ... Replaced it with the corresponding libc.so file
- Finally, UncatisfiedLinkError got my library with a comment
undefined symbol: __stack_chk_guard. It looks like my library is very tight with Android stuff.
What should I do to use this library in my regular program without any Android features?
source
share