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."""


更多相关文章

  1. 一款常用的 Squid 日志分析工具
  2. GitHub 标星 8K+!一款开源替代 ls 的工具你值得拥有!
  3. RHEL 6 下 DHCP+TFTP+FTP+PXE+Kickstart 实现无人值守安装
  4. Linux 环境下实战 Rsync 备份工具及配置 rsync+inotify 实时同步
  5. Android(安卓)Gradle 插件(二)
  6. android之解析包时出现错误(二)
  7. React Native Android(安卓)开发巨坑
  8. android中使用SAX, DOM, 或者pull 来解析XML文档
  9. Android(安卓)Studio 出现 error: cannot find symbol variable

随机推荐

  1. 记一次python爬虫实战,豆瓣电影Top250爬虫
  2. 如何创建一个查询来过滤一列等于另一列同
  3. Python - 去除字符串首尾填充
  4. python 实践 心理测验(by Kim)
  5. Anaconda 添加国内镜像下载OpenCV
  6. 如何有效地扩展/展平pandas数据帧
  7. Python 学习笔记【list的操作方法】
  8. 大神程序员对python的理解与运用
  9. Python多个装饰器的顺序
  10. 如何在/account / url模式之外使用Django