|
第一次玩Android,弄来一点资源,碰到一些编译问题,为此,将搭建ubuntu 14.04 LTS版本的编译环境,做个记录。
8 n6 _* }- ~/ W: D( u1 O9 g+ P& A0 g& W% z. {+ s1 l3 L z) d
一、for MTK8382
( p1 E Q. N: ?. F4 X8 H: e" t% L" d3 F+ g: ?' k+ Q
1、安装完OS,保持网络畅通,安装ia32老的库和相应的开发工具及库,- sudo -i0 X7 ^' j; Y8 T: r- ~$ N. i
- cd /etc/apt/sources.list.d
7 Z. T6 ~/ }2 D - echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-raring.list* w0 ^$ m# `6 b
- apt-get update
6 z$ `3 h: v0 B) k4 \$ y - apt-get install ia32-libs( M: S1 V' J$ @2 f* L, ^5 E8 q8 p
- . S! ]1 i. q4 \. a7 t. G) T0 @4 e
- apt-get install dpkg-dev! {9 L, m) b+ B' f) Z
0 i' a) |4 O( w$ s! I- 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' \' B1 N( F* v2 r
复制代码 2、安装JDK和SDK
6 M5 K2 k' R1 I; g% j b/ a: B4 U2 b4 \# C, ^8 z
从Orace网站上找jdk-6u23-linux-x64.bin :http://www.oracle.com/technetwor ... javase6-419409.html- cp jdk-6u23-linux-x64.bin /opt/9 s l ]7 P/ S2 l: G9 ]
- chmod a+x jdk-6u23-linux-x64.bin
" ?. W$ o7 V1 C" t - ./jdk-6u23-linux-x64.bin
复制代码 google官网上下载adt-bundle-linux-x86_64-20140321.zip : https://dl.google.com/android/ad ... x86_64-20140321.zip
. }3 W: N% |' L @1 d如果下不到,可能需要翻墙,或者在网上搜相应的文件,找到下载即可- unzip adt-bundle-linux-x86_64-20140321.zip
' m g5 M r* I - cd adt-bundle-linux-x86_64-20140321- }6 o8 q* {' |4 i- w
- sudo cp -r * /opt/
复制代码 3、改变shell环境变量增加如下内容- JAVA_HOME=/opt/jdk1.6.0_23
! R, a: M+ k' E; C - export JAVA_HOME
, p# u' B$ n0 u7 s; |6 q3 g
# G j1 j5 J# k2 U- ANDROID_JAVA_HOME=/opt/jdk1.6.0_23' A" x- l( \/ A# W9 B2 b
- export ANDROID_JAVA_HOME! \( @# k. w! V6 d h* v
- export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib: E/ Z* B7 b9 f+ t# h
- ! R$ H# T: c& b6 `. j0 h, u
- PATH=/opt/jdk1.6.0_23/bin:/opt/sdk/platform-tools:/opt/sdk/tools:$PATH
' K- H& i7 x& | - export PATH
复制代码 4、安装gcc 4.4,并使用此版本- sudo -s3 n; h# s: a8 v& r
- apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib8 ^! e$ H o0 S9 ^
- cd /usr/bin/% }5 \6 V) L5 [7 b0 k8 l, j
- mv gcc gcc.4.83 \8 H& m$ Q% C$ q* c
- mv g++ g++.4.8# r% x. \& o2 D3 I+ h) m6 ?
- ln -s g++-4.4 g++
Z9 Z! ~2 d3 N, U - 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.+ k% V0 n1 f. ^0 c- {$ b" g
- 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
复制代码 按以上顺序,编译即成功.# n, |: ` g% \+ i! \: g
|
|