|
|
第一次玩Android,弄来一点资源,碰到一些编译问题,为此,将搭建ubuntu 14.04 LTS版本的编译环境,做个记录。
, |2 N! `3 E) D% q0 R7 U7 D! r X* F4 P$ g! x; o, {" D" r7 _
一、for MTK8382
$ M$ O) Z1 T' i9 S8 x) d! d
, E# \6 \8 A: j9 |1、安装完OS,保持网络畅通,安装ia32老的库和相应的开发工具及库,- sudo -i
v+ z& |2 g- \( U! W - cd /etc/apt/sources.list.d
: z& |; l0 X+ q) r8 C - echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-raring.list! o$ I& Q- S, _
- apt-get update
9 C( r4 n8 Y. ` - apt-get install ia32-libs. C" J" C* @; a: V+ V( d
- $ c0 G3 |# f: [& c# W4 D& A# n- s& r
- apt-get install dpkg-dev
# O* r a% g$ _, y& } - / h+ e- E1 X2 j, H+ X; h7 ]$ _
- 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% L% D1 u: m8 i3 d5 c @" b7 [
复制代码 2、安装JDK和SDK
/ s( K% s2 q$ H: d9 D
+ W% r! f' u2 y从Orace网站上找jdk-6u23-linux-x64.bin :http://www.oracle.com/technetwor ... javase6-419409.html- cp jdk-6u23-linux-x64.bin /opt/
! D0 J, E% _# w+ w; [2 a - chmod a+x jdk-6u23-linux-x64.bin3 s, I! [& B* r6 W6 U/ r! w
- ./jdk-6u23-linux-x64.bin
复制代码 google官网上下载adt-bundle-linux-x86_64-20140321.zip : https://dl.google.com/android/ad ... x86_64-20140321.zip: J5 a) D; k3 J9 \& f. o
如果下不到,可能需要翻墙,或者在网上搜相应的文件,找到下载即可- unzip adt-bundle-linux-x86_64-20140321.zip
. F( q4 {" ?- @ f; t - cd adt-bundle-linux-x86_64-20140321" O" S* n1 g8 ~/ J% T. Z/ R6 @* |
- sudo cp -r * /opt/
复制代码 3、改变shell环境变量增加如下内容- JAVA_HOME=/opt/jdk1.6.0_23
& P0 e: X( B. H, I; H - export JAVA_HOME- r& x0 y }" }- }% o, g
6 C1 `0 m% Q% x5 x- ANDROID_JAVA_HOME=/opt/jdk1.6.0_23
" s1 _( T/ l8 Q - export ANDROID_JAVA_HOME4 \. r) u$ P+ l" ]' Q
- export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib- I& n) S. M( m4 k* u% S. T) b* X
- _! B" O! M1 V" c: Q h) E5 e- PATH=/opt/jdk1.6.0_23/bin:/opt/sdk/platform-tools:/opt/sdk/tools:$PATH
. D8 W9 i; n' i, \: B/ s+ q& L2 x - export PATH
复制代码 4、安装gcc 4.4,并使用此版本- sudo -s
) d2 ^3 ?8 q9 } - apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib
0 @' J# Y& Q2 |* J7 k - cd /usr/bin/- l _. x' Y7 V1 |7 |6 w
- mv gcc gcc.4.8# V/ p% l5 \6 W$ m3 S5 y8 t& A
- mv g++ g++.4.8) F; i0 i# Z0 |) C/ w! y
- ln -s g++-4.4 g++
) \% @, j2 |' q- R! p# [ - 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.. S( ?9 i8 r' J9 l% k6 q8 N$ o
- 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
复制代码 按以上顺序,编译即成功.' K6 u k8 J: ?" s# I, x
|
|