Android的NDK无法加载库:reloc_library [1306] [英] Android NDK Cannot load library: reloc_library[1306]

查看:312
本文介绍了Android的NDK无法加载库:reloc_library [1306]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时通讯开发一个Android应用程序加载这就是两个共享库。一个是外部的,其所谓的libpcan.so。通常它的编译版本libpcan.so.0.6,这在某种程度上不能用我的Andr​​oid使用,所以我改变了GCC标志进行编译它:

Im developing an android app thats loading two shared libraries. One is external, its called libpcan.so . Usually its build to libpcan.so.0.6, this somehow cant be used by my android, i so changed the gcc flags compiling it from:

arm-linux-androideabi-gcc src/libpcan.c -fPIC -shared -O2 -Wall -Wl,-soname,-libpcan.so.0 -lc -I. -I../driver -DNO_RT -o -libpcan.so.0.6
ln -sf libpcan.so.0.6 libpcan.so

arm-linux-androideabi-gcc src/libpcan.c -fPIC -shared -O2 -Wall -lc -I. -I../driver -DNO_RT -o -libpcan.so

这。所以有大小为so.0.6一样的,所以我认为它工作得很好。

This .so has the same size as the so.0.6 so i assume it worked fine.

我自己的C- code是越来越编译

My own c-code is getting compiled with

arm-linux-androideabi -shared src/receivetest.c src/common.c -I. -I../lib -I../driver -L../lib -L/lib -L/usr/lib -L/usr/local/lib -o libreceivetest.so

我打开这两个文件,​​所以libpcan.so和libreceivetest.so到我的应用

I load both of these files, so the libpcan.so and the libreceivetest.so to my app

    static {
    System.loadLibrary("pcan");
    System.loadLibrary("receivetest");
    }

当我试图启动该应用程序,我得到的错误信息:

When I'm trying to launch that app i get the error message:

 07-14 11:12:43.812: E/AndroidRuntime(753): java.lang.ExceptionInInitializerError
 07-14 11:12:43.812: E/AndroidRuntime(753): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]:    36 cannot locate 'CAN_Open'...

我receivetest正在使用该功能,但由于它在libpcan.so和IM也宣布了加载库,我不知道在哪里的错误可能来自。
我只是猜测其错误在我clags,因为我是新来通过使用gcc在shell我真的不明白所有的标志使用即时通讯建设.so文件。

My receivetest is using that function, but since it declared in the libpcan.so and im also loading that library, i don't know where that error could come from. I'd just guess its an error in my clags, since I'm new to building .so files via using gcc in the shell i don't really understand all the flags im using.

推荐答案

这是相当长的,因为我解决了这个。但是我还没有标记这个问题的解决。
感谢JWW提醒我。

It's quite long since i solved this. But I haven't ever marked this question as solved. Thanks to jww for reminding me.

正如我在我的问题的意见已经说过了,在链接功能CAN_Open在编译的.so文件丢失,由于缺少参数。该功能CAN_Open是跳过链接到文件CAN_Open函数只是没有把它放入receivetest.so的libpcan.so和一个组成部分。

As I've said in the comment to my question, the link to the function CAN_Open was missing due to a missing parameter at compiling the .so-file. The function CAN_Open is a part of the libpcan.so and by skipping the link to that file the CAN_Open function just never made it into the receivetest.so .

这篇关于Android的NDK无法加载库:reloc_library [1306]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