ubuntu16.04 64bit編譯android5.1錯誤

之前使用ubuntu12.04 64bit編譯Android時並沒有出現較大的錯誤,將平臺更換到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++: libc++ <= external/libcxx/src/algorithm.cpp
host C++: libc++ <= external/libcxx/src/bind.cpp
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
make: *** 正在等待未完成的任務....

source_android代表你的android源碼根目錄

1.修改

cd  <source_android>/art/build/
vim Android.common_build.mk    //修改第119行
修改前:
# Host.
ART_HOST_CLANG := false
ifneq ($(WITHOUT_HOST_CLANG),true)
# By default, host builds use clang for better warnings.
ART_HOST_CLANG := true
endif
修改後:
# Host.
ART_HOST_CLANG := false
ifneq ($(WITHOUT_HOST_CLANG),false)
# By default, host builds use clang for better warnings.
ART_HOST_CLANG := true
endif

2.修改
經過第一次修改之後發現編譯還是報同樣的錯誤,執行下面:

cp /usr/bin/ld.gold   <source_android>/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld

3.修改過上述代碼後,最好執行一次make update-api,在make

ubuntu16.04 64bit編譯android5.1錯誤

發佈了84 篇原創文章 · 獲贊 25 · 訪問量 12萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章