java - UnsatisfiedLinkError on iOS but not Android, loadLibrary always succeeds -
i have java , c++ code can compile on both platforms , build native libraries. can verify libraries contain functions expect, , java able load libraries on android , ios. on android goes smoothly no crash, on ios frustrating error:
2015-05-11 11:34:48.418 ioslauncher[52454:851038] [info] test: initializing native libraries... 2015-05-11 11:34:48.418 ioslauncher[52454:851038] [info] test: library path set to: "/users/test/library/developer/coresimulator/devices/a189459d-b2d5-4e78-a6e4-a7ead19da017/data/containers/bundle/application/df265d55-da3c-4c10-851d-20591c4c8c06/ioslauncher.app" 2015-05-11 11:34:48.419 ioslauncher[52454:851038] [info] test: loading native libraries on x86_64... 2015-05-11 11:34:48.419 ioslauncher[52454:851038] [info] test: test 2015-05-11 11:34:48.424 ioslauncher[52454:851038] [info] test: loaded libraries java.lang.unsatisfiedlinkerror: com/test/native.getpointer()j @ com.test.native.getpointer(native method) @ com.test.wavapp.initnativeengine(wavapp.java) @ com.test.wavapp.create(wavapp.java) @ com.badlogic.gdx.backends.iosrobovm.iosgraphics.draw(iosgraphics.java) @ com.badlogic.gdx.backends.iosrobovm.iosgraphics$1.draw(iosgraphics.java) @ com.badlogic.gdx.backends.iosrobovm.iosgraphics$1.$cb$drawrect$(iosgraphics.java) @ org.robovm.apple.uikit.uiapplication.main(native method) @ org.robovm.apple.uikit.uiapplication.main(uiapplication.java) @ com.test.ioslauncher.main(ioslauncher.java) build successful total time: 18.262 secs
a snapshot of java code in com/test/native.java:
static { system.loadlibrary("test"); log.i("loaded libraries successfully"); } public static native long getpointer(); public static native void freepointer(long enginepointer);
and c++ code compiles libtest.dylib
:
extern "c" { jniexport jlong jnicall java_com_test_native_getpointer(jnienv* env, jobject thiz) { return (jlong)(new pointertest()); } jniexport void jnicall java_com_test_native_freepointer(jnienv* env, jobject thiz, jlong engineptr) { if ((pointertest*)engineptr) delete (pointertest*)engineptr; } }
some more info built shared library:
release$ file libtest.dylib libtest.dylib: mach-o 64-bit dynamically linked shared library x86_64
and verifying exports:
$ nm -g libtest.dylib | grep native 0000000000011ce0 t _java_com_test_native_freepointer 0000000000011c40 t _java_com_test_native_getpointer
any ideas? has been driving me crazy hours. can reproduce error on android device using different library , searching function. i'm guessing xcode somehow hiding or stripping symbols, doesn't seem correlate nm
output above shows there.
the solution in front of me, usual, in line:
libtest.dylib: mach-o 64-bit dynamically linked shared library x86_64
building ios, architecture should armv7+. misconfigured xcode subproject.
Comments
Post a Comment