当我尝试在Android上启动基于C ++的应用程序时,我得到了不满意的链接错误。只有在我使用任何STL机制时才会出现问题,当我注释掉所有std::vector
等问题时,问题就会消失。
new operator
也会导致链接错误不满意)
我使用自定义的独立工具链来构建二进制文件(定位到android 1.6),并将其与libstdc++.a
,libGLESv1_CM.a
,liblog.a
和libm.a
相关联。
在Java中我打电话:
static {
System.loadLibrary("GLESv1_CM");
System.loadLibrary("Game");
}
确切的构建顺序是:
engine_sources -> libengine.a
game_sources + libengine.a + all mentioned libraries (using --whole-archive for each) -> libGame.so
Java_framework + libGame.so -> Game.apk
我有什么遗失的吗?
EDIT2:
正如http://mpigulski.blogspot.com/2010/09/debugging-dlopen-unsatisfiedlinkerror.html中所建议的,我运行arm-linux-androideabi-ld.exe libGame.so
并得到了这个:
arm-linux-androideabi-ld.exe: warning: cannot find entry symbol _start; defaulting to 00008270
libGame.so: undefined reference to `__aeabi_fadd'
libGame.so: undefined reference to `__aeabi_fcmpgt'
libGame.so: undefined reference to `__aeabi_i2f'
libGame.so: undefined reference to `__aeabi_dmul'
libGame.so: undefined reference to `__aeabi_d2f'
libGame.so: undefined reference to `vtable for OpenGLRenderer'
libGame.so: undefined reference to `__aeabi_fsub'
libGame.so: undefined reference to `__aeabi_idiv'
libGame.so: undefined reference to `__aeabi_fdiv'
libGame.so: undefined reference to `__aeabi_uidiv'
libGame.so: undefined reference to `__aeabi_fcmpeq'
libGame.so: undefined reference to `__aeabi_fmul'
libGame.so: undefined reference to `__aeabi_fcmplt'
libGame.so: undefined reference to `__aeabi_f2d'
我特别关注
libGame.so: undefined reference to `vtable for OpenGLRenderer'
OpenGLRenderer
是我用new
创建的抽象类的子代。我在这里错过了什么吗?
答案 0 :(得分:3)
如果人们正在寻找libsupc ++。a,你可以在:
下找到它./sources/cxx-stl/gnu-libstdc++/libs/
这也是libgnustl_shared.so的地方 (对不起,无法在上一个答案中添加评论,不够代表)
答案 1 :(得分:2)
你可能错过了libsupc++.a
。它是rtti和例外所必需的。您应该明确禁用rtti和例外(-fno-rtti -fno-exceptions
)或链接此库。