I am having trouble getting minizip to work on android. I first tried to link it as a static against my application shared library. However as soon as I used code from that minizip library I got a
UnsatisfiedLinkError. I have a few other libraries that do work, libzip and libpng. So to compare I compiled all three into shared libraries and use System.loadLibrary(“libpng”); System.loadLibrary(“libzip”);
System.loadLibrary(“minizip”); to load them before the application.
The LogCat outputs this:
02-28 21:12:23.371: D/dalvikvm(21023): Trying to load lib /data/data/com.flotsamworks.seadrift/lib/liblibpng.so 0x4a315c18
02-28 21:12:23.381: D/dalvikvm(21023): Added shared lib /data/data/com.flotsamworks.seadrift/lib/liblibpng.so 0x4a315c18
02-28 21:12:23.381: D/dalvikvm(21023): No JNI_OnLoad found in /data/data/com.flotsamworks.seadrift/lib/liblibpng.so 0x4a315c18, skipping init
02-28 21:12:23.411: D/dalvikvm(21023): Trying to load lib /data/data/com.flotsamworks.seadrift/lib/liblibzip.so 0x4a315c18
02-28 21:12:23.421: D/dalvikvm(21023): Added shared lib /data/data/com.flotsamworks.seadrift/lib/liblibzip.so 0x4a315c18
02-28 21:12:23.431: D/dalvikvm(21023): No JNI_OnLoad found in /data/data/com.flotsamworks.seadrift/lib/liblibzip.so 0x4a315c18, skipping init
02-28 21:12:23.431: D/dalvikvm(21023): Trying to load lib /data/data/com.flotsamworks.seadrift/lib/libminizip.so 0x4a315c18
02-28 21:12:23.451: I/dalvikvm(21023): Unable to dlopen(/data/data/com.flotsamworks.seadrift/lib/libminizip.so): Cannot load library: link_image[2033]: failed to link libminizip.so
As you can see minizip fails. but why? I really have no clue. Compiling is effortless, no problems there. I suspect its relying on some stuff android doesn’t have or a more up to date libz.
As for compiling I only have these linker options set which are the very same for libzip and libpng. -shared -Wl,–fix-cortex-a8 -lz
I have uploaded the project if you would like to have a look at the makefiles and code.
I code/ is the code…. in build/android8_gmake/ you can find build.sh, configure the three paths to gcc, g++ and ar.
In ./debug/bin you’ll find the already build shared objects i used.
http://projects.woutervandongen.com/thirdparty_sharedlibs_28_2_12.zip
I use NDKr7b with the custom toolchain generated by:
make-standalone-toolchain.sh –platform=android-8 –install-dir=./standalone-toolchain-api8
Please help
Regards,
Wouter
Quite stupid!
Since Android does not support fseeko64 minizip won’t link properly.
I looked for a define to get around this and found it to be;
Problem solved!