的Android NDK 8B无法加载库 [英] Android ndk 8b Cannot load library
问题描述
升级到NDK 8B我收到了一些崩溃报告(其中大多数是GALAXY SII采用Android 4.03)
Upgrading to ndk 8b I receiving some crash report (most of them are Galaxy SII with Android 4.03)
java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1286]: 1836 cannot locate '__gnu_thumb1_case_uqi'...
at java.lang.Runtime.loadLibrary(Runtime.java:370)
at java.lang.System.loadLibrary(System.java:535)
at com.iuculano.fplayer.SDLActivity.void onCreate(android.os.Bundle)(SourceFile:324)
at android.app.Activity.performCreate(Activity.java:4465)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1932)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
at android.app.ActivityThread.access$600(ActivityThread.java:127)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4507)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
唯一的例外是由一个简单的的System.loadLibrary(主);
这是什么意思? 找不到__gnu_thumb1_case_uqi
推荐答案
在 __ gnu_thumb1_case_uqi
是一个帮助它确实在密集的开关表的索引跳跃;迅速实现了开关。你有两个选择:避免它或将它链接
The __gnu_thumb1_case_uqi
is a helper which does an indexed jump on a densely packed switch table; quickly implements the switch. You have two options: avoid it or link with it.
如果你增加一个优化的水平(通过使用 -O3
),你可能不需要这个符号。此外,更改CPU可以帮助以及使用 thumb2
的说明。与 -ffreestanding
选项进行编译,也可能会避免这种情况的象征。如果你有超过switch语句的控制,你可以用函数指针数组替换它。
If you increase an optimization level (by using -O3
) you might not need this symbol. Also, changing the CPU may help as well as using thumb2
instructions. Compiling with the -ffreestanding
option may also avoid this symbol. If you have control over the switch statement, you can replace it with an array of function pointers.
这个程序里面的 libgcc中的。您可以静态链接的 libgcc中的。某处在Android SDK /编译器,必须有一个 libgcc.a的
。链接与 libgcc.a的
,使用 -L
和 -l </ code >或使用
-static-libgcc中
链接器选项来获得code(请参阅<一href="http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html">http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html).
This routine is inside libgcc. You can statically link libgcc. Somewhere in the Android SDK/compiler, there must be a libgcc.a
. Link with libgcc.a
, using -L
and -l
or use -static-libgcc
linker option to get the code (see http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html).
编辑:如果您不编译任何东西,那么你可以找到 libgcc.so
您的系统。这可能是在 / lib目录
或 / usr / lib目录
或者一些奇怪的地方为Android设备。添加目录下的 libgcc.so
座落于环境变量的 LD_LIBRARY_PATH
也解决问题。这也许不幸的是,三星发布不兼容的二进制文件,你有没有办法解决这个问题,如果你没有编译你自己的code。正确的 libgcc.so
也许里面的东西像 / usr / lib中/拇指
多LIB分布。我不知道很多有关Davlik东西,但Android的JVM可能不指向正确的库在运行时。
If you aren't compiling anything, then you can find libgcc.so
on your system. It might be in /lib
or /usr/lib
or perhaps some place weird for Android devices. Adding the directory where the libgcc.so
is located to the environment variable LD_LIBRARY_PATH
could also fix the problem. It maybe unfortunate that Samsung released incompatible binaries and you have no way to fix the issue if you aren't compiling your own code. The correct libgcc.so
maybe inside something like /usr/lib/thumb
for multi-lib distributions. I don't know much about the Davlik stuff, but the Android JVM might not pointing to the right set of libraries when it runs.
这篇关于的Android NDK 8B无法加载库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!