之前使用Ubuntu 12.04 64bit编译Android时并没有出现较大的错误,将平台更换到Ubuntu 16.04时编译出错,且该错误并不好查找,因此特意记录下来。
libnativehelper/JniConstants.cpp:103: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:104: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:105: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:106: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:107: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:108: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:109: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:110: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:111: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:112: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:113: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:114: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:115: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:116: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:117: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:118: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:119: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:120: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:121: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:122: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:123: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:124: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:125: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:126: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:127: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:128: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:129: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:130: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:131: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:132: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:133: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:134: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:135: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:136: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:137: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:138: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:139: error: unsupported reloc 43
libnativehelper/JniConstants.cpp:140: error: unsupported reloc 43
libnativehelper/toStringArray.cpp:21: error: unsupported reloc 43
libnativehelper/toStringArray.cpp:21: error: unsupported reloc 43
libnativehelper/JniInvocation.cpp:40: error: unsupported reloc 43
libnativehelper/JniInvocation.cpp:45: error: unsupported reloc 43
libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43
libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43
libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43
libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43
clang: error: linker command failed with exit code 1 (use -v to see invocation)
host C&#43;&#43;: libc&#43;&#43; <&#61; external/libcxx/src/algorithm.cpp
host C&#43;&#43;: libc&#43;&#43; <&#61; external/libcxx/src/bind.cpp
build/core/host_shared_library_internal.mk:44: recipe for target &#39;out/host/linux-x86/obj32/lib/libnativehelper.so&#39; failed
make: *** [out/host/linux-x86/obj32/lib/libnativehelper.so] Error 1
make: *** 正在等待未完成的任务....
source_android代表你的android源码根目录
1.修改
cd /art/build/
vim Android.common_build.mk //修改第119行
修改前&#xff1a;
# Host.
ART_HOST_CLANG :&#61; false
ifneq ($(WITHOUT_HOST_CLANG),true)
# By default, host builds use clang for better warnings.
ART_HOST_CLANG :&#61; true
endif
修改后&#xff1a;
# Host.
ART_HOST_CLANG :&#61; false
ifneq ($(WITHOUT_HOST_CLANG),false)
# By default, host builds use clang for better warnings.
ART_HOST_CLANG :&#61; true
endif
2.修改
经过第一次修改之后发现编译还是报同样的错误&#xff0c;执行下面&#xff1a;
cp /usr/bin/ld.gold /prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld
3.修改过上述代码后&#xff0c;最好执行一次make update-api&#xff0c;在make