AOSP 安卓源码7.1-ubuntu17.04编译问题
Q1.首次编译报错(Ubuntu14.04-Android6.0)
Log: ERROR: Bad request, see Jack server log (/tmp/jack-envy15/jack-8072.log)
Q2.首次编译报错GC overhead limit exceeded (Ubuntu17.04-Android7.1)
关键Log:
Out of memory error (version 1.3-rc6 'Douarn' (441800 22a11d4b264ae70e366aed3025ef47362d1522bb by android-jack-team@google.com)). GC overhead limit exceeded. Try increasing heap size with java option '-Xmx<size>'. // android-7.1.1_r16 FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/with-local/classes.dex.rsp Out of memory error (version 1.2-rc4 'Carnac' (298900 f95d7bdecfceb327f9d201a1348397ed8a843843 by android-jack-team@google.com)). Java heap space. Try increasing heap size with java option '-Xmx<size>'. Warning: This may have produced partial or corrupted output. |
解决方案:
Out of memory error(2次) |
方法1 |
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 |
Q3.首次编译权限报错(Ubuntu17.04-Android7.1)
关键Log:
opendir failed: .dbus: Permission denied |
解决方案:
Permission denied |
方法1 |
sudo chmod 777 e2670/ -R |
Q4.编译报错无效UTF-8字符(Ubuntu17.04-Android7.1)
关键Log:
art/runtime/interpreter/unstarted_runtime.cc:1517:1: error: source file is not valid UTF-8 |
解决方案:
UTF-8字符集错误 |
方法1 |
参考GOOGLO代码修正错误 |
Q5.报错fatal: fork: Cannot allocate memory (Ubuntu17.04-Android7.1)
关键Log:
[ 3% 802/22494] Install: out/target/p...duct/angler/system/app/Music/Music.apk ninja: fatal: fork: Cannot allocate memory build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed make: *** [ninja_wrapper] Error 1 |
解决方案:
无法分配内存(2次) |
方法1 |
sysctl kernel.pid_max // 查看最大进程数 ps -eLf | wc –l // 查看运行进程数 // 修改最大进程数后系统恢复 echo 1000000 > /proc/sys/kernel/pid_max // 永久生效 echo "kernel.pid_max=1000000 " >> /etc/sysctl.conf sysctl –p 结果:无权限修改最大进程数 |
方法2 |
查看虚拟机内存分配只有6G左右,关闭虚拟机内存调整到8G,编译正常。 |
Ref:
-bash: fork: Cannot allocate memory 问题的处理
Q6. Communication error with Jack server (52).(Ubuntu17.04-Android7.1)
关键Log:
[ 14% 3153/21625] Building with Jack: ...k_intermediates/with-local/classes.dex FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex.rsp Communication error with Jack server (52). Try 'jack-diagnose' [ 14% 3153/21625] target C++: sgdisk <= external/gptfdisk/gptcl.cc external/gptfdisk/gptcl.cc:36:29: warning: unused parameter 'filename' [-Wunused-parameter] GPTDataCL::GPTDataCL(string filename) { ^ external/gptfdisk/gptcl.cc:109:43: warning: missing field 'descrip' initializer [-Wmissing-field-initializers] POPT_AUTOHELP { NULL, 0, 0, NULL, 0 } ^ 2 warnings generated. ninja: build stopped: subcommand failed. build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed make: *** [ninja_wrapper] Error 1 |
解决方案:
Communication error with Jack server |
方法1 |
jack-admin start-server Launching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -cp /home/galian/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher 结果:command not found |
方法2 |
jack-admin start-server ref:link |
Ref:
打造自己的Android源码学习环境之五:编译Android源代码
Android7.0 JACK编译器不支持多用户同时编译的问题的解决
Q7. The program 'mm' is currently not installed.(Ubuntu17.04-Android7.1)
关键Log:
The program 'mm' is currently not installed. You can install it by typing: sudo apt install multimail |
解决办法:
. build/envsetup.sh
Ref:
Q8. No rule to make target 'xxx/.git/index'
安卓源码android7.1.1-r16删除.repo文件后编译报错No rule to make target 'xxx/.git/index'
关键Log:
No rule to make target 'xxx/.git/index' |
解决办法:
mgrep git/index搜索源码引用位置
修改:/build/kati/Makefile.ckati
ifneq ($(KATI_GIT_DIR),)
# KATI_VERSION_DEPS := $(KATI_GIT_DIR)/.git/HEAD $(KATI_GIT_DIR)/.git/index
# KATI_VERSION := $(shell git -C $(KATI_GIT_DIR) rev-parse HEAD)
注释掉git相关编译设置
Ref:
android5.0编译问题:No rule to make target '/third_party/angle/.git/index'
参考:
AOSP