1. /**********************************************************************
  2. * elfutils cc1: all warnings being treated as errors
  3. * 说明:
  4. * 在Ubuntu 18.04上编译Yocto,elfutils的Makefile中出现没有识别到一些配置,
  5. * 需要在Makefile中去掉-Werror选项。
  6. *
  7. * 2018-6-14 深圳 宝安西乡 曾剑锋
  8. *********************************************************************/
  9.  
  10. 一、参考文档:
  11. . How to compile without warnings being treated as errors?
  12. https://stackoverflow.com/questions/11561261/how-to-compile-without-warnings-being-treated-as-errors
  13. . all warnings being treated as errors
  14. https://wizardforcel.gitbooks.io/100-gcc-tips/content/warnings-treated-as-errors.html
  15.  
  16. 二、报错现象:
  17. . 现象:
  18. x86_64-linux/usr/include -O2 -pipe -c -o dwfl_report_elf.o ../../elfutils-0.164/libdwfl/dwfl_report_elf.c
  19. | ../../elfutils-0.164/libdwfl/dwfl_report_elf.c: In function '__libdwfl_elf_address_range':
  20. | ../../elfutils-0.164/libdwfl/dwfl_report_elf.c::: error: this statement may fall through [-Werror=implicit-fallthrough=]
  21. | add_p_vaddr = true;
  22. | ^
  23. | ../../elfutils-0.164/libdwfl/dwfl_report_elf.c::: note: here
  24. | case ET_DYN:
  25. | ^~~~
  26. | cc1: all warnings being treated as errors
  27. | Makefile:: recipe for target 'dwfl_report_elf.o' failed
  28. . 现象:
  29. imx6q-x11/tmp/sysroots/x86_64-linux/usr/include -O2 -pipe -c -o dwarf_next_cfi.o ../../elfutils-0.164/libdw/dwarf_next_cfi.c
  30. | In file included from ../../elfutils-0.164/libdw/dwarf_next_cfi.c:::
  31. | ../../elfutils-0.164/libdw/encoded-value.h: In function 'encoded_value_size':
  32. | ../../elfutils-0.164/libdw/encoded-value.h::: error: this statement may fall through [-Werror=implicit-fallthrough=]
  33. | if (p != NULL)
  34. | ^
  35. | ../../elfutils-0.164/libdw/encoded-value.h::: note: here
  36. | default:
  37. | ^~~~~~~
  38. | cc1: all warnings being treated as errors
  39. | Makefile:: recipe for target 'dwarf_next_cfi.o' failed
  40. | make[]: *** [dwarf_next_cfi.o] Error
  41. . 现象:
  42. inux/usr/include -O2 -pipe -c -o i386_disasm.o ../../elfutils-0.164/libcpu/i386_disasm.c
  43. | ../../elfutils-0.164/libcpu/i386_disasm.c: In function 'i386_disasm':
  44. | ../../elfutils-0.164/libcpu/i386_disasm.c::: error: this statement may fall through [-Werror=implicit-fallthrough=]
  45. | if (data[] == 0xc2)
  46. | ^
  47. | ../../elfutils-0.164/libcpu/i386_disasm.c::: note: here
  48. | default:
  49. | ^~~~~~~
  50. | cc1: all warnings being treated as errors
  51. | Makefile:: recipe for target 'i386_disasm.o' failed
  52.  
  53. 三、解决方法:
  54. . 原因: cc1: all warnings being treated as errors
  55. . 修改对应的Makefile,去掉-Werror
  56. . 手动处理示例:
  57. /home/zengjf/zengjf/fsl-release-bsp/imx6q-x11/tmp/work/x86_64-linux/elfutils-native/0.164-r0/build/libdwfl/Makefile
  58. [...省略]
  59. # Warn about stack usage of more than 256K = bytes.
  60. STACK_USAGE_WARNING = -Wstack-usage=
  61. AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat= \
  62. -Wold-style-definition -Wstrict-prototypes \
  63. $(if $($(*F)_no_Werror),,-Werror) \ # remove this line
  64. $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
  65. $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
  66. $($(*F)_CFLAGS)
  67. [...省略]
  68. . 获取Makefile生成信息:
  69. zengjf@zengjf:~/zengjf/fsl-release-bsp/imx6q-x11/tmp/work/x86_64-linux/elfutils-native/0.164-r0$ grep _no_Werror * -r
  70. build/tests/Makefile: $(if $($(*F)_no_Werror),,-Werror) \
  71. build/libdwfl/Makefile.bak: $(if $($(*F)_no_Werror),,-Werror) \
  72. build/backends/Makefile: $(if $($(*F)_no_Werror),,-Werror) \
  73. build/libdwelf/Makefile: $(if $($(*F)_no_Werror),,-Werror) \
  74. build/lib/Makefile: $($(*F)_no_Werror),,-Werror) $(if \
  75. build/libasm/Makefile: $(if $($(*F)_no_Werror),,-Werror) \
  76. build/libelf/Makefile: $($(*F)_no_Werror),,-Werror) $(if \
  77. build/libebl/Makefile: $($(*F)_no_Werror),,-Werror) $(if \
  78. build/src/Makefile: $(if $($(*F)_no_Werror),,-Werror) \
  79. build/src/Makefile:ldlex_no_Werror = yes
  80. build/libcpu/Makefile:i386_lex_no_Werror = yes
  81. elfutils-0.164/tests/Makefile.in: $(if $($(*F)_no_Werror),,-Werror) \
  82. elfutils-0.164/libdwfl/Makefile.in: $(if $($(*F)_no_Werror),,-Werror) \
  83. elfutils-0.164/backends/Makefile.in: $(if $($(*F)_no_Werror),,-Werror) \
  84. elfutils-0.164/config/eu.am: $(if $($(*F)_no_Werror),,-Werror) \
  85. elfutils-0.164/libdwelf/Makefile.in: $(if $($(*F)_no_Werror),,-Werror) \
  86. elfutils-0.164/libdw/Makefile.in: $($(*F)_no_Werror),,-Werror) $(if \
  87. elfutils-0.164/lib/Makefile.in: $($(*F)_no_Werror),,-Werror) $(if \
  88. elfutils-0.164/libasm/Makefile.in: $(if $($(*F)_no_Werror),,-Werror) \
  89. elfutils-0.164/libelf/Makefile.in: $($(*F)_no_Werror),,-Werror) $(if \
  90. elfutils-0.164/libebl/Makefile.in: $($(*F)_no_Werror),,-Werror) $(if \
  91. elfutils-0.164/src/Makefile.in: $(if $($(*F)_no_Werror),,-Werror) \
  92. elfutils-0.164/src/Makefile.in:ldlex_no_Werror = yes
  93. elfutils-0.164/src/Makefile.am:ldlex_no_Werror = yes
  94. elfutils-0.164/libcpu/Makefile.in: $($(*F)_no_Werror),,-Werror) $(if \
  95. elfutils-0.164/libcpu/Makefile.in:i386_lex_no_Werror = yes
  96. elfutils-0.164/libcpu/Makefile.am:i386_lex_no_Werror = yes
  97. elfutils-0.164/.pc/dso-link-change.patch/src/Makefile.am:ldlex_no_Werror = yes
  98. elfutils-0.164/.pc/uclibc-support.patch/libcpu/Makefile.am:i386_lex_no_Werror = yes
  99. zengjf@zengjf:~/zengjf/fsl-release-bsp/imx6q-x11/tmp/work/x86_64-linux/elfutils-native/0.164-r0$
  100. . 一个一个文件修改比较麻烦,依据第4点,修改对应的yesno就可以比较快捷的一次性全部解决问题,然而实际情况是没有识别到ldlexi386_lex,乖乖的手动删除或者制作Shell脚本处理;
  101. . 自动化shell命令:
  102. . grep _no_Werror\) * -r | cut -d":" -f1 | xargs sed -i "s/[$](if [$]([$]([*F]*)_no_Werror),,-Werror)//"
  103. . grep _no_Werror\) * -r | cut -d":" -f1 | xargs sed -i "s/[$]([$]([*F]*)_no_Werror),,-Werror) [$](if//"

