前言
本人最近在研究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
- ,
- (__v4di) __A,
- " (__v4di) __B, //就是这里多了一个“"”
- (__mmask8) -1);
- }
把“ " ”去掉之后就可以编译通过了。但我还是认为checkout下来的源码应该都是经过严格核查的,所以如果有知道缘由的朋友麻烦告知一下,谢谢!