編譯Android原始碼過程中出現的錯誤
阿新 • • 發佈:2019-02-11
錯誤1:
解決方法是安裝perl的switch庫: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. 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/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/html/DocTypeStrings.cpp] 錯誤 2 make: *** 正在等待未完成的任務.... make: *** [out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/platform/ColorData.cpp] 錯誤 2 target Generated: libwebcore <= external/webkit/Source/WebCore/html/parser/HTMLEntityNames.in
sudo apt-get install libswitch-perl
錯誤2:
解決: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 frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/AssetManager.o] 錯誤 1
在frameworks/base/libs/utils/Android.mk的第64行末尾新增'-fpermissive',中間用空格隔開,即:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive
錯誤3:
解決:external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:136:61: 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:136:61: note: use ‘this->SetState’ instead make: *** [out/host/linux-x86/obj/EXECUTABLES/grxmlcompile_intermediates/grxmlcompile.o] 錯誤 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:
dalvik/vm/native/dalvik_system_Zygote.cpp:216:43: error: ‘setrlimit’ was not declared in this scope
err = setrlimit(contents[0], &rlim);
解決:
<p>在dalvik/vm/native/dalvik_system_Zygote.cpp中間增加一個頭檔案定義#include <sys/resource.h></p><p>#include "Dalvik.h"
#include "native/InternalNativePriv.h"
#include <sys/resource.h></p>
錯誤5:
make: *** [out/host/linux-x86/obj/EXECUTABLES/emugen_intermediates/main.o] 錯誤 1
解決:
需要在 development/tools/emulator/opengl/host/tools/emugen/main.cpp
在宣告中增加一條標頭檔案宣告
#include <getopt.h>
錯誤6:
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libOpenglCodecCommon_intermediates/GLSharedGroup.o] Error 1
解決:
在development/tools/emulator/opengl/Android.mk的第25行新增'-fpermissive'
<pre name="code" class="plain">EMUGL_COMMON_CFLAGS := -DWITH_GLES2 -fpermissive