您的位置:首页 > 移动开发 > Android开发

在Ubuntu14.04上编译Android4.0.1出现的几个问题

2015-04-17 09:34 519 查看

原文链接:http://www.cnblogs.com/kobe8/p/3998379.html

一. 工具

    
sudo 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-glx:i386 \


      libgl1-mesa-dev g++-multilib mingw32 tofrodos \


      python-markdown libxml2-utils xsltproc zlib1g-dev:i386


 

二.JDK 

     oracle 官网下载JDk6_29(bin文件,注意安装方法,环境变量,update-alternative等)   http://www.oracle.com/technetwork/java/javase/archive-139210.html
 

三.gcc/g++的版本

 默认的gcc g++版本为4.6.3, 
将其改为4.4.步骤:

 sudo apt-get install gcc-4.4

 sudo apt-get install g++-4.4

 cd /usr/bin

 ls -l gcc*

 sudo mv gcc gcc.bak

 sudo ln -s gcc-4.4 gcc

 ls -l g++*

 sudo mv g++ g++.bak

 sudo ln -s g++-4.4 g++

 gcc -v

 g++ -v

四.源的问题

 

Import includes file: out/target/product/mx3/obj/STATIC_LIBRARIES/libwebcore_intermediates/import_includes  
target Generated: libwebcore <= external/webkit/Source/WebCore/css/tokenizer.flex  
<span style="rgb(255, 255, 51);">Can't locate Switch.pm in @INC (you may need to install the Switch module)</span> (@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.  
BEGIN failed--compilation aborted at external/webkit/Source/WebCore/make-hash-tools.pl line 23.  
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.  
BEGIN failed--compilation aborted at external/webkit/Source/WebCore/make-hash-tools.pl line 23.  
make: *** [out/target/product/mx3/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/html/DocTypeStrings.cpp] Error 2  
make: *** Waiting for unfinished jobs....  
make: *** [out/target/product/mx3/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/platform/ColorData.cpp] Error 2  
target Generated: libwebcore <= external/webkit/Source/WebCore/html/parser/HTMLEntityNames.in  

解决方法是安装perl的switch库:

[plain]
view plaincopy





sudo apt-get install libswitch-perl 
 

 

2.dalvik/vm/native/dalvik_system_Zygote.cpp:216:43: error: ‘setrlimit’ was not declared
in this scope

err = setrlimit(contents[0], &rlim);

^

< command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]

dalvik/vm/native/java_lang_Float.cpp:1:0: note: this is the location of the previous definition

/*

^

make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libdvm_intermediates/native/dalvik_system_Zygote.o] Error 1

make: *** Waiting for unfinished jobs....

解决办法

添加头文件#include <sys/resource.h>到以下文件

dalvik/vm/native/dalvik_system_Zygote.cpp



 

3.host Executable: emulator_renderer (out/host/linux-x86/obj/EXECUTABLES/emulator_renderer_intermediates/emulator_renderer)

/usr/bin/ld: out/host/linux-x86/obj/EXECUTABLES/emulator_renderer_intermediates/main.o: undefined reference to symbol 'XInitThreads'

//usr/lib/i386-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line

collect2: ld returned 1 exit status

make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_renderer_intermediates/emulator_renderer] Error 1

make: *** Waiting for unfinished jobs....

解决办法:

修改development/tools/emulator/opengl/host/renderer/Android.mk文件

root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# ls

abi cts docs frameworks Makefile prebuilt

bionic dalvik download.sh hardware ndk sdk

bootable development download.sh~ hs_err_pid6190.log out system

build device external libcore packages v8.log

root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# gedit development/tools/emulator/opengl/host/renderer/Android.mk

添加一行:LOCAL_LDLIBS += -lX11 注意最好是复制过去,右边的容易写错



 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: