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

AOSP building fails due to undefined references

本文关键字:AOSP 构建 失败 引用 未定义      更新时间:2023-10-16

我已经下载了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中添加了这一行。可文件:LOCAL_CXX =路径//g++编译器为了使用g++编译器但它仍然使用……/arm-eabi/bin/ld链接到其他库,我如何强制使用g++作为链接器?

你需要编译&链接带有g++而非gcc的c++代码

有相同类型的错误,以及'out/xxx/yyy.o: file is empty'。对我来说,原因是VM在构建过程中崩溃,留下一些文件损坏(不需要做repo sync,损坏的文件是二进制文件)。

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