在ubuntu 14.04 編譯android 2.3.1 錯誤解決辦法

首先必須下降gcc版本: linux

sudo apt-get install gcc-4.4
sudo apt-get install g++-4.4
sudo rm -rf /usr/bin/gcc /usr/bin/g++
sudo ln -s /usr/bin/gcc-4.4 /usr/bin/gcc
sudo ln -s /usr/bin/g++-4.4 /usr/bin/g++

android

 

 

################ Fix 1 ##########################

Error:
git

frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base 'android::KeyedVector<android::String8, android::sp<AaptDir> >' are not found by unqualified lookup github

frameworks/base/include/utils/KeyedVector.h:193:31: note: use 'this->indexOfKey' instead web

make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/AaptAssets.o] Error 1

Fix:
vi frameworks/base/tools/aapt/Android.mk

Add '-fpermissive' to line 31:
LOCAL_CFLAGS += -Wno-format-y2k -fpermissive

################## Fix 2 ##########################

Error
dom

frameworks/base/include/utils/KeyedVector.h:193:31: error: 'indexOfKey' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] this

frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base 'android::KeyedVector<android::String8, android::wp<android::AssetManager::SharedZip> >' are not found by unqualified lookup spa


frameworks/base/include/utils/KeyedVector.h:193:31: note: use 'this->indexOfKey' instead
.net

make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/AssetManager.o] Error 1

Fix:
vi frameworks/base/libs/utils/Android.mk

Add '-fpermissive' to line 64:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive
code

 

問題三
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:132:26: note: declarations in dependent base 'fst::VectorFstBaseImpl<fst::CacheState<fst::GallicArc<fst::StdArc, (fst::StringType)0u> > >' are not found by unqualified lookup
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:132:26: note: use 'this->SetState' instead
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:136:61: error: 'SetState' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
SetState(cache_first_state_id_, cache_first_state_);

make: *** [out/host/linux-x86/obj/EXECUTABLES/grxmlcompile_intermediates/grxmlcompile.o] Error 1

解決辦法:
cd external/srec
wget "https://github.com/CyanogenMod/android_external_srec/commit/4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff"
patch -p1 < 4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff
rm -f 4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff
cd ../..

此方法是我找的別人對於4.0版本源碼問題的解決方法,我用在了2.3上,沒有出現問題

dalvik_system_Zygote.c:191:19: error: storage size of 'rlim' isn't known

解決辦法
添加頭文件#include <sys/resource.h>到如下文件
dalvik/vm/native/dalvik_system_Zygote.cpp 

 

<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]

解決辦法
gcc
g++版本過高了
sudo apt-get install gcc-4.4
sudo apt-get install g++-4.4
sudo rm -rf /usr/bin/gcc /usr/bin/g++
sudo ln -s /usr/bin/gcc-4.4 /usr/bin/gcc
sudo ln -s /usr/bin/g++-4.4 /usr/bin/g++

 

Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC

 contains: external/webkit/WebCore/bindings/scripts /etc/perl /usr/local/lib/per

l/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/p

erl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at external/webkit/Web

Core/dom/make_names.pl line 38.

BEGIN failed--compilation aborted at external/webkit/WebCore/dom/make_names.pl l

ine 38.

Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC

 contains: external/webkit/WebCore/bindings/scripts /etc/perl /usr/local/lib/per

l/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/p

erl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at external/webkit/Web

Core/dom/make_names.pl line 38.

BEGIN failed--compilation aborted at external/webkit/WebCore/dom/make_names.pl l

ine 38.

 

解決方法是安裝perlswitch庫:

[plain] view plaincopy

  1. sudo apt-get install libswitch-perl  
相關文章
相關標籤/搜索