问题遇到的现象和发生背景
我正在学习罗升阳的《Android系统源代码情景分析》,里面用的例子是在Android2.3中的,因此我按照书中步骤安装了Android2.3.1_r1,用的系统是 Ubuntu20.04。执行 make 编译时,出现报错:frameworks/base/include/utils/TypeHelpers.h:242:8: error: too many template-parameter-lists
问题相关代码,请勿粘贴截图
frameworks/base/include/utils/TypeHelpers.h 中代码如下:
template<>
template <typename K, typename V>
struct trait_trivial_ctor< key_value_pair_t<K, V> >
{ enum { value = aggregate_traits<K,V>::has_trivial_ctor }; };
template<>
template <typename K, typename V>
struct trait_trivial_dtor< key_value_pair_t<K, V> >
{ enum { value = aggregate_traits<K,V>::has_trivial_dtor }; };
template<>
template <typename K, typename V>
struct trait_trivial_copy< key_value_pair_t<K, V> >
{ enum { value = aggregate_traits<K,V>::has_trivial_copy }; };
template<>
template <typename K, typename V>
struct trait_trivial_move< key_value_pair_t<K, V> >
{ enum { value = aggregate_traits<K,V>::has_trivial_move }; };
运行结果及报错内容
下面是编译时的具体报错代码:
host C++: aapt <= frameworks/base/tools/aapt/AaptAssets.cpp
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<built-in>: note: this is the location of the previous definition
In file included from frameworks/base/include/utils/Vector.h:26,
from frameworks/base/include/utils/AssetDir.h:24,
from frameworks/base/include/utils/AssetManager.h:24,
from frameworks/base/tools/aapt/AaptAssets.h:10,
from frameworks/base/tools/aapt/AaptAssets.cpp:5:
frameworks/base/include/utils/TypeHelpers.h:242:8: error: too many template-parameter-lists
242 | struct trait_trivial_ctor< key_value_pair_t<K, V> >
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
frameworks/base/include/utils/TypeHelpers.h:246:8: error: too many template-parameter-lists
246 | struct trait_trivial_dtor< key_value_pair_t<K, V> >
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
frameworks/base/include/utils/TypeHelpers.h:250:8: error: too many template-parameter-lists
250 | struct trait_trivial_copy< key_value_pair_t<K, V> >
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
frameworks/base/include/utils/TypeHelpers.h:254:8: error: too many template-parameter-lists
254 | struct trait_trivial_move< key_value_pair_t<K, V> >
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
我想要达到的结果
请教大家这个问题该如何分析和解决?谢谢!