ubuntu14.04编译aosp4.0.1_r1 遇到的错误解决方法 - muyu01248/log GitHub Wiki

编译aosp4.0.1_r1

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] frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<android::String16, unsigned int>’ 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/EXECUTABLES/aapt_intermediates/CrunchCache.o] 错误 1 make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/Command.o] 错误 1

Fix:[http://blog.csdn.net/kangear/article/details/9565889] vi frameworks/base/tools/aapt/Android.mk

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

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] ssize_t i = indexOfKey(key); ^ frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<android::String8, android::wpandroid::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

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

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

external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:136:11: note: use ‘this->SetState’ instead make: *** [out/host/linux-x86/obj/EXECUTABLES/grxmlcompile_intermediates/grxmlcompile.o] Error 1

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

dalvik/vm/native/dalvik_system_Zygote.cpp:193:19: error: aggregate ‘setrlimitsFromArray(ArrayObject*)::rlimit rlim’ has incomplete type and cannot be defined struct rlimit rlim; ^ dalvik/vm/native/dalvik_system_Zygote.cpp:216:43: error: ‘setrlimit’ was not declared in this scope err = setrlimit(contents[0], &rlim); ^ make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libdvm_intermediates/native/dalvik_system_Zygote.o] 错误 1

Fix:[http://blog.csdn.net/deng0zhaotai/article/details/37034105] 添加头文件#include <sys/resource.h>到以下文件 dalvik/vm/native/dalvik_system_Zygote.cpp

Error: development/tools/emulator/opengl/host/tools/emugen/main.cpp:79:9: error: ‘optind’ was not declared in this scope development/tools/emulator/opengl/host/tools/emugen/main.cpp:92:45: error: ‘optind’ was not declared in this scope make: *** [out/host/linux-x86/obj/EXECUTABLES/emugen_intermediates/main.o] Error 1

Fix: vi development/tools/emulator/opengl/host/tools/emugen/main.cpp

Add '#include <getopt.h>' to list of includes: #include <getopt.h>

Error: development/tools/emulator/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp:345:65: required from here

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] frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<unsigned int, ShaderData*>’ 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/libOpenglCodecCommon_intermediates/GLSharedGroup.o] Error 1

Fix: vi development/tools/emulator/opengl/Android.mk

Add '-fpermissive' to line 25: EMUGL_COMMON_CFLAGS := -DWITH_GLES2 -fpermissive

<命令行>:0:0: 错误: “_FORTIFY_SOURCE”重定义 [-Werror] frameworks/base/tools/obbtool/Main.cpp:1:0: 附注: 这是先前定义的位置

make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] 错误 1

Fix: vi build/core/combo/HOST_linux-x86.mk line56 Add -U_FORTIFY_SOURCE HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0

external/llvm/lib/ExecutionEngine/JIT/Intercept.cpp:69:67: error: ‘lseek64’ was not declared in this scope sys::DynamicLibrary::AddSymbol("\x1lseek64", (void*)(intptr_t)lseek64); ^ make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMJIT_intermediates/Intercept.o] 错误 1

Fix:[https://groups.google.com/forum/#!topic/android-building/ESpIMWQbshY][http://blog.csdn.net/shj606/article/details/51019071] vi external/llvm/lib/ExecutionEngine/JIT/Intercept.cpp #define _LARGEFILE64_SOURCE #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <errno.h>

Error: /usr/bin/ld: note: 'XInitThreads' is defined in DSO /lib/libX11.so.6 so try adding it to the linker command line /lib/libX11.so.6: could not read symbols: Invalid operation collect2: error: ld returned 1 exit status make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_renderer_intermediates/emulator_renderer] Error 1

Fix:[http://blog.csdn.net/kangear/article/details/9565889] vi development/tools/emulator/opengl/host/renderer/Android.mk

Add new entry 'LOCAL_LDLIBS += -lX11' after line 6 as shown: LOCAL_SRC_FILES := main.cpp LOCAL_CFLAGS += -O0 -g LOCAL_LDLIBS += -lX11

#ifeq ($(HOST_OS),windows) #LOCAL_LDLIBS += -lws2_32

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/platform/ColorData.cpp] 错误 2 make: *** 正在等待未完成的任务.... 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

Fix:[http://blog.csdn.net/deng0zhaotai/article/details/37034105] 安装:libswitch-perl

Error: host C++: liboprofile_pp <= external/oprofile/libpp/arrange_profiles.cpp In file included from external/oprofile/libpp/arrange_profiles.cpp:24:0: external/oprofile/libpp/format_output.h:94:22: error: reference ‘counts’ cannot be declared ‘mutable’ [-fpermissive] make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_pp_intermediates/arrange_profiles.o] Error 1

Fix: vi external/oprofile/libpp/format_output.h

Remove 'mutable' from 'mutable counts_t & counts;' on line 94:

⚠️ **GitHub.com Fallback** ⚠️