最近在ubantu16.04的服務器上編譯5.1源碼出錯 嘗試了幾種解決辦法
首先
在根目錄 中找到
/art/build/Android.common_build.mk,
-
<span style="font-size:18px;"># Host.
-
ART_HOST_CLANG := false
-
ifneq ($(WITHOUT_HOST_CLANG),true)
-
# By default, host builds use clang for better warnings.
-
ART_HOST_CLANG := true
-
endif</span>
改成
-
<span style="font-size:18px;"># Host.
-
ART_HOST_CLANG := false
-
ifneq ($(WITHOUT_HOST_CLANG),true)
-
# By default, host builds use clang for better warnings.
-
ART_HOST_CLANG := true
-
endif</span>
如果已解決問題 則忽略下面文字
如果未解決,編譯可能會報
-
art/runtime/atomic.h: In static member function 'static void art::QuasiAtomic::ThreadFenceAcquire()':
-
15 art/runtime/atomic.h:155:5: error: 'atomic_thread_fence' is not a member of 'std'
-
16 art/runtime/atomic.h:155:30: error: 'memory_order_acquire' is not a member of 'std'
-
17 art/runtime/atomic.h: In static member function 'static void art::QuasiAtomic::ThreadFenceRelease()':
-
18 art/runtime/atomic.h:159:5: error: 'atomic_thread_fence' is not a member of 'std'
-
19 ...
-
20 ...
-
21 cc1plus: all warnings being treated as errors
這個一般是由於ubantu16.04系統中 默認使用gcc g++ 5.4
通過gcc -v 命令可以查看gcc版本
-
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
可以嘗試一下步驟
1 復原前面對/art/build/android.common_build.mk文件的修改
2 rm -rf out 刪除out目錄
3 在源碼根目錄 執行 cp /usr/bin/ld.gold prebuilts/gcc/Linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld
4 更新下api
5 嘗試重新編譯 make -j16
make update-api