Ubuntu12.04环境下的android源码编译

时间:2022-05-25 09:25:54

sudo apt-get install libncurses5-dev:i386


Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libncurses5-dev:i386 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  ncurses-doc libtinfo-dev

E: Package 'libncurses5-dev:i386' has no installation candidate


 出现这种问题,是因为使用64位系统,不能用i386,这是32bit的,网上没有成功例子,所以尝试了sudo apt-get install libncurses5-dev:amd64..竟然可以安装,所以其他i386问题都可以这样解决吧。


if you are setting up an environment for android source code in 64 bits system, the official command may be wrong , use this

$ sudo apt-get install git gnupg flex bison gperf build-essential \
  zip curl libc6-dev libncurses5-dev:amd64 x11proto-core-dev \
  libx11-dev:amd64 libreadline6-dev:amd64 libgl1-mesa-glx:amd64 \
  libgl1-mesa-dev g++-multilib mingw32 tofrodos \
  python-markdown libxml2-utils xsltproc zlib1g-dev:amd64
$ sudo ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so (注意是/usr下的lib)


java安装错误

先参考http://www.cnblogs.com/samcn/archive/2011/03/16/1986248.html配置。然后报错,系统已经自带openJDK1.6.0_27

Your version is: java version "1.6.0_27".

The correct version is: Java SE 1.6.

通过这篇方法解决:

点击打开链接


gedit ~/.bashrc
文件末尾添加如下描述信息:
export JAVA_HOME=/usr/lib/jdk/jdk1.7.0_17
export JRE_HOME=/usr/lib/jdk/jdk1.7.0_17/jre
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib


同步一下:
. ~/.bashrc

update-alternatives --install /usr/bin/java java /usr/lib/jdk/jdk1.7.0_17/bin/java 300

update-alternatives --install /usr/bin/javac javac /usr/lib/jdk/jdk1.7.0_17/bin/javac 300


确认一下路径:
printenv JAVA_HOME


java -version
打印:
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) Server VM (build 23.7-b01, mixed mode)

Could not create the Java virtual machine.

Header: out/target/product/rk30sdk/obj/include/libwpa_client/wpa_ctrl.h
make: *** [out/host/common/obj/JAVA_LIBRARIES/jsr305lib_intermediates/javalib.jar] Error 41
make: *** Waiting for unfinished jobs....
Import includes file: out/host/linux-x86/obj/STATIC_LIBRARIES/libhost_intermediates/import_includes

这是因为java的执行程序配置正确,根据修改

http://paddy-w.iteye.com/blog/958062

http://developer.51cto.com/art/200906/129515.htm


继续编译发现以下错误

找不到libz.so.1

经过本节分析,是缺少了lib32z1-dev这个库,安装即可。

以下为分析过程,仅供参考:

Refference link :

http://zhoulifa.bokee.com/6094520.html(This websit is good for learning)

1、查看库文件是由哪个软件包提供的
空闲时打开/usr/lib目录(因为我知道这个目录下放着一些库文件,是我们开发者可以利用的)想看看我的系统中有哪些库。
看到一个libz.so,于是用命令查看:

dpkg -S /usr/lib/libz.so
此命令输出如下信息:
zlib1g-dev: /usr/lib/libz.so
即我的系统中软件包zlib1g-dev提供了libz.so这个库文件。
2、查看软件包的详细信息
可以用下列命令查看此软件包是干什么的:
apt-cache show zlib1g-dev
输出内容一部分为:
Description: compression library - development
zlib is a library implementing the deflate compression method found
in gzip and PKZIP. This package includes the development support
files.
Bugs: mailto:ubuntu-users@lists.ubuntu.com
Origin: Ubuntu
显然这个软件包提供了用gzip和PKZIP压缩算法进行开发的相关东西。

继续用下面的命令查看zlib1g-dev软件包的详细信息:
dpkg -L zlib1g-dev


10.04安装正常版本的分析结果

dpkg -S libz.so

结果:
  lib32z1-dev: /usr/lib32/libz.so
  zlib1g: /lib/libz.so.1.2.3.3
  lib32z1: /usr/lib32/libz.so.1
  lib32z1: /usr/lib32/libz.so.1.2.3.3
  zlib1g-dev: /usr/lib/libz.so
  zlib1g: /lib/libz.so.1


12.04安装错误的分析结果

locate -b 'libz.so*'
  /lib/x86_64-linux-gnu/libz.so.1
  /lib/x86_64-linux-gnu/libz.so.1.2.3.4
  /usr/lib/libz.so.1
  /usr/lib/x86_64-linux-gnu/libz.so

Server:/$ dpkg -S libz.so
  zlib1g: /lib/x86_64-linux-gnu/libz.so.1.2.3.4
  zlib1g: /lib/x86_64-linux-gnu/libz.so.1

根据10.04安装lib32z1-dev后

Server:/$ dpkg -S libz.so
  lib32z1-dev: /usr/lib32/libz.so
  lib32z1: /usr/lib32/libz.so.1
  lib32z1: /usr/lib32/libz.so.1.2.3.4
  zlib1g-dev: /usr/lib/x86_64-linux-gnu/libz.so
  zlib1g: /lib/x86_64-linux-gnu/libz.so.1.2.3.4
  zlib1g: /lib/x86_64-linux-gnu/libz.so.1

再次编译,问题解决!真是感谢周立发先生。

PS:我本来想试试看1bi64z1-dev:i386的,但是装完这个后就可以了,就不尝试了,交给后人把。