由于未定义的引用,AOSP构建失败

时间:2013-03-18 13:46:22

标签: android c++ g++ android-source

我已经下载了Android 2.3.6源代码,并且我已经成功构建了它。然后,我在外部文件夹中添加了一个C ++库,我尝试构建它,但是当我这样做时,我收到了以下错误:

prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: path/to/myfile.cpp:26: error: undefined reference to '__cxa_end_cleanup'
prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: : error: undefined reference to '__gxx_personality_v0'
in function path/to/myfile.cpp:26: error: undefined reference to 'operator delete(void*)'

我将此行添加到Android.mk文件中:LOCAL_CXX = path / to / g ++ compiler 为了使用g ++编译器 但它仍然使用... / arm-eabi / bin / ld与其他库链接如何强制使用g ++作为链接器。

2 个答案:

答案 0 :(得分:2)

你需要编译&将C ++代码与g++相关联,而不是gcc

答案 1 :(得分:0)

'out/xxx/yyy.o: file is empty'一起出现同类错误。对我来说,原因是VM在构建过程中崩溃,导致一些文件损坏(不必执行repo sync,损坏的文件是二进制文件)。

我删除了包含有问题文件的目录,重新启动了构建过程,错误消失了。