更改Android編譯軟件版本(make/gcc/bision)

一.make版本

1.下載make的壓縮包html

ftp://ftp.gnu.org/gnu/make/java

2.解壓,安裝linux

cd make-x.x
./configuration
sh build.sh
sudo make install

3.查看版本信息ubuntu

make -v

二.gcc版本

1.使用命令安裝gcc,以gcc-4.7爲例,具體版本請自行決定oracle

sudo apt-get install gcc-4.7 g++-4.7 g++-4.7-multilib gcc-4.7-multilib

 2.若出現沒法定位軟件包,請添加源,並更新源app

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update

3.切換gcc版本,如從gcc4.7切換到gcc4.4jvm

update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.4 100
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7 50
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 100
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 50
update-alternatives --install /usr/bin/cpp cpp-bin /usr/bin/cpp-4.4 100
update-alternatives --install /usr/bin/cpp cpp-bin /usr/bin/cpp-4.7 50

  也能夠使用以下命令,根據需求去選擇ide

sudo update-alternatives --config gcc
sudo update-alternatives --config g++
sudo update-alternatives --config cpp

 4.查看版本信息ui

gcc -v
g++ -v

三.jdk版本

說明:Android4.x以前請使用jdk1.6,Android5.x請使用openjdk7this

1.安裝jdk,以jdk1.6.0_45爲例

  1.1 到官網選擇具體的jdk版本下載:

    http://www.oracle.com/technetwork/java/javase/archive-139210.html

  1.2 複製到/usr/lib/jvm下

sudo cp jdk-6u45-linux-x64.bin /usr/lib/jvm

  1.3 增長可執行權限

sudo chmod 777 jdk-6u45-linux-x64.bin

  1.4 解壓

sudo ./jdk-6u45-linux-x64.bin

  1.5 配置環境變量

sudo gedit /etc/environment

    在最後添加以下信息,保存退出

export PATH=/usr/lib/jvm/jdk1.6.0_45/bin:$PATH

    使用以下命令使環境變量生效

source /etc/environment

2.配置jdk,其中Android4.0不須要配置javap,而Android4.4以上版本須要配置

update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_45/bin/java" 1
update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_45/bin/javac" 1
update-alternatives --install "/usr/bin/javadoc" "javadoc" "/usr/lib/jvm/jdk1.6.0_45/bin/javadoc" 1
update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.6.0_45/jre/lib/amd64/libnpjp2.so" 1
update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.6.0_45/bin/javaws" 1
update-alternatives --install "/usr/bin/javap" "javap" "/usr/lib/jvm/jdk1.6.0_45/bin/javap" 1
update-alternatives --install "/usr/bin/jar" "jar" "/usr/lib/jvm/jdk1.6.0_45/bin/jar" 1

3.更新jdk配置

sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javadoc
sudo update-alternatives --config mozilla-javaplugin.so
sudo update-alternatives --config javaws
sudo update-alternatives --config javap
sudo update-alternatives --config jar

 4.查看版本信息

java -version
javac -version

四.bison版本

1.下載bison的壓縮包

http://ftp.gnu.org/gnu/bison/

2.解壓,安裝

cd bison-x.x
./configure
make
sudo make install

   Bison版本不對,可能會引起以下錯誤(如下錯誤基於Bison3.0.4與Bison3.0.2,Bison2.7.1不會報該錯誤

 1 In file included from plural.y:35:0:
 2 plural-exp.h:94:23: error: conflicting types for 'libintl_gettextparse'
 3  # define PLURAL_PARSE libintl_gettextparse
 4                        ^
 5 plural.y:40:25: note: in expansion of macro 'PLURAL_PARSE'
 6  # define __gettextparse PLURAL_PARSE
 7                          ^
 8 plural.c:187:5: note: in expansion of macro '__gettextparse'
 9  int __gettextparse (void);
10      ^
11 plural-exp.h:94:23: note: previous declaration of 'libintl_gettextparse' was here
12  # define PLURAL_PARSE libintl_gettextparse
13                        ^
14 plural-exp.h:106:12: note: in expansion of macro 'PLURAL_PARSE'
15  extern int PLURAL_PARSE (void *arg);
16             ^
17 plural-exp.h:94:23: error: conflicting types for 'libintl_gettextparse'
18  # define PLURAL_PARSE libintl_gettextparse
19                        ^
20 plural.y:40:25: note: in expansion of macro 'PLURAL_PARSE'
21  # define __gettextparse PLURAL_PARSE
22                          ^
23 plural.c:63:25: note: in expansion of macro '__gettextparse'
24  #define yyparse         __gettextparse
25                          ^
26 plural.c:1108:1: note: in expansion of macro 'yyparse'
27  yyparse (void)
28  ^
29 plural-exp.h:94:23: note: previous declaration of 'libintl_gettextparse' was here
30  # define PLURAL_PARSE libintl_gettextparse
31                        ^
32 plural-exp.h:106:12: note: in expansion of macro 'PLURAL_PARSE'
33  extern int PLURAL_PARSE (void *arg);
34             ^
35 plural.c: In function 'libintl_gettextparse':
36 plural.c:1277:7: error: too few arguments to function '__gettextlex'
37        yychar = yylex (&yylval);
38        ^
39 plural.c:64:25: note: declared here
40  #define yylex           __gettextlex
41                          ^
42 plural.y:57:12: note: in expansion of macro 'yylex'
43  static int yylex (YYSTYPE *lval, const char **pexp);
44             ^
45 plural.y:154:29: error: 'arg' undeclared (first use in this function)
46       ((struct parse_args *) arg)->res = $1;
47                              ^
48 plural.y:154:29: note: each undeclared identifier is reported only once for each function it appears in
49 Makefile:192: recipe for target 'plural.o' failed
50 make[3]: *** [plural.o] Error 1
相關文章
相關標籤/搜索