然后出现错误:
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
>’ 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/AaptAssets.o]
错误 1
解决方法:
这个错误是因为gcc4.7版本太新,而Android老旧的代码有不符合现在的c++标准导致的。新的gcc对标准的检查更严格了,开启容错就可以了。以下多个错误情况类似。
sudo gedit
frameworks/base/tools/aapt/Android.mk
修改第31行为:
LOCAL_CFLAGS += -Wno-format-y2k
-fpermissive
再次编译,然后出错:
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
>’ 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
解决方法:
sudo gedit
frameworks/base/libs/utils/Android.mk
修改第64行为:
LOCAL_CFLAGS +=
-DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive
再次编译,接下来会报一大堆错误,其中最后一个错误是:
error: ‘SetState’ was not
declared in this scope, and no declarations were found by
argument-dependent lookup at the point of instantiation
[-fpermissive]
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:136:11:
note: declarations in dependent base ‘fst::VectorFstBaseImpl
> >’ are not found by unqualified
lookup
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:136:11:
note: use ‘this->SetState’ instead
host C: libSR_EventLog
<=
external/srec/srec/EventLog/src/EventLogImpl.c
host C: libSR_Core
<= external/srec/srec/ca/acc_basi.c
host C: libSR_Core
<= external/srec/srec/ca/cnfd_scr.c
host C: libSR_Core
<= external/srec/srec/ca/par_basi.c
host C: libSR_Core
<= external/srec/srec/ca/pat_basi.c
host C: libSR_Core
<= external/srec/srec/ca/rec_basi.c
host C: libSR_Core
<= external/srec/srec/ca/rec_load.c
host C: libSR_Core
<= external/srec/srec/ca/rec_nbes.c
host C: libSR_Core
<= external/srec/srec/ca/rec_resu.c
host C: libSR_Core
<= external/srec/srec/ca/syn_srec.c
host C: libSR_Core
<= external/srec/srec/ca/utt_basi.c
host C: libSR_Core
<= external/srec/srec/ca/utt_data.c
host C: libSR_Core
<= external/srec/srec/ca/utt_proc.c
host C: libSR_Core
<= external/srec/srec/ca/voc_basi.c
host C: libSR_Core
<=
external/srec/srec/ca/../cfront/ca_cms.c
host C: libSR_Core
<=
external/srec/srec/ca/../cfront/ca_front.c
make: ***
[out/host/linux-x86/obj/EXECUTABLES/grxmlcompile_intermediates/grxmlcompile.o]
错误 1
解决方法:
cd external/srec
patch -p1 <
4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff
rm -f
4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff
cd ../../
再次编译,接下来又是一堆错误,最后一个错误是:
error: ‘setrlimit’ was not
declared in this scope
make: ***
[out/host/linux-x86/obj/SHARED_LIBRARIES/libdvm_intermediates/native/dalvik_system_Zygote.o]
错误 1
解决方法:
sudo gedit
dalvik/vm/native/dalvik_system_Zygote.cpp
在第22行加一个#include
再次编译,出错:
fatal error: zconf.h:
没有那个文件或目录
compilation
terminated.
解决方法:
先暂时执行
sudo ln -s
/usr/include/x86_64-linux-gnu/zconf.h /usr/include
编译完成后再删除该软链接:
sudo rm
/usr/include/zconf.h
再次编译,然后又会出现一堆error,最后一个是:
error: ‘offsetof’ was not
declared in this scope
make: ***
[out/host/linux-x86/obj/STATIC_LIBRARIES/libMesa_intermediates/src/glsl/linker.o]
错误 1
解决方法:
sudo gedit
external/mesa3d/src/glsl/linker.cpp
在第70行增加#include
再次编译,出现如下错误:
error: reference ‘counts’
cannot be declared ‘mutable’ [-fpermissive]
make: ***
[out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_pp_intermediates/arrange_profiles.o]
错误 1
解决方法:
sudo gedit
external/oprofile/libpp/format_output.h
删去94行的mutable,把94行改成
counts_t &
counts;
再次编译,又出错了:
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’ are not
found by unqualified lookup
frameworks/base/include/utils/KeyedVector.h:193:31:
note: use ‘this->indexOfKey’ instead
host C++: libRS
<=
frameworks/base/libs/rs/rsObjectBase.cpp
host C++: libRS
<=
frameworks/base/libs/rs/rsMatrix2x2.cpp
make: ***
[out/host/linux-x86/obj/STATIC_LIBRARIES/libRS_intermediates/rsFont.o]
错误 1
解决方法:
sudo gedit frameworks/base/libs/rs/Android.mk
将183行改成:
LOCAL_CFLAGS += -Werror -Wall
-Wno-unused-parameter -Wno-unused-variable
-fpermissive
再次编译,发现错误:
error: ‘ValuesIn’ was not
declared in this scope, and no declarations were found by
argument-dependent lookup at the point of instantiation
[-fpermissive]
In file included from
external/gtest/src/../include/gtest/gtest.h:69:0,
from
external/gtest/src/../src/gtest.cc:34,
from
external/gtest/src/gtest-all.cc:36:
external/gtest/src/../include/gtest/gtest-param-test.h:287:58:
note: ‘template testing::internal::ParamGenerator
testing::ValuesIn(const Container&)’ declared here,
later in the translation unit
make: ***
[out/host/linux-x86/obj/STATIC_LIBRARIES/libgtest_host_intermediates/gtest-all.o]
错误 1
解决方法:
sudo gedit
external/gtest/src/Android.mk
把第52行改为:
LOCAL_CFLAGS += -O0
-fpermissive
第70行改为:
LOCAL_CFLAGS += -O0
-fpermissive
sudo gedit
external/gtest/include/gtest/internal/gtest-param-util.h
第40行增加#include
再次编译,然后出现了一大堆error,最后一个error是
error: comparison between ‘enum
llvm::PointerLikeTypeTraits::’ and ‘enum
llvm::PointerLikeTypeTraits::’ [-Werror=enum-compare]
external/llvm/include/llvm/ADT/PointerUnion.h:56:10:
error: enumeral mismatch in conditional expression:
‘llvm::PointerLikeTypeTraits::’ vs ‘llvm::PointerLikeTypeTraits::’
[-Werror=enum-compare]
cc1plus: all warnings being
treated as errors
make: ***
[out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/slang_rs_context.o]
错误 1
解决方法:
sudo gedit
frameworks/compile/slang/Android.mk
找到第22行,删去-Werror,
改为:local_cflags_for_slang :=
-Wno-sign-promo -Wall
-Wno-unused-parameter
再次编译,成功通过。
来之不易。