查看: 1920|回复: 0

AOSP代码编译hikey版本出错修改方法

[复制链接]

该用户从未签到

发表于 2016-8-4 08:41:54 | 显示全部楼层 |阅读模式
分享到:
之前听说aosp支持在hikey上开发,手头正好有一块爱板网提供的hikey板子,于是打算下载一套aosp代码,编译试试。
我用的是ubuntu虚拟机编译的,以为编译过程会很容易,不会有什么问题,但是中途还是遇到了好几个问题:
第一个问题就是aosp代码下载的问题,需要翻墙,于是用修改hosts的方法解决了。下完代码,就是2天之后的事情了,因为网速太慢。
接下来便开始编译,因为之前这个虚拟机编译过高通的代码,我以为编译aosp应该问题不大,遇到的问题如下:
Out of memory error (version 1.2-rc4 'Carnac' (298900 f95d7bdecfceb327f9d201a1348397ed8a843843 by android-jack-team@google.com)).
GC overhead limit exceeded.
Try increasing heap size with java option '-Xmx<size>'.
Warning: This may have produced partial or corrupted output.
[ 13% 3151/23549] Building with Jack: out/target/common/obj/JAVA_LIBRARIES/xmp_toolkit_intermediates/classes.jack
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1
make: Leaving directory `/home/zxc/aosp'
[ 42% 17556/41298] Building with Jack: out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/dex-dir/classes.dex
FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/dex-dir/classes.dex.rsp
Communication error with Jack server (52). Try 'jack-diagnose'
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1
make: Leaving directory `/home/zxc/aosp
[ 13% 3740/28719] build out/target/common/obj/JAVA_LIBRARIES/sdk_v23_intermediates/classes.jack
FAILED: /bin/bash -c "(mkdir -p out/target/common/obj/JAVA_LIBRARIES/sdk_v23_intermediates/classes.jack.tmpjill.res ) && (unzip -qo prebuilts/sdk/23/android.jar -d out/target/common/obj/JAVA_LIBRARIES/sdk_v23_intermediates/classes.jack.tmpjill.res ) && (find out/target/common/obj/JAVA_LIBRARIES/sdk_v23_intermediates/classes.jack.tmpjill.res -iname \"*.class\" -delete ) && (JACK_VERSION=3.36.CANDIDATE out/host/linux-x86/bin/jack @build/core/jack-default.args  -D jack.import.resource.policy=keep-first -D jack.import.type.policy=keep-first -D jack.android.min-api-level=1 --import prebuilts/sdk/23/android.jar --import-resource out/target/common/obj/JAVA_LIBRARIES/sdk_v23_intermediates/classes.jack.tmpjill.res --output-jack out/target/common/obj/JAVA_LIBRARIES/sdk_v23_intermediates/classes.jack ) && (rm -rf out/target/common/obj/JAVA_LIBRARIES/sdk_v23_intermediates/classes.jack.tmpjill.res )"
Communication error with Jack server (28). Try 'jack-diagnose'
[ 13% 3747/28719] Building with Jack: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/dex-dir/classes.dex
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1
make: Leaving directory `/home/zxc/aosp'
Communication error with Jack server (28). Try 'jack-diagnose'
[ 86% 11772/13560] Building with Jack: out/target/common/obj/JAVA_LIBRARIES/services.core_intermediates/classes.jack
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1
make: Leaving directory `/home/zxc/aosp'
  Communication error with Jack server (28). Try 'jack-diagnose'
[  5% 107/1795] Building with Jack: out/target/common/obj/JAVA_LIBRARIES/services.backup_intermediates/classes.jack
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1
make: Leaving directory `/home/zxc/aosp'
解决方法如下:
1、修改Java heap size的大小,参见下面的链接:
https://stackoverflow.com/questions/34940793/increasing-heap-size-while-building-the-android-source-code-on-ubuntu-15-10
zxc@zxc-vbox:~/aosp/build/core$ vim config.mk +629
zxc@zxc-vbox:~/aosp/build/core$ git diff .
diff --git a/core/config.mk b/core/config.mk
index b179881..0863871 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -626,7 +626,7 @@ endif
APICHECK_CLASSPATH := $(HOST_JDK_TOOLS_JAR)
APICHECK_CLASSPATH := $(APICHECK_CLASSPATH)(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
APICHECK_CLASSPATH := $(APICHECK_CLASSPATH)(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX)
-APICHECK_COMMAND := $(APICHECK) -JXmx1024m -J"classpath $(APICHECK_CLASSPATH)"
+APICHECK_COMMAND := $(APICHECK) -JXmx2048m -J"classpath $(APICHECK_CLASSPATH)"
2、安装android.com中指定的安装包
Installing required packages (Ubuntu 14.04)
You will need a 64-bit version of Ubuntu. Ubuntu 14.04 is recommended.
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
  lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
  libgl1-mesa-dev libxml2-utils xsltproc unzip
3、安装下面两个安装包:
sudo apt-get install aptitude
sudo aptitude install libcurl4-openssl-dev nss-updatedb
最后编译成功:
Created filesystem with 2011/98304 inodes and 214784/393216 blocks
[100% 1690/1690] Install system fs image: out/target/product/hikey/system.img
out/target/product/hikey/system.img+ maxsize=1644318720 blocksize=135168 total=854763652 reserve=16625664
make: Leaving directory `/home/zxc/aosp'
#### make completed successfully (52:09 (mm:ss)) ####
[ 85% 4203/4905] host Java: hamcrest-host (out/host/common/obj/JAVA_LIBRARIES/hamcrest-host_intermediates/classes)
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[ 86% 4239/4905] host Java: junit (out/host/common/obj/JAVA_LIBRARIES/junit_intermediates/classes)
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[ 87% 4288/4905] host Java: ahat-tests (out/host/common/obj/JAVA_LIBRARIES/ahat-tests_intermediates/classes)
Note: art/tools/ahat/test/SortTest.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[ 95% 4666/4905] host Java: android-icu4j-host (out/host/common/obj/JAVA_LIBRARIES/android-icu4j-host_intermediates/classes)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: external/icu/android_icu4j/src/main/java/android/icu/impl/Relation.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[ 99% 4896/4905] host Java: android-icu4j-tests-host (out/host/common/obj/JAVA_LIBRARIES/android-icu4j-tests-host_intermediates/classes)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[100% 4905/4905] Checking build with Jack: out/host/common/obj/JAVA_LIBRARIES/ahat-test-dump_intermediates/jack.check.timestamp
make: Leaving directory `/home/zxc/aosp'
#### make completed successfully (03:14:27 (hh:mm:ss)) ####
回复

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /5 下一条

手机版|小黑屋|与非网

GMT+8, 2024-12-20 16:20 , Processed in 0.118776 second(s), 18 queries , MemCache On.

ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

苏公网安备 32059002001037号

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.