|
|
第一次玩Android,弄来一点资源,碰到一些编译问题,为此,将搭建ubuntu 14.04 LTS版本的编译环境,做个记录。
% P" k0 n- g% w ]. o
* U% ?2 V/ B7 Z9 X' P' ^一、for MTK8382. |( P) ?7 x( r0 [! N% n% x( E
: q x; Z+ H- r$ E( q1 g1、安装完OS,保持网络畅通,安装ia32老的库和相应的开发工具及库,- sudo -i
9 G8 D! U( `* G$ P- P - cd /etc/apt/sources.list.d$ A) Q" _) d' J9 p6 q
- echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-raring.list& ?% p. X5 e6 Z- {- _" [
- apt-get update% q3 X7 n! `. W/ z
- apt-get install ia32-libs4 S6 Z5 {! a2 T- e3 X: ?
6 J) m! Z+ n* `6 ?- apt-get install dpkg-dev; r! p* g, N% @: i) W; F) c8 C) u
- : K6 H$ l8 `! @+ f
- apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev:i386 g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386$ ?; w. N! L6 A% f W5 G6 N/ ?
复制代码 2、安装JDK和SDK) l5 Z/ `* U+ _; ?
3 r$ y# K( d, S. y从Orace网站上找jdk-6u23-linux-x64.bin :http://www.oracle.com/technetwor ... javase6-419409.html- cp jdk-6u23-linux-x64.bin /opt/4 T. ^9 C3 g, W
- chmod a+x jdk-6u23-linux-x64.bin2 d# k! S% G$ K
- ./jdk-6u23-linux-x64.bin
复制代码 google官网上下载adt-bundle-linux-x86_64-20140321.zip : https://dl.google.com/android/ad ... x86_64-20140321.zip7 U) O _ Z0 E: j) g1 }
如果下不到,可能需要翻墙,或者在网上搜相应的文件,找到下载即可- unzip adt-bundle-linux-x86_64-20140321.zip
9 f+ P% k7 [6 Z; ~, Q - cd adt-bundle-linux-x86_64-20140321
* i. l4 X: c7 q- } - sudo cp -r * /opt/
复制代码 3、改变shell环境变量增加如下内容- JAVA_HOME=/opt/jdk1.6.0_23
6 R% j0 b* S3 x3 H) Y! g5 F - export JAVA_HOME
' m- _( m- _0 U9 f; {6 ^- V - 2 w6 @. ?* Z9 W w5 d$ u
- ANDROID_JAVA_HOME=/opt/jdk1.6.0_23
T. r3 K4 ~7 ~ - export ANDROID_JAVA_HOME$ i' ^# ~) g( w2 o1 {# y$ h- V
- export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
5 {7 R- H# }6 j0 I8 E0 J$ y( l - 3 K: ^6 U, w& \3 b* Y: s8 R/ M: _ F
- PATH=/opt/jdk1.6.0_23/bin:/opt/sdk/platform-tools:/opt/sdk/tools:$PATH
: M, V0 P2 |2 V6 o* b2 Q9 h - export PATH
复制代码 4、安装gcc 4.4,并使用此版本- sudo -s# v6 a0 q/ }' ?- ~) x5 N/ i. @: r8 y" i
- apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib
0 M. \% M$ F- O5 N* |5 O- d - cd /usr/bin/
0 s3 X0 `$ d: t6 H4 `2 [ - mv gcc gcc.4.80 g5 \0 X/ O3 b1 ^+ I8 p
- mv g++ g++.4.8; J) t D) W) [& f: x
- ln -s g++-4.4 g++
+ E4 A0 ^) e! F$ I r) j& } - ln -s gcc-4.4 gcc
复制代码 5、重新打开shell,编译时,发现log_err :- `mediatek/protect/frameworks/base/*/': No such file or directory
复制代码 以为android的编译错误只会放在log_err里,看了半天没找到原因,后面看log时才发现:- Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at external/webkit/Source/WebCore/make-hash-tools.pl line 23.
9 z$ Y* d, J5 D g& H0 D- m4 ~$ E9 d& q - BEGIN failed--compilation aborted at external/webkit/Source/WebCore/make-hash-tools.pl line 23.
复制代码 开打pl文件,并依据提示,少了libswitch-perl库。在此提示,请尽量检查log……安装相应的库文件。- sudo apt-get install libswitch-perl
复制代码 按以上顺序,编译即成功.6 D$ I- X" v! H- u. \
|
|