Keep on going, never give up.

Andriod源码编译常见错误

做Android编码开发时,首先是搭建环境,第一次编译Android源码本该一次通过,可人生不如意十之八九,总会遇到各种环境问题,大都跟软件包有关,Ubuntu每个版本默认安装的软件包及其版本都不同,所以,一旦遇到编译问题,实在无法解决,最好首先向官方推荐的系统环境靠齐,本文整理自之前开发笔记,部分错误及解决办法来源于文末参考地址。

本文系统:Ubuntu 10.10 desktop amd64,Android 2.3/mtk

常见错误列表如下:

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

Error: /usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory compilation terminated. make: *** [bitmap.o] Error 1

Install: libc6-dev-i386

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

Error: skipping incompatible /usr/lib/libz.so

Install: lib32z1-dev

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

Error: register.inc.list: No such file or directory

Install: apt-get install linux-kernel-headers

备注:ubuntu的话是linux-kernel-headers,fedora才是kernel-headers

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

Error: make[3]: *** [out/host/linux-x86/obj/EXECUTABLES/vm-tests_intermediates/tests] Killed

make[3]: *** Waiting for unfinished jobs....

Solution: Try to reinstall Ubuntu on single driver instead of using wubi.exe as a vmdisk

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

Error:

find: `frameworks/base/frameworks/base/docs/html': No such file or directory

find: `out/target/common/docs/gen': No such file or directory

find: `packages/partner/xt9': No such file or directory

Solution:

Create these folders, yes, just a empty folder.

备注:以上报错上从提示上可以看出是某个编译变量的把相对路径/绝对路径搞错了,只需要创建对应的空文件夹即可,天缘实际使用中发现,可能跟我们的工程配置有关,如果调整适当,比如上面的xt9,可以检查xt9输入法开关/编译配置等地方,应该不会报上文错误的。

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

Error:find: `mediatek/source/frameworks/blueangel/java/android': No such file or directory

Solution: Try to check BT settings in your  project config file.

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

Error: external/clearsilver/cgi/cgi.c:22: fatal error: zlib.h: No such file or directory

Resolution: apt-get install zlib1g-dev

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

Error: make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp] error 1

Install: apt-get install g++-multilib

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

Error:

sh: gperf: not found

calling gperf failed: 32512 at ./makeprop.pl line 96.

Try:

apt-get install gperf

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

Error:

/usr/bin/ld: cannot find -lz

collect2: ld returned 1 exit status

make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] Error 1

Try: apt-get install lib32z1-dev

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

Error:

/usr/bin/ld: cannot find -lncurses

collect2: ld returned 1 exit status

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

Try: apt-get install lib32ncurses5-dev

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

Error:

prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:55: fatal error: X11/Xlib.h: No such file or directory

compilation terminated.make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_intermediates/Android/main-common.o] Error 1

Try:apt-get install libx11-dev

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

Error:

make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/

libEGL_translator_intermediates/EglX11Api.o] Error 1

Try: apt-get install libgl1-mesa-dev

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

Error:

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

Try: apt-get install bison

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

Error:

Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l

/bin/bash: flex: command not found

Try: apt-get install flex

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

Error:

external/clearsilver/cgi/cgi.c:22: fatal error: zlib.h: No such file or directory

compilation terminated.

Try: apt-get install zlib1g-dev

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

参考资料(部分错误及解决办法来源):

http://blog.sina.com.cn/s/blog_ab85e99501018r6z.html

http://yangguangfu.iteye.com/blog/1001605

http://www.cnblogs.com/wdpp/archive/2011/11/16/2386719.html

相关评论(0):  

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

订阅博客

最新文章

本站采用创作共用版权协议, 要求署名、非商业用途和保持一致. 转载也必须遵循“署名-非商业用途-保持一致”的创作共用协议. 返回顶部
Copyright@2005-2016 Metsky.com, All rights Reserved.