2024年4月25日发(作者:)

Ubuntu 12 64位编译Android 4.0.1源码问题和解决办法

系统满足的条件:

在VMware下,最好给客户虚拟机1.5G内存,30G以上的硬盘。

实现应该要安装的软件:

For Gingerbread (2.3.x) and newer versions, including the master branch, a 64-bit

environment is required. Older versions can be compiled on 32-bit systems.

Note: It is also possible to build Android in a virtual machine. If you are running Linux in a

virtual machine, you will need at least 16GB of RAM/swap and 30GB or more of disk space in

order to build the Android tree.

Detailed instructions for Ubuntu and MacOS follow. In general you will need:

Python 2.5 -- 2.7, which you can download from .

GNU Make 3.81 -- 3.82, which you can download from ,

JDK 6 if you wish to build Gingerbread or newer; JDK 5 for Froyo or older. You can

download both from .

 Git 1.7 or newer. You can find it at .

You will need a 64-bit version of Ubuntu. Ubuntu 10.04 is recommended. Building using a

newer version of Ubuntu is currently only experimentally supported and is not guaranteed to

work on branches other than master.

$ sudo apt-get install git-core gnupg flex bison gperf build-essential

zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev

libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386

libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos

python-markdown libxml2-utils xsltproc zlib1g-dev:i386

$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/.1 /usr/lib/i386-linux-gnu/

源码编译过程中可能出现的问题:

1、

make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o]

Error 1

make: ***

解决方法:

gedit frameworks/base/libs/utils/

LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)

修改为:

LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) –fpermissive

2、

make: ***

[out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/s

-] Killed

解决方法:

把虚拟机ubuntu系统分配内存1G,有条件最好对于1G

3、

:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]

make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1

解决方法:

修改build/core/combo/HOST_ 61行,将

HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0

修改成

HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0

昨天下载、编译了android-4.0.3,遇到的问题贴出来,共享一下:

环境要求改变。

现在要求内存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/)

collect2: ld terminated with signal 9 [Killed]