Chinaunix首页 | 论坛 | 博客
  • 博客访问: 547187
  • 博文数量: 179
  • 博客积分: 3845
  • 博客等级: 中校
  • 技术积分: 2003
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-16 21:25
文章分类
文章存档

2012年(74)

2011年(105)

分类: 嵌入式

2012-05-14 13:34:29

ubuntu11.0.4 下编译Android2.3源码过程

    最近几天修改 Android系统源码,遇到很多让人崩溃的问题。现在根据记忆写下,以后方便解决。

    从2.3开始,jdk使用1.6版本及Linux系统使用64位,所以很多工具都要重新安装。

    以下是第一次编译时遇到的问题:

1、权限不够遇到多 次
/bin/bash: prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: 权限不够
/bin/bash: prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: 权限不够
/bin/bash: build/core/find-jdk-tools-jar.sh: 权限不够
/bin/bash: build/tools/findleaves.py: 权限不够
/bin/bash: build/tools/findleaves.py: 权限不够
Checking API: checkapi-last
/bin/bash: out/host/linux-x86/bin/apicheck: 权限不够

解决:
chmod a+x prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc
对所有没有权限的 文件增加可执行权限

2.make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp.o] 错误 1
在 32位下编译,直接make就可以了
在64位下编译,会出一些错误,需要额外安装一些包:
     A, 没有gnu/stubs-32.h文件:
      /usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: 没有该文件或目录
      make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp.o] 错误 1
解决方法:
确定你的系统是x86_64 GNU/Linux
      
# uname -a
       Linux mm-desktop 2.6.27-9-generic #1 SMP Thu Nov 20 22:15:32 UTC 2008 x86_64 GNU/Linux
安装libc6-dev-i386
     sudo apt-get install libc6-dev-i386

     B。找不到-lstdc++
     /usr/bin/ld: cannot find -lstdc++
解决方法:
安装 g++-multilib,lib32z1-dev 和 lib32ncurses5-dev
      apt-get install g++-4.2-multilib  lib32z1-dev lib32ncurses5-dev


3.make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp] 错误 1
安 装 g++-4.5-multilib
 $ sudo aptitude install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev java-common unixodbc

 4.arm-eabi-gcc: error trying to exec 'cc1': execvp: No such file or directory

同事编kernel的时候总是会报下面的错误~~最后发现是交叉编译工具的权限问题,chmod -R 777 * 就可以了
arm-eabi-gcc: error trying to exec 'cc1': execvp: No such file or directory
总结一下:
1、确认CROSS-COMPILE的目录在PATH里面
2、确认 cc1是存在的
3、确认交叉编译工具的权限

4.  重新安装g++,并修改默认的g++连接到你安装的版本。

摘录:

错误处理
      在Ubuntu10.10(64位)编译Android2.3源码时,遇到各种各样的问题。不是缺这个,就是少那个。现把这些问题和解决方法罗列出来,供 大家参考。

错误:
/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory
make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp.o] 错误 1

解决:
   sudo apt-get install libc6-dev-i386

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

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

错误:
external/clearsilver/cgi/cgi.c:22: fatal error: zlib.h: No such file or directory
compilation terminated.
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libneo_cgi_intermediates/cgi.o] Error 1

解决:
sudo apt-get install zlib1g-dev

错误:
/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 lib32z1-dev

错误:
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

错误:
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
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] Error 1

解决:
sudo apt-get install lib32ncurses5-dev

错误:
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

解决:
sudo apt-get install libx11-dev

错误:
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] Error 25
make: *** Deleting file `out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSPropertyNames.h'

解决:
sudo apt-get install gperf

错误:
build/core/java.mk:9: *** bin: Target java module does not define any source or resource files. Stop.

解决:
      删 除源码根目录下的bin文件夹,这个文件夹是导入eclipse时创建的。

cannot find -lXXX
          所有编译过程中遇到的类似这样的错误,都是缺少libXXX这样的库,解决方法就是:
首先: 利用命令:apt-cache search XXX 进行库搜索
然后:找那些libXXX-dev这样的库进行安装,命令就是:sudo apt-get install libXXX-dev
最后:继续执行make
阅读(8665) | 评论(0) | 转发(2) |
给主人留下些什么吧!~~