|
第一次玩Android,弄来一点资源,碰到一些编译问题,为此,将搭建ubuntu 14.04 LTS版本的编译环境,做个记录。
1 Y6 ]+ C1 D( I7 r# V+ Y
8 P0 T _+ O' B4 A( Z一、for MTK83820 z' t' t) V4 D: o* o
2 Z) U n- S- R1 j1、安装完OS,保持网络畅通,安装ia32老的库和相应的开发工具及库,- sudo -i4 {! ^% F: S l9 j
- cd /etc/apt/sources.list.d
* B; e a. Z9 U; u" e - echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-raring.list
9 m$ o$ j+ |3 ^$ ?+ {0 r" |$ r+ X - apt-get update
- _' H B* h) Q3 O2 V. T - apt-get install ia32-libs
" ~, k# [1 @0 R, ?' z
" p5 M$ t$ B( Q B) c6 U5 j- apt-get install dpkg-dev% @5 V% _0 D0 F1 n4 O! m1 B0 [ Q
7 @& G$ Z0 ]7 S8 n1 c: 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
/ f9 l% h5 J" m( d& S0 t
复制代码 2、安装JDK和SDK- d8 I' a) l- a% ]
# N0 k2 @+ X- \从Orace网站上找jdk-6u23-linux-x64.bin :http://www.oracle.com/technetwor ... javase6-419409.html- cp jdk-6u23-linux-x64.bin /opt/) N7 X( }7 s2 a; x7 J+ z5 d
- chmod a+x jdk-6u23-linux-x64.bin3 `4 V, ?2 i8 a: E
- ./jdk-6u23-linux-x64.bin
复制代码 google官网上下载adt-bundle-linux-x86_64-20140321.zip : https://dl.google.com/android/ad ... x86_64-20140321.zip
7 ?; b: r/ l4 V, v如果下不到,可能需要翻墙,或者在网上搜相应的文件,找到下载即可- unzip adt-bundle-linux-x86_64-20140321.zip1 t2 f+ C& b+ a3 Z' B
- cd adt-bundle-linux-x86_64-20140321) M+ w O4 a, e$ v
- sudo cp -r * /opt/
复制代码 3、改变shell环境变量增加如下内容- JAVA_HOME=/opt/jdk1.6.0_23
/ `7 d) b+ C5 s- b I - export JAVA_HOME
0 W% `' g4 ]5 I# B4 N7 z
9 R+ }' z: O, F# l- ANDROID_JAVA_HOME=/opt/jdk1.6.0_23
7 C& t- Y3 H6 n# I* W9 d5 D7 e# u0 G - export ANDROID_JAVA_HOME& o7 S6 _4 K# E! ^4 |6 Z: h
- export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
; _ w' L8 A: F" A
2 U* t! _. s! u* J- PATH=/opt/jdk1.6.0_23/bin:/opt/sdk/platform-tools:/opt/sdk/tools:$PATH& P7 R. f& O5 j9 G( M) S
- export PATH
复制代码 4、安装gcc 4.4,并使用此版本- sudo -s
5 X. n3 F. z8 g# J( U - apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib
# z3 w2 y$ t; H" t - cd /usr/bin/9 Y% o' e: V* L$ I
- mv gcc gcc.4.8
" M, M3 a$ h2 r$ } - mv g++ g++.4.8
( U1 l0 z9 A6 \3 U Y1 n$ X - ln -s g++-4.4 g+++ B9 ^) L: [3 ]% O* l" O- y
- 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" V/ r( C, [" k0 r( |2 k' k - 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
复制代码 按以上顺序,编译即成功.8 ~0 m! C6 |: B* f+ C p
|
|