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

前端之家收集整理的这篇文章主要介绍了在Ubuntu14.04上编译Android4.0.1出现的几个问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。


一. 工具

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

四.源的问题

  很多repo不能用这个一般都可以: curl "http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo" > ~/bin/repo
  另外。init的时候用这个: repo init -u git://git.omapzoom.org/platform/manifest -b android-4.0.1_r1
五 .同步后出现的问题
1. 出错以下出错信息:
[plain] view plain copy
  1. Importincludesfile:out/target/product/mx3/obj/STATIC_LIBRARIES/libwebcore_intermediates/import_includes
  2. targetGenerated:libwebcore<=external/webkit/Source/WebCore/css/tokenizer.flex
  3. <spanstyle="rgb(255,255,51);">Can'tlocateSwitch.pmin@INC(youmayneedtoinstalltheSwitchmodule)</span>(@INCcontains:/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.)atexternal/webkit/Source/WebCore/make-hash-tools.plline23.
  4. BEGINFailed--compilationabortedatexternal/webkit/Source/WebCore/make-hash-tools.plline23.
  5. Can'tlocateSwitch.pmin@INC(youmayneedtoinstalltheSwitchmodule)(@INCcontains:/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.)atexternal/webkit/Source/WebCore/make-hash-tools.plline23.
  6. BEGINFailed--compilationabortedatexternal/webkit/Source/WebCore/make-hash-tools.plline23.
  7. make:***[out/target/product/mx3/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/html/DocTypeStrings.cpp]Error2
  8. make:***Waitingforunfinishedjobs....
  9. make:***[out/target/product/mx3/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/platform/ColorData.cpp]Error2
  10. targetGenerated:libwebcore<=external/webkit/Source/WebCore/html/parser/HTMLEntityNames.in

解决方法是安装perl的switch库:
[plain] view plain copy
  1. sudoapt-getinstalllibswitch-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 注意最好是复制过去右边的容易写错


转载地址:https://www.cnblogs.com/kobe8/p/3998379.html

原文链接:/ubuntu/350159.html

猜你在找的Ubuntu相关文章