elfutils cc1: all warnings being treated as errors的更多相关文章

  1. gcc cc1: all warnings being treated as errors

    cc1: all warnings being treated as errors 在Makefile中找到 -Werror项,删除即可.删除后重新编译. 或设置环境变量 c工程设置 export C ...

  2. GCC警告提示错误“cc1:all warnings being treated as errors”

    http://blog.csdn.net/zhangjs0322/article/details/25131787

  3. cc1: warnings being treated as errors解决办法

    安装GDB时出现cc1: warnings being treated as errors Edit the Makefile and delete this line:WERROR_CFLAGS = ...

  4. 编译openwrt时报错:fstools-2018-01-02-11efbf3b/libfstools/overlay.c: At top level: cc1: error: unrecognized command line option '-Wno-format-truncation' [-Werror]

    1. 详细错误信息 [ 11%] Building C object CMakeFiles/fstools.dir/libfstools/overlay.c.o/home/jello/openwrt/ ...

  5. ubuntu14.0 (arm平台)源码安装 VLC播放器

    环境 ubuntu14.0  arm开发板 源 deb http://mirrors.ustc.edu.cn/ubuntu-ports/ trusty main multiverse restrict ...

  6. Android编译环境折腾记

    题记:感觉是时候写点什么了=_=! 第一次安装了ubuntu14.04.5,官网下载的iso,官网下的jar,编译android4.x需要安装jdk6,更高的版本会有问题,baidu到很多搭建环境的步 ...

  7. Linux centOS下搭建RTMP服务器的具体步骤

    以下的所需的安装包,可直接在linux系统终端下载,也可从其他地方下载之后拷到对应目录下解压使用,遇到连接不到国外网站时可改变压缩包地址 1.安装依赖包: #yum install glibc.i68 ...

  8. ubuntu下编译VLC

    ubuntu下编译VLC 标签(空格分隔): ubuntu vlc 视频 编译 [TOC] 1.下载VLC源码包并解压 VLC的源码包在VLC的官网有,可以直接下载.也可以使用git来clone一个. ...

  9. SystemTap知识(二)

    Unbuntu安装systemtap: http://www.cnblogs.com/hdflzh/archive/2012/07/25/2608910.html 1 更新源到http://mirro ...

