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

LUOPING0 2011-04-13

刚下好 android 源码后马上编译会发现有各种各样的错误,原因是有些依赖包没有装。为了避免出现以下我遇到的错误,请先安装 jdk1.5 ,必须是 jdk1.5,不然肯定编译不过的。

如果用命令装不上可以考虑用:新立得软件包管理器搜索安装

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

sudoapt-getinstallbisonlibc6-dev-amd64g++-multilibzlib1g-devlib64z1-devflexlibncurses5-devlibx11-devgperf

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

/bin/bash:bison:找不到命令

Checkingbuildtoolsversions...

************************************************************

Youareattemptingtobuildwiththeincorrectversion

ofjava.

Yourversionis:/bin/bash:java:找不到命令.

Thecorrectversionis:1.6.

Pleasefollowthemachinesetupinstructionsat

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

************************************************************

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

解决方法:

sudoapt-getinstallbison

----------------------------------------------------------------------

Install:out/host/linux-x86/framework/droiddoc.jar

targetGenerated:libclearsilver-jni<=out/host/common/obj/JAVA_LIBRARIES/clearsilver_intermediates/javalib.jar

hostC:libclearsilver-jni<=external/clearsilver/java-jni/j_neo_util.c

Infileincludedfrom/usr/include/features.h:378,

from/usr/include/string.h:26,

fromexternal/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

解决方法:

sudoapt-getinstalllibc6-dev-amd64

----------------------------------------------------------------------

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

hostSharedLib:libneo_util(out/host/linux-x86/obj/lib/libneo_util.so)

/usr/bin/ld:skippingincompatible/usr/lib/gcc/i486-linux-gnu/4.4.3/libstdc++.sowhensearchingfor-lstdc++

/usr/bin/ld:skippingincompatible/usr/lib/gcc/i486-linux-gnu/4.4.3/libstdc++.awhensearchingfor-lstdc++

/usr/bin/ld:skippingincompatible/usr/lib/gcc/i486-linux-gnu/4.4.3/libstdc++.sowhensearchingfor-lstdc++

/usr/bin/ld:skippingincompatible/usr/lib/gcc/i486-linux-gnu/4.4.3/libstdc++.awhensearchingfor-lstdc++

/usr/bin/ld:cannotfind-lstdc++

collect2:ldreturned1exitstatus

make:***[out/host/linux-x86/obj/lib/libneo_util.so]错误1

解决方法:

sudoapt-getinstallg++-multilib

----------------------------------------------------------------------

external/clearsilver/cgi/cgi.c:22:18:error:zlib.h:没有那个文件或目录

external/clearsilver/cgi/cgi.c:Infunction‘cgi_compress’:

external/clearsilver/cgi/cgi.c:885:error:‘z_stream’undeclared(firstuseinthisfunction)

external/clearsilver/cgi/cgi.c:885:error:(Eachundeclaredidentifierisreportedonlyonce

external/clearsilver/cgi/cgi.c:885:error:foreachfunctionitappearsin.)

external/clearsilver/cgi/cgi.c:885:error:expected‘;’before‘stream’

external/clearsilver/cgi/cgi.c:888:error:‘stream’undeclared(firstuseinthisfunction)

external/clearsilver/cgi/cgi.c:888:error:‘Bytef’undeclared(firstuseinthisfunction)

external/clearsilver/cgi/cgi.c:888:error:expectedexpressionbefore‘)’token

external/clearsilver/cgi/cgi.c:889:error:‘uInt’undeclared(firstuseinthisfunction)

external/clearsilver/cgi/cgi.c:889:error:expected‘;’before‘str’

external/clearsilver/cgi/cgi.c:890:error:expectedexpressionbefore‘)’token

external/clearsilver/cgi/cgi.c:892:error:‘uLong’undeclared(firstuseinthisfunction)

external/clearsilver/cgi/cgi.c:892:error:expected‘)’before‘stream’

external/clearsilver/cgi/cgi.c:895:error:‘alloc_func’undeclared(firstuseinthisfunction)

external/clearsilver/cgi/cgi.c:895:error:expected‘;’beforenumericconstant

external/clearsilver/cgi/cgi.c:896:error:‘free_func’undeclared(firstuseinthisfunction)

external/clearsilver/cgi/cgi.c:896:error:expected‘;’beforenumericconstant

