`
isiqi
  • 浏览: 16470429 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

ubuntu 编译 Android 出现的若干错误及解决方法

阅读更多

刚下好 android 源码后马上编译会发现有各种各样的错误,原因是有些依赖包没有装。

为了避免出现以下我遇到的错误,请先安装 jdk1.5 ,必须是 jdk1.5,不然肯定编译不过的。

然后,在检查以下有没有安装以下依赖包:

sudo apt-get install bison libc6-dev-amd64 g++-multilib zlib1g-dev lib64z1-dev flex libncurses5-dev libx11-dev gperf

下面是我遇到的错误及解决方法:

/bin/bash: bison:找不到命令
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.

Your version is: /bin/bash: java:找不到命令.
The correct version is: 1.6.

Please follow the machine setup instructions at

http://source.android.com/source/download.html

************************************************************
build/core/main.mk:114: *** stop。 停止。

解决方法:
sudo apt-get install bison

Install: out/host/linux-x86/framework/droiddoc.jar
target Generated: libclearsilver-jni <= out/host/common/obj/JAVA_LIBRARIES/clearsilver_intermediates/javalib.jar
host C: libclearsilver-jni <= external/clearsilver/java-jni/j_neo_util.c
In file included from /usr/include/features.h:378,
from /usr/include/string.h:26,
from external/clearsilver/java-jni/j_neo_util.c:1:
/usr/include/gnu/stubs.h:9:27: error: gnu/stubs-64.h: 没有那个文件或目录
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libclearsilver-jni_intermediates/j_neo_util.o] 错误 1

解决方法:
sudo apt-get install libc6-dev-amd64

http://www.poemcode.net/2010/07/android-stubs-64/

host SharedLib: libneo_util (out/host/linux-x86/obj/lib/libneo_util.so)
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.4.3/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.4.3/libstdc++.a when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.4.3/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.4.3/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/lib/libneo_util.so] 错误 1

解决方法:
sudo apt-get install g++-multilib

external/clearsilver/cgi/cgi.c:22:18: error: zlib.h: 没有那个文件或目录
external/clearsilver/cgi/cgi.c: In function ‘cgi_compress’:
external/clearsilver/cgi/cgi.c:885: error: ‘z_stream’ undeclared (first use in this function)
external/clearsilver/cgi/cgi.c:885: error: (Each undeclared identifier is reported only once
external/clearsilver/cgi/cgi.c:885: error: for each function it appears in.)
external/clearsilver/cgi/cgi.c:885: error: expected ‘;’ before ‘stream’
external/clearsilver/cgi/cgi.c:888: error: ‘stream’ undeclared (first use in this function)
external/clearsilver/cgi/cgi.c:888: error: ‘Bytef’ undeclared (first use in this function)
external/clearsilver/cgi/cgi.c:888: error: expected expression before ‘)’ token
external/clearsilver/cgi/cgi.c:889: error: ‘uInt’ undeclared (first use in this function)
external/clearsilver/cgi/cgi.c:889: error: expected ‘;’ before ‘str’
external/clearsilver/cgi/cgi.c:890: error: expected expression before ‘)’ token
external/clearsilver/cgi/cgi.c:892: error: ‘uLong’ undeclared (first use in this function)
external/clearsilver/cgi/cgi.c:892: error: expected ‘)’ before ‘stream’
external/clearsilver/cgi/cgi.c:895: error: ‘alloc_func’ undeclared (first use in this function)
external/clearsilver/cgi/cgi.c:895: error: expected ‘;’ before numeric constant
external/clearsilver/cgi/cgi.c:896: error: ‘free_func’ undeclared (first use in this function)
external/clearsilver/cgi/cgi.c:896: error: expected ‘;’ before numeric constant
external/clearsilver/cgi/cgi.c:897: error: ‘voidpf’ undeclared (first use in this function)
external/clearsilver/cgi/cgi.c:897: error: expected ‘;’ before numeric constant
external/clearsilver/cgi/cgi.c:900: error: ‘Z_DEFAULT_COMPRESSION’ undeclared (first use in this function)
external/clearsilver/cgi/cgi.c:900: error: ‘Z_DEFLATED’ undeclared (first use in this function)
external/clearsilver/cgi/cgi.c:900: error: ‘MAX_WBITS’ undeclared (first use in this function)
external/clearsilver/cgi/cgi.c:900: error: ‘Z_DEFAULT_STRATEGY’ undeclared (first use in this function)
external/clearsilver/cgi/cgi.c:901: error: ‘Z_OK’ undeclared (first use in this function)
external/clearsilver/cgi/cgi.c:904: error: ‘Z_FINISH’ undeclared (first use in this function)
external/clearsilver/cgi/cgi.c:905: error: ‘Z_STREAM_END’ undeclared (first use in this function)
external/clearsilver/cgi/cgi.c: In function ‘cgi_output’:
external/clearsilver/cgi/cgi.c:1200: error: ‘Z_NULL’ undeclared (first use in this function)
external/clearsilver/cgi/cgi.c:1201: error: expected ‘)’ before ‘Bytef’
external/clearsilver/cgi/cgi.c:1201: warning: cast from pointer to integer of different size
external/clearsilver/cgi/cgi.c:1218: error: ‘Z_DEFLATED’ undeclared (first use in this function)
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libneo_cgi_intermediates/cgi.o] 错误 1

解决方法:
sudo apt-get install zlib1g-dev

host SharedLib: libneo_cgi (out/host/linux-x86/obj/lib/libneo_cgi.so)
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../libz.a when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/libz.a when searching for -lz
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/lib/libneo_cgi.so] 错误 1

解决方法:
sudo apt-get install lib64z1-dev

out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp: In function ‘int yyparse()’:
out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp:1827: warning: deprecated conversion from string constant to ‘char*’
out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp:1970: warning: deprecated conversion from string constant to ‘char*’
Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l
/bin/bash: flex:找不到命令
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] 错误 127

解决方法:
sudo apt-get install flex

Docs droiddoc: out/target/common/docs/api-stubs
Could not load 'clearsilver-jni'
java.library.path = out/host/linux-x86/lib
make: *** [out/target/common/docs/api-stubs-timestamp] 错误 45

解决方法:
安装 jdk1.5

host Executable: adb (out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb)
/usr/bin/ld: cannot find -lncurses
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] 错误 1

解决方法:
sudo apt-get install libncurses5-dev

host C: emulator <= external/qemu/android/main.c
In file included from external/qemu/android/main.c:30:
prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:55:22: error: X11/Xlib.h: 没有那个文件或目录
prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:56:23: error: X11/Xatom.h: 没有那个文件或目录
In file included from external/qemu/android/main.c:30:
prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:73: error: expected specifier-qualifier-list before ‘XEvent’
prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:86: error: expected specifier-qualifier-list before ‘Display’
external/qemu/android/main.c: In function ‘main’:
external/qemu/android/main.c:1281: warning: implicit declaration of function ‘audio_check_backend_name’
make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_intermediates/android/main.o] 错误 1

解决方法:
sudo apt-get install libx11-dev

Generating CSSPropertyNames.h <= CSSPropertyNames.in
sh: gperf: not found
calling gperf failed: 32512 at ./makeprop.pl line 96.
make: *** [out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSPropertyNames.h] 错误 25
make: *** 正在删除文件“out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSPropertyNames.h”

解决方法:
sudo apt-get install gperf

out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/libwebcore.a(JSGeolocationCustom.o): In function `WebCore::JSCustomPositionErrorCallback::create(JSC::JSObject*, WebCore::JSDOMGlobalObject*)':
/home/semny/workspace/myandroid/external/webkit/WebCore/bindings/js/JSCustomPositionErrorCallback.h:41: undefined reference to `WebCore::JSCustomPositionErrorCallback::JSCustomPositionErrorCallback(JSC::JSObject*, WebCore::JSDOMGlobalObject*)'
collect2: ld returned 1 exit status
make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/libwebcore_intermediates/LINKED/libwebcore.so] 错误 1

解决方法:

其实是我的Linux 系统没加swap分区的原因。

解决的方法很简单,建个swap文件吧。
# dd if=/dev/zero of=/opt/other/swapfile bs=1024 count=512K
# mkswap /opt/other/swapfile
# swapon /opt/other/swapfile
# swapon -s
Filename Type Size Used Priority
/opt/other/swapfile file 524280 0 -1


分享到:
评论

相关推荐

    ubuntu16.04下编译android8.1出现jack-sever问题

    在Ubuntu 16.04环境下编译Android 8.1系统时,可能会遇到一系列问题,尤其是涉及到Jack Server的问题。本文将深入解析这些问题及其解决方案。 首先,编译过程中的常见错误通常与系统环境和依赖库的缺失有关。例如,...

    Ubuntu编译android4.4源码

    1. Ubuntu版本选择:在编译Android源码时,选择Ubuntu 12.04.5 LTS版本,主要是因为它是Android官方编译推荐使用的系统版本。在文档中提到Ubuntu 14.04存在一些兼容性问题,比如vmware-tools安装后屏幕自适应问题、...

    ubuntu编译android环境配置脚本

    ubuntu编译android环境配置脚本,具体使用方法可以参考我的博文:http://blog.csdn.net/brian512/article/details/43195105

    Ubuntu 64 位编译Android源码出错解决办法

    在进行Ubuntu 64位系统下Android源代码的编译过程中,可能会遭遇一系列技术障碍,以下将详述在Ubuntu 11.04(64位)编译Android 2.3源码时常见的错误及其解决方案,以帮助开发者顺利通过这些难关。 ### 错误一:`/...

    Ubuntu环境下编译android源码及安装

    ### Ubuntu环境下编译Android源码及安装的知识点详解 #### 实验环境介绍 - **操作系统**: Ubuntu 10.04 - **Android版本**: 2.1 - **开发板**: ARM9 Mini6410 - **目标**: 在Ubuntu环境下编译Android 2.1源码并进行...

    虚拟机ubuntu android编译环境搭建过程

    虚拟机 Ubuntu Android 编译环境搭建过程 一、 Linux 下 JDK 的安装 在虚拟机 Ubuntu 下搭建 Android 编译环境,首先需要安装 JDK。输入命令:sudo apt-get install sun-java6-jdk。如果不能下载安装 JDK6,可以...

    Linphone编译错误及解决方法

    Linphone编译错误及解决方法 Linphone是一款开源的VoIP电话软件,但是在编译过程中经常会遇到各种错误。这些错误可能是由于缺少依赖项、头文件、库文件等原因引起的。在这里,我们将列举一些常见的Linphone编译...

    Ubuntu_10.04下编译Android源码全过程

    ### Ubuntu 10.04下编译Android源码全过程详解 #### 一、获取Android源代码 在Ubuntu 10.04环境下编译Android源码的第一步是从官方仓库获取完整的源代码。这一过程主要依赖于Git,一种由Linux之父Linus Torvalds...

    Ubuntu14.04编译android4.4源码一次性成功

    在Ubuntu 14.04操作系统中编译Android 4.4源码是一个涉及多步骤和技术细节的过程。这个过程对于开发者来说是至关重要的,因为通过编译源码,可以自定义系统,修复bug,或者为特定设备添加支持。以下是详细的操作步骤...

    Ubuntu10.10(64位)编译Android2.3源码 遇到的错误

    ### Ubuntu10.10(64位)编译Android2.3源码遇到的问题及解决方案 #### 一、概述 在使用Ubuntu10.10(64位)操作系统尝试编译Android2.3源码的过程中,遇到了一系列错误。这些问题主要与缺少必要的库文件和支持工具...

    ubuntu下android ndk编译环境搭建详细描述

    在Ubuntu系统上搭建Android NDK编译环境是Android原生代码开发的重要步骤,适用于那些需要进行C/C++底层开发或优化的应用程序。Android NDK(Native Development Kit)是一套工具,允许开发者使用C/C++编写部分应用...

    ubuntu10.04及12.04编译android环境搭建

    ubuntu10.04及12.04编译android环境搭建.txt

    ubuntu下android编译环境搭建

    ### Ubuntu 下 Android 编译环境搭建详解 #### 一、前言 随着移动互联网的快速发展,Android 成为了全球最流行的移动操作系统之一。对于开发者来说,能够高效地进行 Android 应用开发与系统定制是非常重要的技能。...

    Android源码编译make的各类错误解决方案汇总

    Android源码编译make错误解决方案汇总 Android源码编译make过程中经常会遇到各种错误,这篇文章将总结各种常见错误的解决方案。 错误一:Java版本不正确 编译Android源码时,make命令可能会报错,提示您使用了...

    ubuntu 每周自动编译android 版本

    在Ubuntu系统中,为了实现每周自动编译Android版本的目标,我们可以使用定时任务工具cron和shell脚本来自动化这个过程。下面将详细介绍如何配置和使用这些工具。 首先,`ubuntu 自动编译脚本`指的是利用Ubuntu操作...

    ubuntu下的kodi(XBMC)编译

    这通常涉及到下载源代码、配置编译环境、解决依赖关系、编译和安装等多个步骤,过程中可能会遇到各种问题,如库版本不兼容、编译错误等。作者通过解决这些问题,最终完成了编译过程,这为其他想要在Ubuntu上编译Kodi...

    Ubuntu中Rust-Android编译环境搭建.txt

    Ubuntu中Rust-Android编译环境搭建.txt

    ubuntu上在androidstudio中启动emulator闪退的解决方法

    在 Ubuntu 上 Android Studio 中启动 Emulator闪退的解决方法 在 Android Studio 中点击模拟器的启动按钮后,模拟器界面弹出后,又立刻闪退。这是非常常见的问题,本文将为大家分享 Ubuntu 上在 Android Studio 中...

    ubuntu11.04上编译omap3530内核存在问题解决方法

    ### Ubuntu 11.04 上 OMAP3530 内核编译问题及解决方案 #### 背景概述 本文旨在提供一个详尽的指南,帮助开发者在 Ubuntu 11.04 系统环境下成功编译 OMAP3530 处理器的 Linux 内核。本案例中使用的硬件平台为天漠...

Global site tag (gtag.js) - Google Analytics