解决办法如下:
添加环境变量:
最后使环境变量生效:
Ubuntu系统默认安装并使用OpenJDK(usr/lib/jvm/),因此需要手动修改系统默认的JDK,
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/java/jdk1.6.0_45/bin/javac 300
sudo update-alternatives --install /usr/bin/java java /usr/lib/java/jdk1.6.0_45/bin/java 300
sudo update-alternatives --config javac,再选择相应的Priority 300
sudo update-alternatives --config java,再选择相应的Priority 300
至此配置完成,输入java -version、javac或java检查是否配置成功。
首先,我们先安装一些常用的工具
curl: sudo apt-get install curl
git: sudo apt-get install git
g++: sudo apt-get install g++
然后,遇到缺什么就安装什么
/usr/bin/ld: cannot find -lz
host Executable: aapt (out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt)
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] Error 1
解决方法: sudo apt-get install zlib1g-dev sudo apt-get install lib64z1-dev
/bin/bash: bison: command not found
Yacc: aidl <= frameworks/base/tools/aidl/aidl_language_y.y
bison -d -o out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp frameworks/base/tools/aidl/aidl_language_y.y
/bin/bash: bison: command not found
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] Error 127
解决方法:sudo apt-get install bison
/bin/bash: flex: command not found
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: command not found
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Error 127
解决方法: sudo apt-get install flex
/usr/bin/ld: cannot find -lncurses
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] Error 1
解决方法:sudo apt-get install libncurses5-dev或sudo apt-get install libncurses5-dev:i386
fatal error: GL/glx.h: No such file or directory
development/tools/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp:22: fatal error: GL/glx.h: No such file or directory
compilation terminated.
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libGLcommon_intermediates/GLDispatch.o] Error 1
解决方法:sudo apt-get install libgl1-mesa-dev
sh: gperf: not found
target Generated: libwebcore <= external/webkit/Source/JavaScriptCore/create_regex_tables
Generating CSSPropertyNames.h <= CSSPropertyNames.in
sh: gperf: not found
calling gperf failed: 32512 at ./makeprop.pl line 140.
make: *** [out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/css/CSSPropertyNames.h] Error 25
make: *** Deleting file `out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/css/CSSPropertyNames.h'
解决方法:sudo apt-get install gperf
编译Android源码,按照installing-required-packages-ubuntu-1204提供方法先安装必要的工具。
以下是编译Android 4.0.3的常见错误,这些错误的解决办法收录自互联网。
Google group有个专门的Android Building组,有兴趣的可以加入。
有转载这里的也有添加的。
################# Fix 1 ##########################
Error:
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector
host Executable: test-librsloader (out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader)
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Signals.o):在函数‘PrintStackTrace’中:
/home/crow/works/Android_src/external/llvm/lib/Support/Unix/Signals.inc:219:对‘dladdr’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Unix/Signals.inc:231:对‘dladdr’未定义的引用
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Threading.o):在函数‘llvm::llvm_execute_on_thread(void (*)(void*), void*, unsigned int)’中:
/home/crow/works/Android_src/external/llvm/lib/Support/Threading.cpp:96:对‘pthread_create’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Threading.cpp:100:对‘pthread_join’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Threading.cpp:91:对‘pthread_attr_setstacksize’未定义的引用
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Mutex.o):在函数‘llvm::sys::MutexImpl::MutexImpl(bool)’中:
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:69:对‘pthread_mutexattr_init’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:75:对‘pthread_mutexattr_settype’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:80:对‘pthread_mutexattr_setpshared’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:89:对‘pthread_mutexattr_destroy’未定义的引用
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Mutex.o):在函数‘llvm::sys::MutexImpl::tryacquire()’中:
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:143:对‘pthread_mutex_trylock’未定义的引用
collect2: 错误: ld 返回 1
make: *** [out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader] 错误 1
Fix:
$vi external/llvm/llvm-host-build.mk
末尾加上:
LOCAL_LDLIBS := -lpthread -ldl
20150103补充:编译sdk时遇到不少的问题
build/core/main.mk:670: *** Module 'AlarmProvider' in PRODUCT_PACKAGES has nothing to install!。
Indeed there is no a module with name AlarmProvider in the source tree now.
To fix it, remove AlarmProvider from the product definition in the following files:
./build/target/product/large_emu_hw.mk:25: AlarmProvider
./build/target/product/generic_no_telephony.mk:24: AlarmProvider
只去掉generic_no_telephony.mk就可以过,但是不过的东西太多了。
我想是main.mk中的判断方法有误,因为同样一个文件,编译镜像就可以过,编译sdk就过不了。
在编译源代码的时候出现该错误
根据网上大多数的说法,以及官网的介绍。截至5月底,android对ubuntu12.04的编译平台的支持不是很推荐,有些库的兼容方面会有一些问题
这两个错误报的错其实就是说没有在库路径中找到libGL.so libX11.so
但是打开etc/ld.so.conf.d中查看64位的库路径下x86_64-linux-gnu.conf配置文件
# Multiarch support
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
该路径下是有libGL.so的,并且查看文件链接指向没有问题。但是编译起来还是有错。
后来再查看了一些资料,因为编译的时候还是用到了32BIT的libGL.so libX11.so库文件,编译的时候找的不是X86_64库文件配置,而是找的是I386库文件配置
# Multiarch support
/lib/i386-linux-gnu
/usr/lib/i386-linux-gnu
/lib/i686-linux-gnu
/usr/lib/i686-linux-gnu
果然在I386目录下没有找到这两个文件
首先安装这两个库文件的32位版本:
$ sudo apt-get install libx11-dev:i386(libX11.so)
$ sudo apt-get installibgl1-mesa-glx:i386(libGL.so)
由于libGL.so系统默认没有进行库路径下的链接,还需要手动链接一下
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2 /usr/lib/libGL.so
查找指定的符号在Android.mk中
find ./ -name Android.mk -exec grep -l {} \;
收集和遇到的部分error,先记录如下,改天按照建立android及使用情景分类整理。以后遇到的在慢慢添加进来
1.编译错误:
“/usr/bin/ld:cannotfind -lz”
解决方法:
需要安装zlib-dev这个包,在线安装命令为:apt-getinstall zlib1g-dev
2.编译错误:
frameworks/base/libs/utils/RefBase.cpp:483:67:error: passing ‘const android::RefBase::weakref_impl’ as ‘this’argument of ‘void android::RefBase::weakref_impl::trackMe(bool,bool)’ discards qualifiers [-fpermissive]
make: ***[out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o]Error 1
解决方法:
$gedit frameworks/base/libs/utils/Android.mk
修改以下语句
LOCAL_CFLAGS+= -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
为
LOCAL_CFLAGS+= -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) –fpermissive
3.编译错误:
arm-eabi-gcc:error trying to exec 'cc1': execvp: No such file or directory
make:*** [out/target/product/generic/obj/lib/crtbegin_dynamic.o] Error 1
解决方法:
如果之前的依赖包都已经安装成功的话,此处应该是交叉编译工具权限的问题。这个问题只要在文章开头lunch时执行了赋予权限命令,就应该不会遇到了。
4.编译错误:
cc1plus: all warnings being treated as errors
make:*** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o]Error 1
此处编译错误是由于ubuntu11.10采用了GCC4.6.1导致的。
解决方法:
修改源码目录下/build/core/combo/HOST_linux-x86.mk文件:
将以下语句
HOST_GLOBAL_CFLAGS+= -D_FORTIFY_SOURCE=0
修改为
HOST_GLOBAL_CFLAGS+= -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
5.编译错误:
make:***[out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/slang_rs_export_foreach.o]错误1
解决办法:
找到frameworks/compile/slang/slang_rs_export_foreach.cpp:的249行,即:
llvm::StringRef ParamName = PVD->getName();
将本行注释掉即可继续编译。
make:*** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o]Error 1
后来发现了,原来是Ubuntu11.10里的gcc和g++版本太高了,于是执行下面的操作:
sudoapt-get install gcc-4.4
sudoapt-get install g++-4.4
sudorm -rf /usr/bin/gcc /usr/bin/g++
sudoln -s /usr/bin/gcc-4.4 /usr/bin/gcc
sudoln -s /usr/bin/g++-4.4 /usr/bin/g++
把默认的4.6版本换为了4.4,继续编译源码,又出现了另一个错误,大致提示为:
g++selected multilib '32' not installed
继续奋战吧,安装相应的工具吧:sudoapt-get install g++-4.4-multilib,现在正在make-j8在我的i5/4G机子里跑着。
make:***[out/host/linux-x86/obj/STATIC_LIBRARIES/libMesa_intermediates/src/glsl/linker.o]Error 1
解决这个问题需要修改文件如下:
把"#include
这样就可以编译完成了。
6.错误:
error:‘ptrdiff_t’ does not name a type
In file included fromexternal/gtest/src/../include/gtest/gtest-param-test.h:157:0,
from external/gtest/src/../include/gtest/gtest.h:69,
fromexternal/gtest/src/gtest_main.cc:32:
external/gtest/src/../include/gtest/internal/gtest-param-util.h:122:11:error: ‘ptrdiff_t’ does not name a type
In file included fromexternal/gtest/src/../include/gtest/gtest-param-test.h:157:0,
from external/gtest/src/../include/gtest/gtest.h:69,
from external/gtest/src/../src/gtest.cc:34,
fromexternal/gtest/src/gtest-all.cc:36:
external/gtest/src/../include/gtest/internal/gtest-param-util.h:122:11:error: ‘ptrdiff_t’ does not name a type
In file included fromexternal/gtest/src/gtest-all.cc:38:0:
解决方法:
$viexternal/gtest/src/../include/gtest/internal/gtest-param-util.h
#include
7.错误:
undefinedreference to `pthread_mutexattr_destroy'
host C++: libgtest_host<= external/gtest/src/gtest-all.cc
true
host C++:libgtest_main_host <=external/gtest/src/gtest_main.cc
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Signals.o):In function`PrintStackTrace':
/home/aa/project/android4.0.1/external/llvm/lib/Support/Unix/Signals.inc:219:undefined reference to`dladdr'
/home/aa/project/android4.0.1/external/llvm/lib/Support/Unix/Signals.inc:231:undefined reference to`dladdr'
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Threading.o):In function `llvm::llvm_execute_on_thread(void (*)(void*), void*,unsignedint)':
/home/aa/project/android4.0.1/external/llvm/lib/Support/Threading.cpp:96:undefined reference to`pthread_create'
/home/aa/project/android4.0.1/external/llvm/lib/Support/Threading.cpp:91:undefined reference to`pthread_attr_setstacksize'
/home/aa/project/android4.0.1/external/llvm/lib/Support/Threading.cpp:100:undefined reference to`pthread_join'
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Mutex.o):In function`MutexImpl':
/home/aa/project/android4.0.1/external/llvm/lib/Support/Mutex.cpp:69:undefined reference to`pthread_mutexattr_init'
/home/aa/project/android4.0.1/external/llvm/lib/Support/Mutex.cpp:75:undefined reference to`pthread_mutexattr_settype'
/home/aa/project/android4.0.1/external/llvm/lib/Support/Mutex.cpp:80:undefined reference to`pthread_mutexattr_setpshared'
/home/aa/project/android4.0.1/external/llvm/lib/Support/Mutex.cpp:89:undefined reference to`pthread_mutexattr_destroy'
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Mutex.o):In function`llvm::sys::MutexImpl::tryacquire()':
/home/aa/project/android4.0.1/external/llvm/lib/Support/Mutex.cpp:143:undefined reference to `pthread_mutex_trylock'
collect2: ldreturned 1 exit status
make: ***[out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader]Error 1
make: *** Waiting for unfinished jobs....
解决方法:
$viexternal/llvm/llvm-host-build.mk
LOCAL_LDLIBS := -lpthread-ldl
下面这个解决方法没成功,会有新的错误:errorsagain :can't find threads.h file or dir.
$ viexternal/llvm/lib/Support/Android.mk
LOCAL_C_INCLUDES +=system/core/include/cutils
LOCAL_SHARED_LIBRARIES := libcutil
$vi external/llvm/lib/Support/Mutex.cpp
#include
$vi external/llvm/lib/Support/Threading.cpp
#include
8错误:
error:variable ‘ParamName’ set but not used[-Werror=unused-but-set-variable]
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 beingtreated as errors
解决方法:
$vi frameworks/compile/slang/Android.mk
#local_cflags_for_slang :=-Wno-sign-promo -Wall -Wno-unused-parameter-Werror
local_cflags_for_slang := -Wno-sign-promo -Wall-Wno-unused-parameter
9.错误:
一、环境设置
wayne@wayne-pc:~/Android/source$source build/envsetup.sh
includingdevice/htc/passion/vendorsetup.sh
includingdevice/samsung/crespo/vendorsetup.sh
wayne@wayne-pc:~/Android/source$lunch full-eng
在lunch时,如果提示permissiondenied权限不够的话,需要在源码根目录下执行,赋予目录下所有文件权限
wayne@wayne-pc:~/Android/source$sudo chmod -R 777 *
这时候会lunch指令会打印出如下所示文段:
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.3.3
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=GRI40
============================================
一、开始编译
编译过程可能会出现许多错误而中止,在此wayne将会把所有遇到的问题以及解决方法一一贴出来,以供以后参考。
10.错误:
wayne@wayne-pc:~/Android/source$make-j2
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.3.3
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=GRI40
============================================
Checkingbuild tools versions...
build/core/main.mk:76:************************************************************
build/core/main.mk:77:You are attempting to build on a 32-bitsystem.
build/core/main.mk:78: Only 64-bit build environments aresupported beyond froyo/2.2.
build/core/main.mk:79:************************************************************
build/core/main.mk:80:*** stop。停止。
解决方法:cd到源码根目录,执行:
$gedit build/core/main.mk
找到
ifneq(64,$(findstring 64,$(build_arch)))
将其修改为
ifneq(i686,$(findstring i686,$(build_arch)))
然后依次修改以下四个make文件:
external/clearsilver/cgi/Android.mk
external/clearsilver/java-jni/Android.mk
external/clearsilver/util/Android.mk
external/clearsilver/cs/Android.mk
将其中的
LOCAL_CFLAGS+= -m64
LOCAL_LDFLAGS += -m64
修改为
LOCAL_CFLAGS+= -m32
LOCAL_LDFLAGS += -m32
11.错误:
frameworks/base/libs/utils/RefBase.cpp:483:67:error: passing ‘const android::RefBase::weakref_impl’ as ‘this’argument of ‘void android::RefBase::weakref_impl::trackMe(bool,bool)’ discards qualifiers [-fpermissive]
make: ***[out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o]Error 1
解决方法:
$gedit frameworks/base/libs/utils/Android.mk
修改以下语句
LOCAL_CFLAGS+= -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
为
LOCAL_CFLAGS+= -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) –fpermissive
12.错误:
arm-eabi-gcc:error trying to exec 'cc1': execvp: No such file or directory
make:*** [out/target/product/generic/obj/lib/crtbegin_dynamic.o] Error 1
如果之前的依赖包都已经安装成功的话,此处应该是交叉编译工具权限的问题。这个问题只要在文章开头lunch时执行了赋予权限命令,就应该不会遇到了。
13.错误:
cc1plus: all warnings being treated as errors
make:*** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o]Error 1
此处编译错误是由于ubuntu11.10采用了GCC4.6.1导致的。
解决方法:
修改源码目录下/build/core/combo/HOST_linux-x86.mk文件:
将以下语句
HOST_GLOBAL_CFLAGS+= -D_FORTIFY_SOURCE=0
修改为
HOST_GLOBAL_CFLAGS+= -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
编译时还有可能出现类似的错误,根据错误提示的关键词比如g++错误、jre错误等,都是些细节问题,比较好解决。
经过两小时左右的等待后,终于顺利完成。编译成功后会生成system.img等镜像文件,下面是编译完成提示:
Targetsystem fs image:out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img
Installsystem fs image: out/target/product/generic/system.img
Installedfile list: out/target/product/generic/installed-files.txt
三、启动所编译的系统
编译完之后会在out/target/product/generic目录下生成system.imgramdisk.img userdata.img三个镜像文件。
在启动模拟器之前,需要先为模拟器系统设置环境变量,执行gedit~/.bashrc,新增环境变量如下:
exportANDROID_PRODUCT_OUT=~/Android/source/out/target/product/generic
ANDROID_PRODUCT_OUT_BIN=~/Android/source/out/host/linux-x86/bin
exportPATH=${PATH}:${ANDROID_PRODUCT_OUT_BIN}:${ANDROID_PRODUCT_OUT};
最后,同步这些变化并启动模拟器:
$source ~/.bashrc
$ cd~/Android/source/out/target/product/generic
$ emulator -systemsystem.img -data userdata.img -ramdisk ramdisk.img
加载上我们所编译出来的系统文件,终于出现了期待已久的模拟器:
ubuntu编译Android出现的若干错误及解决方法
刚下好android源码后马上编译会发现有各种各样的错误,原因是有些依赖包没有装。
为了避免出现以下我遇到的错误,请先安装jdk1.5,必须是jdk1.5,不然肯定编译不过的。
然后,在检查以下有没有安装以下依赖包:
sudoapt-get install bison libc6-dev-amd64 g++-multilib zlib1g-devlib64z1-dev flex libncurses5-dev libx11-dev gperf
下面是我遇到的错误及解决方法:
/bin/bash:bison:找不到命令
Checkingbuild toolsversions...
************************************************************
Youare attempting to build with the incorrect version
of java.
Yourversion is: /bin/bash: java:找不到命令.
Thecorrect version is: 1.6.
Pleasefollow the machine setup instructions at
http://source.android.com/source/download.html
************************************************************
build/core/main.mk:114:*** stop。停止。
解决方法:
sudoapt-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
hostC: 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,
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-get install libc6-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++.so whensearching 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: ldreturned 1 exit status
make: ***[out/host/linux-x86/obj/lib/libneo_util.so] 错误1
解决方法:
sudoapt-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 thisfunction)
external/clearsilver/cgi/cgi.c:885: error: (Eachundeclared identifier is reported onlyonce
external/clearsilver/cgi/cgi.c:885: error: for each functionit appears in.)
external/clearsilver/cgi/cgi.c:885: error:expected ‘;’ before ‘stream’
external/clearsilver/cgi/cgi.c:888:error: ‘stream’ undeclared (first use in thisfunction)
external/clearsilver/cgi/cgi.c:888: error: ‘Bytef’undeclared (first use in thisfunction)
external/clearsilver/cgi/cgi.c:888: error: expectedexpression before ‘)’ token
external/clearsilver/cgi/cgi.c:889:error: ‘uInt’ undeclared (first use in thisfunction)
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 thisfunction)
external/clearsilver/cgi/cgi.c:892: error: expected ‘)’before ‘stream’
external/clearsilver/cgi/cgi.c:895: error:‘alloc_func’ undeclared (first use in thisfunction)
external/clearsilver/cgi/cgi.c:895: error: expected ‘;’before numeric constant
external/clearsilver/cgi/cgi.c:896: error:‘free_func’ undeclared (first use in thisfunction)
external/clearsilver/cgi/cgi.c:896: error: expected ‘;’before numeric constant
external/clearsilver/cgi/cgi.c:897: error:‘voidpf’ undeclared (first use in thisfunction)
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 thisfunction)
external/clearsilver/cgi/cgi.c:900: error: ‘Z_DEFLATED’undeclared (first use in thisfunction)
external/clearsilver/cgi/cgi.c:900: error: ‘MAX_WBITS’undeclared (first use in thisfunction)
external/clearsilver/cgi/cgi.c:900: error:‘Z_DEFAULT_STRATEGY’ undeclared (first use in thisfunction)
external/clearsilver/cgi/cgi.c:901: error: ‘Z_OK’undeclared (first use in thisfunction)
external/clearsilver/cgi/cgi.c:904: error: ‘Z_FINISH’undeclared (first use in thisfunction)
external/clearsilver/cgi/cgi.c:905: error:‘Z_STREAM_END’ undeclared (first use in thisfunction)
external/clearsilver/cgi/cgi.c: In function‘cgi_output’:
external/clearsilver/cgi/cgi.c:1200: error:‘Z_NULL’ undeclared (first use in thisfunction)
external/clearsilver/cgi/cgi.c:1201: error: expected ‘)’before ‘Bytef’
external/clearsilver/cgi/cgi.c:1201: warning:cast from pointer to integer of differentsize
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
解决方法:
sudoapt-get install zlib1g-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.so whensearching 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 whensearching 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
解决方法:
sudoapt-get install lib64z1-dev
out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp:In function ‘intyyparse()’:
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
解决方法:
sudoapt-get install flex
Docsdroiddoc: 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
hostExecutable: 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
解决方法:
sudoapt-get install libncurses5-dev
hostC: emulator <= external/qemu/android/main.c
In file includedfromexternal/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: 没有那个文件或目录
Infile included fromexternal/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: implicitdeclaration of function ‘audio_check_backend_name’
make: ***[out/host/linux-x86/obj/EXECUTABLES/emulator_intermediates/android/main.o]错误1
解决方法:
sudoapt-get install libx11-dev
GeneratingCSSPropertyNames.h <= CSSPropertyNames.in
sh: gperf: notfound
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”
解决方法:
sudoapt-get install gperf
2、
5、
Q:make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libgtest_host_intermediates/gtest-all.o] Error 1
external/gtest/include/gtest/internal/gtest-param-util.h 7、
8、
9、
10、
=== error: do_inode_allocate_extents: Failed to allocate blocks ===
One way to workaround this is to increase the system image size. make: *** [out/target/common/obj/APPS/Calculator_intermediates/classes-full-debug.jar] 错误 41
make: *** 正在等待未完成的任务....
packages/apps/Camera/src/com/android/camera/BitmapManager.java:19: 无法访问 android.content.ContentResolver
错误的类文件: android/content/ContentResolver.class(android/content:ContentResolver.class)
无法访问文件: corrupted zip file
请删除该文件或确保该文件位于正确的类路径子目录中。
import android.content.ContentResolver;
^
make: *** [out/target/common/obj/APPS/Camera_intermediates/classes-full-debug.jar] 错误 41
development/samples/ApiDemos/src/com/example/android/apis/animation/Rotate3dAnimation.java:19: 无法访问 android.view.animation.Animation
错误的类文件: android/view/animation/Animation.class(android/view/animation:Animation.class)
无法访问文件: corrupted zip file
请删除该文件或确保该文件位于正确的类路径子目录中。
import android.view.animation.Animation;
^
make: *** [out/target/common/obj/APPS/ApiDemos_intermediates/classes-full-debug.jar] 错误 41
packages/apps/DeskClock/src/com/android/alarmclock/AnalogAppWidgetProvider.java:22: 无法访问 android.app.PendingIntent
错误的类文件: android/app/PendingIntent.class(android/app:PendingIntent.class)
无法访问文件: corrupted zip file
请删除该文件或确保该文件位于正确的类路径子目录中。
import android.app.PendingIntent;
^
make: *** [out/target/common/obj/APPS/DeskClock_intermediates/classes-full-debug.jar] 错误 41
解决方法
以上错误是由于编译系统文件时没安装所需要包,以下是整个过程中所需的所有包:
$sudo apt-get install git-core gnupg gperf libsdl-dev libesd0-dev
$sudo apt-get install libwxgtk2.6-dev zip curl minicom tftpd
$sudo apt-get install uboot-mkimage libx11-dev libncurses-dev
$sudo apt-get install expect bison build-essential flex zlib1g-dev
之后输入如下命令来清除已编译的:$ make clobber
接着重新编译就可以了(没办法,只能重新编译-_-)。