Android 源碼編譯及常見錯誤及解決方案

來源:互聯網
上載者:User

 最近要往arm開發板上移植android系統,大大小小的問題遇到了太多太多,都是淚啊。本人初接觸嵌入式開發,對問題的根源不是太瞭解,不過好在每解決一個問題,便記錄一下。話不多說,正式羅列問題:

 

 host Executable: a3dconvert (out/host/linux-x86/obj/EXECUTABLES/a3dconvert_intermediates/ /usr/bin/: skipping incompatible /usr/lib//x86_64-linux-gnu/./libstdc++.so when searching  -lstdc++ /usr/bin/: skipping incompatible /usr/lib//x86_64-linux-gnu/./libstdc++.a when searching  -lstdc++ /usr/bin/: cannot  -lstdc++ /usr/bin/: skipping incompatible /usr/lib//x86_64-linux-gnu/./libgcc_s.so when searching  - /usr/bin/: cannot  - /usr/bin/: skipping incompatible /usr/lib//x86_64-linux-gnu/./libgcc.a when searching  - /usr/bin/: cannot  - collect2:  returned  : *** [out/host/linux-x86/obj/EXECUTABLES/a3dconvert_intermediates/a3dconvert] Error 

 


缺少g++-multilib庫,安裝即可: apt-get install g++-multilib
$ sudo apt-get install g++-multilib g++-4.5-multilib


 g++ : *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] 錯誤 
解決方案:
sudo apt-get install g++-4.4-multilib


 rameworks/base/libs/utils/RefBase.: 在成員函數‘void android::RefBase::weakref_type::trackMe(,  frameworks/base/libs/utils/RefBase.::: 錯誤: 將‘const android::RefBase::weakref_impl’作為‘void android::RefBase::weakref_impl::trackMe(, )’的‘this’實參時丟棄了類型限定 [- : *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] 錯誤 
原因:


 /usr/bin/: cannot  - host Executable: aapt (out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/ /usr/bin/: cannot  - collect2:  returned  : *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] Error 
解決方案:
sudo apt-get install zlib1g-dev


 /bin/ Yacc: aidl <= frameworks/base/tools/aidl/ bison -d  -o out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y. frameworks/base/tools/aidl/ /bin/ : *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.] Error 
解決方案:
sudo apt-get install bison


 /bin/ out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.: In  ‘ out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.:: warning: deprecated conversion from  constant to ‘* out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.:: warning: deprecated conversion from  constant to ‘* Lex: aidl <= frameworks/base/tools/aidl/ /bin/ : *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.] Error 
解決方案: 
sudo apt-get install flex


 /usr/bin/: cannot  - host Executable: adb (out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/ /usr/bin/: cannot  - collect2:  returned  : *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] Error 
解決方案:
sudo apt-get install libncurses5-dev


 fatal error: GL/glx.h: No such  development/tools/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.:: fatal error: GL/glx.h: No such   : *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libGLcommon_intermediates/GLDispatch.o] Error 
解決方案:
sudo apt-get install libgl1-mesa-dev


  target Generated: libwebcore <= external/webkit/Source/JavaScriptCore/ Generating CSSPropertyNames.h <= CSSPropertyNames.  calling gperf failed:  at ./makeprop.pl line  : *** [out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/css/CSSPropertyNames.h] Error  : *** Deleting  `out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/css/CSSPropertyNames.h

 

解決方案:
sudo apt-get install gperf


 host C++: libutils <= frameworks/base/libs/utils/RefBase. frameworks/base/libs/utils/RefBase.: In member  ‘void android::RefBase::weakref_type::trackMe(,  frameworks/base/libs/utils/RefBase.::: error: passing ‘const android::RefBase::weakref_impl’ as ‘this’ argument of ‘void android::RefBase::weakref_impl::trackMe(, )’ discards qualifiers [- : *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] 錯誤 
解決方案:
gedit frameworks/base/libs/utils/Android.mk
將語句:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
修改為:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) –fpermissive


 out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): In  `thread_store_get /home/leno/works/android_dev/bin/system/core/libcutils/threads.c:: undefined reference to `pthread_getspecific out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): In  `thread_store_set /home/leno/works/android_dev/bin/system/core/libcutils/threads.c:: undefined reference to `pthread_key_create /home/leno/works/android_dev/bin/system/core/libcutils/threads.c:: undefined reference to `pthread_setspecific collect2:  returned  : *** [out/host/linux-x86/obj/EXECUTABLES/localize_intermediates/localize] 錯誤 
解決方案:
修改./framework/base/tools/localize/Android.mk檔案
ifeq ($(HOST_OS),linux)
#LOCAL_LDLIBS += -lrt       把這行注釋掉,改為下面一行。
LOCAL_LDLIBS += -lrt -lpthread
endif

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.