|
第一次玩Android,弄来一点资源,碰到一些编译问题,为此,将搭建ubuntu 14.04 LTS版本的编译环境,做个记录。( z6 y" K7 q) ~" B6 R+ t8 ^
7 t c0 U2 ^5 m* M一、for MTK8382
$ B0 ~8 ~7 ]" T) y
. Q6 U5 f3 G2 K2 `8 U* D1、安装完OS,保持网络畅通,安装ia32老的库和相应的开发工具及库,- sudo -i
0 s. Q& T; \+ M7 N - cd /etc/apt/sources.list.d
) y& _$ q: a8 L+ Z9 z0 J8 A! b - echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-raring.list
, o7 Z5 U) ]3 l5 z. | - apt-get update- E9 p5 \0 j" O
- apt-get install ia32-libs
( z# p8 Q) A m X - & x+ i8 {) h0 `5 t; W1 l$ e7 t
- apt-get install dpkg-dev- m# A$ F( x0 x6 J4 V1 I
# {* |- G& D# V9 _# b- 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
: T- h) S4 y* f/ i( L, a4 m; q
复制代码 2、安装JDK和SDK& P) m8 f+ }4 `( q4 U0 a9 D) i4 S
+ f5 K# i" Z( M2 o, n5 Q
从Orace网站上找jdk-6u23-linux-x64.bin :http://www.oracle.com/technetwor ... javase6-419409.html- cp jdk-6u23-linux-x64.bin /opt/
7 T1 f' }# @, K) G - chmod a+x jdk-6u23-linux-x64.bin( W% V* y( a5 I/ k! o( H, f5 G
- ./jdk-6u23-linux-x64.bin
复制代码 google官网上下载adt-bundle-linux-x86_64-20140321.zip : https://dl.google.com/android/ad ... x86_64-20140321.zip! F+ W, }% l5 T
如果下不到,可能需要翻墙,或者在网上搜相应的文件,找到下载即可- unzip adt-bundle-linux-x86_64-20140321.zip" C& {/ [) B# s9 ?5 ~$ D( Q0 w
- cd adt-bundle-linux-x86_64-20140321
! M. Y* q# [9 ? - sudo cp -r * /opt/
复制代码 3、改变shell环境变量增加如下内容- JAVA_HOME=/opt/jdk1.6.0_23! D) C1 M; p+ d2 r/ H
- export JAVA_HOME
9 N0 g2 x, F) g, f* y - 2 a& P: v8 N3 v6 O
- ANDROID_JAVA_HOME=/opt/jdk1.6.0_23
: Z, X2 F5 y" c8 k; [ - export ANDROID_JAVA_HOME! g( X% h1 B, T& L# Z
- export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
: p0 \/ ]- X& q0 C - , ^( f4 n# A a& f2 P2 R+ U
- PATH=/opt/jdk1.6.0_23/bin:/opt/sdk/platform-tools:/opt/sdk/tools:$PATH
; z0 M W2 J6 G+ k# u% J4 V. A - export PATH
复制代码 4、安装gcc 4.4,并使用此版本- sudo -s
* Q* C6 @8 |: l' B3 @ - apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib1 J0 u: @+ w3 Y3 E+ f) x
- cd /usr/bin/
$ M* c4 I/ ~ p2 S/ L5 M: w& \# q - mv gcc gcc.4.8
. ?7 W& a/ `; q# X! W# S; K) @2 r - mv g++ g++.4.8
7 w/ \! x) G, _) C/ a - ln -s g++-4.4 g++" ?) S9 l) Q# E" ` }( 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.
* R( g, J8 {( W, B& x. }. g6 @ - 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
复制代码 按以上顺序,编译即成功.
. k: I' e7 V3 s- U9 g: z |
|