环境要求改变。
现在要求内存1.5G左右,硬盘25G以上,以前1G、10G就够了。官方说明“Note: The source download is approximately 6GB in size. You will need 25GB free to complete a single build, and up to 80GB (or more) for a full set of builds.”
可惜我编之前没看,编译报错如下:
错一:
host SharedLib: libbcc (out/host/linux-x86/obj/lib/libbcc.so)
collect2: ld terminated with signal 9 [Killed]
make: *** [out/target/common/obj/JAVA_LIBRARIES/core_intermediates/noproguard.classes-with-local.dex] Killed
make: *** Waiting for unfinished jobs….
make: *** [out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/llvm-rs-cc] Error 1
collect2: ld terminated with signal 9 [Killed]
collect2: ld terminated with signal 9 [Killed]
make: *** [out/host/linux-x86/obj/lib/libbcc.so] Error 1
make: *** [out/host/linux-x86/obj/EXECUTABLES/clang_intermediates/clang] Error 1
weihongcsu@ubuntu:~/disk2/android-4.0.1_r1$
错二:
target Dex: framework
make: *** [out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/noproguard.classes-with-local.dex] Killed
weihongcsu@ubuntu:~/disk2/android-4.0.1_r1$
错三:
arm-eabi-g++: Internal error: Killed (program cc1plus)
解决办法:
这些错误都是 linux的OOM killer 导致,“内存1.5G左右,硬盘25G”就可以解决,我为了保险,把make -j4改成了make.编译5个小时以上吧,out目录大小:12G。
至于环境搭建和编译,网上很多,不会的话可以参考官网:http://source.android.com/source/index.html
一注意:本文转载自http://www.liweihong.net/compile-android-4-note.html