external/clearsilver/cgi/cgi.c:897:error:‘voidpf’undeclared(firstuseinthisfunction)

external/clearsilver/cgi/cgi.c:897:error:expected‘;’beforenumericconstant

external/clearsilver/cgi/cgi.c:900:error:‘Z_DEFAULT_COMPRESSION’undeclared(firstuseinthisfunction)

external/clearsilver/cgi/cgi.c:900:error:‘Z_DEFLATED’undeclared(firstuseinthisfunction)

external/clearsilver/cgi/cgi.c:900:error:‘MAX_WBITS’undeclared(firstuseinthisfunction)

external/clearsilver/cgi/cgi.c:900:error:‘Z_DEFAULT_STRATEGY’undeclared(firstuseinthisfunction)

external/clearsilver/cgi/cgi.c:901:error:‘Z_OK’undeclared(firstuseinthisfunction)

external/clearsilver/cgi/cgi.c:904:error:‘Z_FINISH’undeclared(firstuseinthisfunction)

external/clearsilver/cgi/cgi.c:905:error:‘Z_STREAM_END’undeclared(firstuseinthisfunction)

external/clearsilver/cgi/cgi.c:Infunction‘cgi_output’:

external/clearsilver/cgi/cgi.c:1200:error:‘Z_NULL’undeclared(firstuseinthisfunction)

external/clearsilver/cgi/cgi.c:1201:error:expected‘)’before‘Bytef’

external/clearsilver/cgi/cgi.c:1201:warning:castfrompointertointegerofdifferentsize

external/clearsilver/cgi/cgi.c:1218:error:‘Z_DEFLATED’undeclared(firstuseinthisfunction)

make:***[out/host/linux-x86/obj/SHARED_LIBRARIES/libneo_cgi_intermediates/cgi.o]错误1

解决方法:

sudoapt-getinstallzlib1g-dev

----------------------------------------------------------------------

hostSharedLib:libneo_cgi(out/host/linux-x86/obj/lib/libneo_cgi.so)

/usr/bin/ld:skippingincompatible/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../libz.sowhensearchingfor-lz

/usr/bin/ld:skippingincompatible/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../libz.awhensearchingfor-lz

/usr/bin/ld:skippingincompatible/usr/lib/libz.sowhensearchingfor-lz

/usr/bin/ld:skippingincompatible/usr/lib/libz.awhensearchingfor-lz

/usr/bin/ld:cannotfind-lz

collect2:ldreturned1exitstatus

make:***[out/host/linux-x86/obj/lib/libneo_cgi.so]错误1

解决方法:

sudoapt-getinstalllib64z1-dev

----------------------------------------------------------------------

out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp:Infunction‘intyyparse()’:

out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp:1827:warning:deprecatedconversionfromstringconstantto‘char*’

out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp:1970:warning:deprecatedconversionfromstringconstantto‘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

解决方法:

sudoapt-getinstallflex

----------------------------------------------------------------------

Docsdroiddoc:out/target/common/docs/api-stubs

Couldnotload'clearsilver-jni'

java.library.path=out/host/linux-x86/lib

make:***[out/target/common/docs/api-stubs-timestamp]错误45

解决方法:

安装jdk1.5

----------------------------------------------------------------------

hostExecutable:adb(out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb)

/usr/bin/ld:cannotfind-lncurses

collect2:ldreturned1exitstatus

make:***[out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb]错误1

解决方法:

sudoapt-getinstalllibncurses5-dev

----------------------------------------------------------------------

hostC:emulator<=external/qemu/android/main.c

Infileincludedfromexternal/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:没有那个文件或目录

Infileincludedfromexternal/qemu/android/main.c:30:

prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:73:error:expectedspecifier-qualifier-listbefore‘XEvent’

prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:86:error:expectedspecifier-qualifier-listbefore‘Display’

external/qemu/android/main.c:Infunction‘main’:

external/qemu/android/main.c:1281:warning:implicitdeclarationoffunction‘audio_check_backend_name’

make:***[out/host/linux-x86/obj/EXECUTABLES/emulator_intermediates/android/main.o]错误1

解决方法:

sudoapt-getinstalllibx11-dev

----------------------------------------------------------------------

GeneratingCSSPropertyNames.h<=CSSPropertyNames.in

sh:gperf:notfound

callinggperffailed:32512at./makeprop.plline96.

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”

解决方法:

sudoapt-getinstallgper

相关推荐