前言
本人最近在研究Android源碼編譯,現將編譯過程中遇到問題匯總於此。
環境
系統:CentOS 7 x86_64
源 :中科大鏡像源(詳見這裡)
問題匯總
(1)Increase Java heap size
including ./tools/external/fat32lib/Android.mk ...
Starting build with ninja
ninja: Entering directory `.'
[ 0% 1/21542] Ensure Jack server is installed and started
Jack server already installed in "/home/smile/.jack-server"
Server is already running
[ 0% 2/21542] Building with Jack: out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/with-local/classes.dex
FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/with-local/classes.dex.rsp
Java heap space
Try increasing heap size with java option '-Xmx<size>'
Warning: This may have produced partial or corrupted output.
ninja: build stopped: subcommand failed.
build/core/ninja.mk:146: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
#### make failed to build some targets (08:25 (mm:ss)) ####
逛了一下stackoverflow找到了問題的解決方法(詳見這裡),在make之前進行heap size配置:
export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m"
out/host/linux-x86/bin/jack-admin kill-server
out/host/linux-x86/bin/jack-admin start-server
(2)找不到頭文件
此類問題本人是通過修改該目錄下的Android.mk文件,添加頭文件路徑解決的,但似乎不是最佳方式,如有更佳的解決方法,麻煩評論告知,謝謝!
(3)源碼文件問題
這個問題好奇怪,本人覺得repo checkout下來的源碼怎麼會有問題呢?但就遇到過一次奇怪的錯誤,然後打開錯誤的源頭一看,比較納悶:
./prebuilts/clang/host/linux-x86/clang-2690385/lib64/clang/3.8/include/avx512vlintrin.h
static __inline__ __m256i __DEFAULT_FN_ATTRS
_mm256_permutex2var_epi64 (__m256i __A, __m256i __I, __m256i __B) {
return (__m256i) __builtin_ia32_vpermt2varq256_mask ((__v4di) __I
/* idx */ ,
(__v4di) __A,
" (__v4di) __B, //就是這裡多了一個“"”
(__mmask8) -1);
}
把“ " ”去掉之後就可以編譯通過了。但我還是認為checkout下來的源碼應該都是經過嚴格核查的,所以如果有知道緣由的朋友麻煩告知一下,謝謝!