Ubuntu 12.0 64位源码编译Android4.0

来源:网络收集 时间:2025-06-26 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xuecool-com或QQ:370150219 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

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 python.org. GNU Make 3.81 -- 3.82, which you can download from gnu.org, JDK 6 if you wish to build Gingerbread or newer; JDK 5 for Froyo or older. You can download both from java.sun.com. ? Git 1.7 or newer. You can find it at git-scm.com. 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/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

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

make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] Error 1 make: *** 解决方法:

gedit frameworks/base/libs/utils/Android.mk

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/noproguard.classes-with-local.dex] Killed

解决方法:

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

:0:0: error: \

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

修改build/core/combo/HOST_linux-x86.mk 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/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。

错误1:

USER-NAME@MACHINE-NAME:~/Android$ make 出现了如下错误:

host C++: llvm-rs-cc <= frameworks/compile/slang/slang_rs_export_foreach.cpp

frameworks/compile/slang/slang_rs_export_foreach.cpp: In static member function ‘static slang::RSExportForEach* slang::RSExportForEach::Create(slang::RSContext*, const clang::FunctionDecl*)’:

frameworks/compile/slang/slang_rs_export_foreach.cpp:247:23: error: variable ‘ParamName’ set but not used [-Werror=unused-but-set-variable] cc1plus: all warnings being treated as errors make: *** [out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/slang_rs_export_foreach.o] Error 1

解决方法:

1.在工程根目录下,打开下面的makefile文件:

$ vi frameworks/compile/slang/Android.mk

2.在打开的makefile文件中按照下面更改:

#local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter -Werror local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter

错误2:

<命令行>:0:0: 错误:“_FORTIFY_SOURCE”重定义 [-Werror] :0:0: 附注:这是先前定义的位置

解决:

修改build/core/combo/HOST_linux-x86.mk 61行,将 HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0 修改成 HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0

错误2: host Prebuilt: monkeyrunner (out/host/linux-x86/obj/EXECUTABLES/monkeyrunner_intermediates/monkeyrunner) host C++: obbtool <= frameworks/base/tools/obbtool/Main.cpp <命令行>:0:0: 错误:“_FORTIFY_SOURCE”重定义 [-Werror] :0:0: 附注:这是先前定义的位置 cc1plus:所有的警告都被当作是错误

解决: 修改build/core/combo/HOST_linux-x86.mk 将 HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0 修改成 HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0

错误3:

error: Exited sync due to fetch errors 解决:

重新运行 repo sync 就可以解决

1、问题一:/bin/bash: bison: 未找到命令 解决方法:$ sudo apt-get install bison

2、问题二:

You are attempting to build with the incorrect version of java. Your version is: /bin/bash: java: 未找到命令. The correct version is: 1.5. 解决方法:

注意:必须使用1.5的JDK版本。不能使用1.6等其他版本。 (1)下载

在sun官网上下载jdk-1_5_0_22-linux-i586.bin。注意不是jdk-1_5_0_22-linux-i586rpm.bin (2)部署

进入jdk-1_5_0_22-linux-i586.bin所在目录 cd ~

赋予该bin文件可执行属性

chmod +x jdk-1_5_0_22-linux-i586.bin

一直回车跳过协议到最后一行:

Do you agree to the above license terms? [yes or no]

键入yes回车,开始解压。默认解压到当前目录下的jdk1.5.0_22目录里。 (3)配置环境变量

执行$gedit ~/.bashrc打开.bashrc文件。 修改./bashrc文件,在文件末尾添加 #set java environment

JAVA_HOME=“你的路径”/jdk1.5.0_10

export JRE_HOME=“你的路径”/jdk1.5.0_10/jre

export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH 保存并关闭文件。

在终端执行source ~/.bashrc刷新该配置

使用java –version检查JDK是否配置正确。

3、问题三:

host c++: libhost <= build/libs/host/pseudolocalize.cpp/bin/bash: g++: 未找到命令

make: ***[out/host/linux-x86/obj/STATIC_LIBRARIES/libhost_intermediates/pseudolocalize.o] 错误 127

解决方法:$ sudo apt-get install build-essential

4、问题四:

external/clearsilver/cgi/cgi.c:22:18: 致命错误: zlib.h: 没有那个文件或目录编译终端。

make: ***[out/host/linux-x86/obj/SHARED_LIBRARIES/libneo_cgi_intermediates/cgi.o] 错误 1 解决方法:$ sudo apt-get install zlib1g-dev

5、问题五:

make: ***[out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/appt] 错误 1 解决方法:

打开Android.mk文件

$gedit frameworks/base/tools/aapt/Android.mk

编辑下面一行:

ifeq ($(HOST_OS),linux)

#LOCAL_LDLIBS += -lrt 把这行注释掉,改为下面一行。 LOCAL_LDLIBS += -lrt -lpthread endif

6、问题六:

host c: adb<= system/core/adb/fdevent.c

host Executable:adb (out/host/linux-86/obj/EXECUTABLES/adb_intermediates/adb)/user/bin/ld:

百度搜索“70edu”或“70教育网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,70教育网,提供经典教育范文Ubuntu 12.0 64位源码编译Android4.0在线全文阅读。

Ubuntu 12.0 64位源码编译Android4.0.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.70edu.com/fanwen/1136875.html(转载请注明文章来源)

相关推荐:

Copyright © 2020-2025 70教育网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:370150219 邮箱:370150219@qq.com
苏ICP备16052595号-17
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:7 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219