Failed to link libstlport_shared although it is present ...?

I'm just ready to start banging my head on the wall here. I read every SO thread that I can find on this issue, reading every Google result on this issue and can't find squats. I am creating an Android application where I wrote a 2D engine in C ++, and I use the generic version of stlport with the NDK r6b. The .so file for libstlport_shared was generated and copied successfully to my libs folder. I even checked the use of the adb shell on the device and the .so file was copied correctly.

I tried various solutions, such as modifying my .mk file, to explicitly declare libstlport_shared.so as a necessary module. During compilation, everything goes fine, it appears in the APK, it successfully copies to the device. But I get this error:

09-17 17:35:26.450: DEBUG/dalvikvm(19277): Trying to load lib /data/data/ca.ascensionsystems.mypackagename/lib/libstlport_shared.so 0x476c6f30 09-17 17:35:26.450: INFO/dalvikvm(19277): Unable to dlopen(/data/data/ca.ascensionsystems.mypackagename/lib/libstlport_shared.so): Cannot load library: link_image[1995]: failed to link libstlport_shared.so 09-17 17:35:26.450: WARN/dalvikvm(19277): Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lca/ascensionsystems/mypackagename/Ascengine;.<clinit> 09-17 17:35:26.450: WARN/dalvikvm(19277): threadid=8: thread exiting with uncaught exception (group=0x40025a70) 09-17 17:35:26.470: VERBOSE/WindowManager(4837): Remove Window{479ca678 Starting ca.ascensionsystems.mypackagename paused=false}: mSurface=Surface(name=Starting ca.ascensionsystems.mypackagename, identity=90) mExiting=false isAnimating=true app-animation=android.view.animation.AnimationSet@4794fa10 inPendingTransaction=false mDisplayFrozen=false 09-17 17:35:26.470: ERROR/WindowManager(4837): return in removeWindowLocked 09-17 17:35:26.490: ERROR/AndroidRuntime(19277): FATAL EXCEPTION: GLThread 9 09-17 17:35:26.490: ERROR/AndroidRuntime(19277): java.lang.ExceptionInInitializerError 09-17 17:35:26.490: ERROR/AndroidRuntime(19277): at ca.ascensionsystems.mypackagename.GL2JNIView$Renderer.onSurfaceChanged(GL2JNIView.java:336) 09-17 17:35:26.490: ERROR/AndroidRuntime(19277): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1327) 09-17 17:35:26.490: ERROR/AndroidRuntime(19277): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118) 09-17 17:35:26.490: ERROR/AndroidRuntime(19277): Caused by: java.lang.UnsatisfiedLinkError: Library stlport_shared not found 09-17 17:35:26.490: ERROR/AndroidRuntime(19277): at java.lang.Runtime.loadLibrary(Runtime.java:461) 09-17 17:35:26.490: ERROR/AndroidRuntime(19277): at java.lang.System.loadLibrary(System.java:557) 09-17 17:35:26.490: ERROR/AndroidRuntime(19277): at ca.ascensionsystems.mypackagename.Ascengine.<clinit>(Ascengine.java:26) 09-17 17:35:26.490: ERROR/AndroidRuntime(19277): ... 3 more 09-17 17:35:26.500: WARN/ActivityManager(4837): Force finishing activity ca.ascensionsystems.mypackagename/.mypackagenameActivity 

Please note that I replaced my real package name with "mypackagename" so as not to give out the super secret amazing name of my upcoming game. :) Also note that Ascengine is another .SO, my main SO application, which is my 2D engine .

Does anyone have such a problem? Any ideas? Also note that I ran objdump on libstlport_shared to check its deps. I confirmed that they exist on my device with DDMS and even explicitly load them into Java code before trying to download libstlport_shared. There was no difference. Thanks in advance!

also

This is a minor, optional component for the question. One solution that I thought about, but have not tried using System.load (absolutePathToLibrary) yet, but I cannot find a way to create this path in java. I do not want to hard code it for obvious reasons. Thanks again!

+6
source share
1 answer

Well, it looks like I found a solution, sort of. I basically just refused to use the general version of the STL port and switched to static. Then I restored the static version using the Application.mk flag: STLPORT_FORCE_REBUILD := true

However, I still had strange problems. It compiled once and installed perfectly. Then I did a clean and redone / deployed one and it would end up fine, and then say that my application had errors in the dialog box, but not really in eclipse. I got out of the eclipse, restarted it, cleaned and rebuilt, and now everything works. It seems like some errors / problems with the latest NDK ... hopefully they will be fixed with NDK r7 when they will make a full STL port with exceptions, etc.

+2
source

Source: https://habr.com/ru/post/897536/


All Articles