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

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
      
root@mm-desktop:/home/mm/android# 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、确认交叉编译工具的权限

 

 

 

摘录:

错误处理
      在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

生成固件

1.在源码根目录下执行一下:
. build/envsetup.sh

2.通过所有编译(make)或模块编译(mmm)

   需要使用超级用户进行编译,要不会出现一下权限问题

3.通过 export -p 查看HOME 的路径是否正确,否则修改 HOME 锁指向的路径为home/用户 中,直接 export HOME="/home/用户"
4.在“/home/用户”目录下新建文件夹 firmware
5.在Android 源码根目录下 执行./mkimage.sh

修改./mkimage.sh 中的路径指向 “/home/用户”目录下的文件夹 firmware

固件在firmware中生成

 

你可能感兴趣的:(android,ubuntu,Flex,File,command,工具)