Ubuntu编译Android(安卓)KitKat 4.4出现Chromium gyp HashSet_jni.h报错的解决方法
16lz
2021-01-25
Ubuntu编译Android KitKat 4.4出现Chromium gyp HashSet_jni.h报错的解决方法
编译出错信息:
out/target/product/mx3/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:10:26: error: extra tokens at end of #ifndef directive [-Werror]out/target/product/mx3/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:11:26: error: missing whitespace after the macro name [-Werror]target thumb C++: content_content_common_gyp <= external/chromium_org/content/common/android/surface_texture_peer.ccIn file included from external/chromium_org/content/common/android/hash_set.cc:5:0:out/target/product/mx3/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:24:20: error: expected initializer before '<' tokenout/target/product/mx3/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:26:17: error: expected initializer before '<' tokenout/target/product/mx3/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:29:22: error: expected '{' before '<' tokenout/target/product/mx3/obj/GYP/shared_intermediates/content/jni/HashSet_jni.h:29:22: error: expected unqualified-id before '<' tokenexternal/chromium_org/content/common/android/hash_set.cc:30:1: error: expected '}' at end of inputcc1plus: all warnings being treated as errorsmake: *** [out/target/product/mx3/obj/STATIC_LIBRARIES/content_content_common_gyp_intermediates/content/common/android/hash_set.o] 错误 1make: *** 正在等待未完成的任务....
解决方法:
修改文件:external/chromium_org/base/android/jni_generator/jni_generator.py,diff如下
--- a/base/android/jni_generator/jni_generator.py+++ b/base/android/jni_generator/jni_generator.py@@ -555,18 +555,24 @@ class JNIFromJavaSource(object): contents) return JNIFromJavaSource(contents, fully_qualified_class) +def MultipleReplace(string, rep_dict):+ pattern = re.compile("|".join([re.escape(k) for k in rep_dict.keys()]), re.M)+ return pattern.sub(lambda x: rep_dict[x.group(0)], string) class InlHeaderFileGenerator(object): """Generates an inline header file for JNI integration.""" def __init__(self, namespace, fully_qualified_class, natives, called_by_natives):- self.namespace = namespace- self.fully_qualified_class = fully_qualified_class+# self.namespace = namespace+# self.fully_qualified_class = fully_qualified_class+ self.namespace = MultipleReplace(namespace, {'<E>':''})+ self.fully_qualified_class = MultipleReplace(fully_qualified_class, {'<E>':''}) self.class_name = self.fully_qualified_class.split('/')[-1] self.natives = natives self.called_by_natives = called_by_natives- self.header_guard = fully_qualified_class.replace('/', '_') + '_JNI'+# self.header_guard = fully_qualified_class.replace('/', '_') + '_JNI'+ self.header_guard = MultipleReplace(fully_qualified_class, {'/':'_', '<E>':''}) + '_JNI' def GetContent(self): """Returns the content of the JNI binding file."""
更多相关文章
- 一款常用的 Squid 日志分析工具
- GitHub 标星 8K+!一款开源替代 ls 的工具你值得拥有!
- RHEL 6 下 DHCP+TFTP+FTP+PXE+Kickstart 实现无人值守安装
- Linux 环境下实战 Rsync 备份工具及配置 rsync+inotify 实时同步
- Android(安卓)Gradle 插件(二)
- android之解析包时出现错误(二)
- React Native Android(安卓)开发巨坑
- android中使用SAX, DOM, 或者pull 来解析XML文档
- Android(安卓)Studio 出现 error: cannot find symbol variable