随机推荐

  1. redisObject

    typedef struct redisObject {    unsigned type:4;    unsigned encoding:4;    unsigned lru:REDIS_LRU_B ...

  2. PyCharm+Miniconda3安装配置教程

    PyCharm是Python著名的Python集成开发环境(IDE) conda有Miniconda和Anaconda,前者应该是类似最小化版本,后者可能是功能更为强大的版本,我们这里安装Minico ...

  3. telnet限制用户连接数(CentOS)

    一.配置方法 编缉/etc/xinetd.d/telnet在大括号内追加: cps = instances = per_source = 保存然后使用service xinetd restart重启x ...

  4. Qt 之 去除窗口部件被选中后的焦点虚线框

    转自: https://blog.csdn.net/goforwardtostep/article/details/53420529 https://blog.csdn.net/caoshangpa/ ...

  5. startActivityForResult的用法,以及intent传递图片

    开启startActivityForResult. Intent intent = new Intent(); intent.setClass(MainActivity.this, MipcaActi ...

  6. py requests.get

    import osimport requestsimport jsonfrom Util import Propertiesprint('########[公务员自助列表]############## ...

  7. SpringBoot添加webapp目录

    一.文章简述 使用IDEA工具创建的SpringBoot项目本身是没有webapp目录的.如果我们想要添加webapp目录的话,可以手动添加. 二.操作步骤 1)点击IDEA右上角的Project S ...

  8. linux下详解shell中>/dev/null 2>&1

    前言 相信大家经常能在shell脚本中发现>/dev/null 2>&1这样的语句.以前的我并没有去深入地理解这段命令的作用,照搬照用,直到上周我将这段命令不小心写成了2>& ...

  9. OOP⑹

    1.抽象类 所有由abstract关键字修饰的方法我们称之为 抽象方法! 抽象方法只能存在于 抽象类中! 所有由abstract关键字修饰的类我们称之为 抽象类! 抽象类的特点: 01.由abstra ...

  10. hustoj 管理员和后台设置

    之前用过hustoj 的livecd版本,觉得有一些小问题,所以从头到尾搭建.主要包含的过程包括: 安装ubuntu系统 搭建hustoj 管理员和后台资源建设 本文介绍如何在搭建好hustoj的基础 ...