ubuntu12.10 64位编译Android4.1

1、更新source.list源

gedit /etc/apt/source.list

#网易的源(163源,无论是不是教育网,速度都很快)
deb http://mirrors.163.com/ubuntu/ quantal main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ quantal main universe restricted multiverse
deb http://mirrors.163.com/ubuntu/ quantal-security universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-security universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ quantal-updates universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ quantal-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-proposed universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ quantal-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ quantal-updates universe main multiverse restricted

#台湾源(台湾的ubuntu 更新源还是很给力的)
deb http://tw.archive.ubuntu.com/ubuntu/ quantal main universe restricted multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu/ quantal main universe restricted multiverse
deb http://tw.archive.ubuntu.com/ubuntu/ quantal-security universe main multiverse restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ quantal-security universe main multiverse restricted
deb http://tw.archive.ubuntu.com/ubuntu/ quantal-updates universe main multiverse restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ quantal-updates universe main multiverse restricted

 

#mirror.lupaworld.com的源,速度很快
deb http://mirror.lupaworld.com/ubuntu/archive/ quantal main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ quantal-security main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ quantal-updates main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ quantal-backports main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/ubuntu-cn/ quantal main restricted universe multiverse

#ubuntu.cn99.com源(推荐):
deb http://ubuntu.cn99.com/ubuntu/ quantal main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ quantal-updates main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ quantal-security main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ quantal-backports main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu-cn/ quantal main restricted universe multiverse

保存

sudo apt-get update

 

2、安装JDK1.6

http://www.oracle.com/technetwork/java/javase/downloads/jdk6downloads-1902814.html

这里选择的是jdk-6u43-linux-x64.bin

我将下载的jdk-6u43-linux-x64.bin文件置于/usr/lib/中。
然后修改bin文件权限,使其可执行,在shell中执行:

[cpp] view plaincopy
 
  1. sudo chmod u+x /usr/lib/jdk-6u43-linux-x64.bin  


执行下面命令,将会出现字幕,持续按回车键,直至屏幕显示要求输入yes/no,此时输入y回车,将会把jdk解压到文件夹,得jdk1.6.0_43目录。

[cpp] view plaincopy
 
  1. sudo /usr/lib/jdk-6u43-linux-x64.bin

此时,jdk已安装完毕。

 

下面进行配置,在environment中修改,

[cpp] view plaincopy
 
  1. sudo vi /etc/environment  


添加如下部分

[cpp] view plaincopy
 
  1. PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jdk1.6.0_43"
    CLASSPATH=.:/usr/lib/jdk1.6.0_43/lib  
    JAVA_HOME=/usr/lib/jdk1.6.0_43 

或者直接在/etc/profile中添加:(推荐使用)

[cpp] view plaincopy
 
  1. sudo vi /etc/profile  
[cpp] view plaincopy
 
  1. #JAVAEVIRENMENT  
  2. export JAVA_HOME=/usr/lib/jdk1.6.0_43  
  3. export JRE_HOME=$JAVA_HOME/jre  
  4. export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH  
  5. export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH  

 

由于ubuntu中可能会有默认的jdk,如openjdk,所以,为了使默认使用的是我们安装的jdk,还要进行如下工作。

通过这一步将我们安装的jdk加入java选单,执行:

[cpp] view plaincopy
 
  1. sudo update-alternatives --install /usr/bin/java java /usr/lib//bin/java 300  
  2. sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java/jdk1.6.0/bin/javac 300  
  3. sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/java/jdk1.6.0/bin/javah 300  

然后执行,通过这一步选择系统默认的jdk:
[cpp] view plaincopy
 
  1. sudo update-alternatives --config java  
  2. sudo update-alternatives --config javac  
  3. sudo update-alternatives --config javah  

这样,再在shell中输入,就会显示系统使用的java是sun的java:
[cpp] view plaincopy
 
  1. java -version  
3、编译Android4.1

1)

toltech@toltech-Lenovo:/home/jb$ lunch rk30sdk-eng 
/bin/bash: bison: 未找到命令
解决:sudo apt-get install bison

2)

toltech@toltech-Lenovo:/home/jb$make -j8

mkdir: 无法创建目录"out": 权限不够

解决:使用root用户登录

3)

/bin/bash: xsltproc: 未找到命令
解决:apt-get install xsltproc
4)

/bin/bash: flex: 未找到命令

解决:apt-get install flex

5)prebuilts/tools/gcc-sdk/gcc: 行 40: prebuilts/tools/gcc-sdk/../../gcc/linux-gcc命令为找到

 

解决:
$ sudo apt-get install gcc-4.4 g++-4.4
which gcc
cd /usr/bin/
rm gcc g++
ln -s gcc-4.4 gcc
ln -s g++-4.4 g++

6)

 

 

在编译内核的时候,提示如下错误:

[plain] view plaincopy
 
  1. dingq@wd-u1110:~/hwsvn/2sw/1prj_linux/pdu/kernel/linux-2.6.30$ make menuconfig  
  2.  *** Unable to find the ncurses libraries or the  
  3.  *** required header files.  
  4.  *** 'make menuconfig' requires the ncurses libraries.  
  5.  ***   
  6.  *** Install ncurses (ncurses-devel) and try again.  
  7.  ***   
  8. make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1  
  9. make: *** [menuconfig] Error 2  

解决办法:只要安装libncurses5-dev就够了。
[html] view plaincopy
 
  1. sudo apt-get install libncurses5-dev  
安装完毕之后再运行make menuconfig就可以了。

7)

64位系统用32位的交叉工具链

PC:ubuntu12.10-64位

交叉工具链:mipsel-linux-gcc-32位

 

查看工具链版本的时候出现一下错误:

mipsel-linux-gcc -v

bash: ***/mipsel-linux-gcc : no such flie or directory

 

解决:

sudo apt-get install ia32-lib*

 

8)

/bin/sh: 1: uudecode: not found

解决:#sudo apt-get install sharutils

 

9)
/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory
解决:
apt-get install libc6-dev-i386
 
10)
/bin/bash: xmllint: 未找到的命令
解决:sudo apt-get install libxml2-utils
 

sudo apt-get install libxml2-utils xsltproc
 
11)File "/usr/lib/python2.7/subprocess.py", line 1239, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
解决:sudo apt-get install git git-core

 

 

原文:http://blog.csdn.net/qq258711519/article/details/8722774

posted on 2014-04-18 14:34  veins  阅读(285)  评论(0编辑  收藏  举报

导航