在Ubuntu14.04上編譯Android4.0.1出現的幾個問題

來源:互聯網
上載者:User

標籤:des   android   style   blog   http   color   io   os   ar   

一. 工具

     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  之後 repo sync出現“fatal: ‘../platform/abi/cpp.git‘ does not appear to be a git repository”的解決方案,則開啟.repo目錄下的manifest.xml檔案(命令vim manifest.xml)並找到fetch屬性,在我的檔案中顯示fetch="..",將fetch修改為 fetch="git://git.omapzoom.org"  五 .同步後出現的問題 1. 出錯以下出錯資訊: [plain] view plaincopy
  1. Import includes file: out/target/product/mx3/obj/STATIC_LIBRARIES/libwebcore_intermediates/import_includes  
  2. target Generated: libwebcore <= external/webkit/Source/WebCore/css/tokenizer.flex  
  3. <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.  
  4. BEGIN failed--compilation aborted at external/webkit/Source/WebCore/make-hash-tools.pl line 23.  
  5. 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.  
  6. BEGIN failed--compilation aborted at external/webkit/Source/WebCore/make-hash-tools.pl line 23.  
  7. make: *** [out/target/product/mx3/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/html/DocTypeStrings.cpp] Error 2  
  8. make: *** Waiting for unfinished jobs....  
  9. make: *** [out/target/product/mx3/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/platform/ColorData.cpp] Error 2  
  10. target Generated: libwebcore <= external/webkit/Source/WebCore/html/parser/HTMLEntityNames.in  

解決方案是安裝perl的switch庫: [plain] view plaincopy
  1. 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檔案
[email protected]:/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
[email protected]:/home/dzt/android/WORKING_DIRECTORY# gedit development/tools/emulator/opengl/host/renderer/Android.mk

添加一行:LOCAL_LDLIBS += -lX11 注意最好是複製過去,右邊的容易寫錯

 

在Ubuntu14.04上編譯Android4.0.1出現的幾個問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.