ubuntu1604编译android5.1(android L)失败error: unsupportedreloc 43等问题
1.编译的问题
见session_root1
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld:error: out/host/linux-x86/obj32/SHARED_LIBRARIES/libsigchain_intermediates/sigchain_dummy.o:unsupported reloc 43 against global symbol std::cout
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld:error:out/host/linux-x86/obj32/SHARED_LIBRARIES/libsigchain_intermediates/sigchain_dummy.o:unsupported reloc 43 against global symbol __dso_handle
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld:error:out/host/linux-x86/obj32/SHARED_LIBRARIES/libsigchain_intermediates/sigchain_dummy.o:unsupported reloc 43 against global symbol std::ios_base::Init::~Init()
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/include/c++/4.6/ostream:515:error: unsupported reloc 43
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/include/c++/4.6/iostream:75:error: unsupported reloc 43
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/include/c++/4.6/iostream:75:error: unsupported reloc 43
clang: error: linker command Failed withexit code 1 (use -v to see invocation)
build/core/host_shared_library_internal.mk:44:recipe for target 'out/host/linux-x86/obj32/lib/libsigchain.so' Failed
make: ***[out/host/linux-x86/obj32/lib/libsigchain.so] Error 1
(1)修改art/build/Android.common_build.mk文件
ifneq ($(WITHOUT_HOST_CLANG),true)
改为:
ifeq ($(WITHOUT_HOST_CLANG),false)
sudo vi art/build/Android.common_build.mk
/WITHOUT_HOST_CLANG #搜索该字符的位置
编译还是有问题,如下:
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld:error:out/host/linux-x86/obj32/SHARED_LIBRARIES/libnativehelper_intermediates/JNIHelp.o:unsupported reloc 43 against global symbolstd::string::_Rep::_S_empty_rep_storage
…
libnativehelper/JniInvocation.cpp:165:error: unsupported reloc 43
clang: error: linker command Failed withexit code 1 (use -v to see invocation)
build/core/host_shared_library_internal.mk:44:recipe for target 'out/host/linux-x86/obj32/lib/libnativehelper.so' Failed
make: *** [out/host/linux-x86/obj32/lib/libnativehelper.so]Error 1
从报错信息来看,是在链接 host 程序时出错。链接 host 程序时用的工具链是放在 codebase 中的,即prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/../lib/gcc/x86_64-linux/4.6/../../../../x86_64-linux/bin/ld.
(2)cp /usr/bin/ld.goldprebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld
(3)编译后提示make updat-api
执行make update-api后继续编译就正常了。
参考链接:
https://stackoverflow.com/questions/36048358/building-android-from-sources-unsupported-reloc-43
Ubuntu 16.04 编译Android6.0系统源码
http://www.jb51.cc/article/p-zdsakhpj-bde.html
Ubuntu 16.04 Android 5.1编译环境搭建记录
http://blog.csdn.net/a906754899/article/details/71522173
ubuntu16.04 64bit编译android5.1错误
http://blog.csdn.net/u014770862/article/details/52624851
Ubuntu16 编译源码出错unsupported reloc 43