/**********************************************************************
* elfutils cc1: all warnings being treated as errors
* 说明:
* 在Ubuntu 18.04上编译Yocto,elfutils的Makefile中出现没有识别到一些配置,
* 需要在Makefile中去掉-Werror选项。
*
* 2018-6-14 深圳 宝安西乡 曾剑锋
*********************************************************************/ 一、参考文档:
. How to compile without warnings being treated as errors?
https://stackoverflow.com/questions/11561261/how-to-compile-without-warnings-being-treated-as-errors
. all warnings being treated as errors
https://wizardforcel.gitbooks.io/100-gcc-tips/content/warnings-treated-as-errors.html 二、报错现象:
. 现象:
x86_64-linux/usr/include -O2 -pipe -c -o dwfl_report_elf.o ../../elfutils-0.164/libdwfl/dwfl_report_elf.c
| ../../elfutils-0.164/libdwfl/dwfl_report_elf.c: In function '__libdwfl_elf_address_range':
| ../../elfutils-0.164/libdwfl/dwfl_report_elf.c::: error: this statement may fall through [-Werror=implicit-fallthrough=]
| add_p_vaddr = true;
| ^
| ../../elfutils-0.164/libdwfl/dwfl_report_elf.c::: note: here
| case ET_DYN:
| ^~~~
| cc1: all warnings being treated as errors
| Makefile:: recipe for target 'dwfl_report_elf.o' failed
. 现象:
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
| In file included from ../../elfutils-0.164/libdw/dwarf_next_cfi.c:::
| ../../elfutils-0.164/libdw/encoded-value.h: In function 'encoded_value_size':
| ../../elfutils-0.164/libdw/encoded-value.h::: error: this statement may fall through [-Werror=implicit-fallthrough=]
| if (p != NULL)
| ^
| ../../elfutils-0.164/libdw/encoded-value.h::: note: here
| default:
| ^~~~~~~
| cc1: all warnings being treated as errors
| Makefile:: recipe for target 'dwarf_next_cfi.o' failed
| make[]: *** [dwarf_next_cfi.o] Error
. 现象:
inux/usr/include -O2 -pipe -c -o i386_disasm.o ../../elfutils-0.164/libcpu/i386_disasm.c
| ../../elfutils-0.164/libcpu/i386_disasm.c: In function 'i386_disasm':
| ../../elfutils-0.164/libcpu/i386_disasm.c::: error: this statement may fall through [-Werror=implicit-fallthrough=]
| if (data[] == 0xc2)
| ^
| ../../elfutils-0.164/libcpu/i386_disasm.c::: note: here
| default:
| ^~~~~~~
| cc1: all warnings being treated as errors
| Makefile:: recipe for target 'i386_disasm.o' failed 三、解决方法:
. 原因: cc1: all warnings being treated as errors
. 修改对应的Makefile,去掉-Werror:
. 手动处理示例:
/home/zengjf/zengjf/fsl-release-bsp/imx6q-x11/tmp/work/x86_64-linux/elfutils-native/0.164-r0/build/libdwfl/Makefile
[...省略]
# Warn about stack usage of more than 256K = bytes.
STACK_USAGE_WARNING = -Wstack-usage=
AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat= \
-Wold-style-definition -Wstrict-prototypes \
$(if $($(*F)_no_Werror),,-Werror) \ # remove this line
$(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
$(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
$($(*F)_CFLAGS)
[...省略]
. 获取Makefile生成信息:
zengjf@zengjf:~/zengjf/fsl-release-bsp/imx6q-x11/tmp/work/x86_64-linux/elfutils-native/0.164-r0$ grep _no_Werror * -r
build/tests/Makefile: $(if $($(*F)_no_Werror),,-Werror) \
build/libdwfl/Makefile.bak: $(if $($(*F)_no_Werror),,-Werror) \
build/backends/Makefile: $(if $($(*F)_no_Werror),,-Werror) \
build/libdwelf/Makefile: $(if $($(*F)_no_Werror),,-Werror) \
build/lib/Makefile: $($(*F)_no_Werror),,-Werror) $(if \
build/libasm/Makefile: $(if $($(*F)_no_Werror),,-Werror) \
build/libelf/Makefile: $($(*F)_no_Werror),,-Werror) $(if \
build/libebl/Makefile: $($(*F)_no_Werror),,-Werror) $(if \
build/src/Makefile: $(if $($(*F)_no_Werror),,-Werror) \
build/src/Makefile:ldlex_no_Werror = yes
build/libcpu/Makefile:i386_lex_no_Werror = yes
elfutils-0.164/tests/Makefile.in: $(if $($(*F)_no_Werror),,-Werror) \
elfutils-0.164/libdwfl/Makefile.in: $(if $($(*F)_no_Werror),,-Werror) \
elfutils-0.164/backends/Makefile.in: $(if $($(*F)_no_Werror),,-Werror) \
elfutils-0.164/config/eu.am: $(if $($(*F)_no_Werror),,-Werror) \
elfutils-0.164/libdwelf/Makefile.in: $(if $($(*F)_no_Werror),,-Werror) \
elfutils-0.164/libdw/Makefile.in: $($(*F)_no_Werror),,-Werror) $(if \
elfutils-0.164/lib/Makefile.in: $($(*F)_no_Werror),,-Werror) $(if \
elfutils-0.164/libasm/Makefile.in: $(if $($(*F)_no_Werror),,-Werror) \
elfutils-0.164/libelf/Makefile.in: $($(*F)_no_Werror),,-Werror) $(if \
elfutils-0.164/libebl/Makefile.in: $($(*F)_no_Werror),,-Werror) $(if \
elfutils-0.164/src/Makefile.in: $(if $($(*F)_no_Werror),,-Werror) \
elfutils-0.164/src/Makefile.in:ldlex_no_Werror = yes
elfutils-0.164/src/Makefile.am:ldlex_no_Werror = yes
elfutils-0.164/libcpu/Makefile.in: $($(*F)_no_Werror),,-Werror) $(if \
elfutils-0.164/libcpu/Makefile.in:i386_lex_no_Werror = yes
elfutils-0.164/libcpu/Makefile.am:i386_lex_no_Werror = yes
elfutils-0.164/.pc/dso-link-change.patch/src/Makefile.am:ldlex_no_Werror = yes
elfutils-0.164/.pc/uclibc-support.patch/libcpu/Makefile.am:i386_lex_no_Werror = yes
zengjf@zengjf:~/zengjf/fsl-release-bsp/imx6q-x11/tmp/work/x86_64-linux/elfutils-native/0.164-r0$
. 一个一个文件修改比较麻烦,依据第4点,修改对应的yes为no就可以比较快捷的一次性全部解决问题,然而实际情况是没有识别到ldlex和i386_lex,乖乖的手动删除或者制作Shell脚本处理;
. 自动化shell命令:
. grep _no_Werror\) * -r | cut -d":" -f1 | xargs sed -i "s/[$](if [$]([$]([*F]*)_no_Werror),,-Werror)//"
. 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. Oracle X$Tables

    前言 最早从Yong Huang那里看到关于比较详细的X$表的介绍,后来陆续从其他Oracle专家那里得到了不少信息.在Steve Adams 的书中对X$表多有提及,而且他的站点也是个资源比较丰富的 ...

  2. 一个典型的多表参与连接的复杂SQL调优(SQL TUNING)引发的思考

    今天在看崔华老师所著SQL优化一书时,看到他解决SQL性能问题的一个案例,崔华老师成功定位问题并进行了解决.这里,在崔华老师分析定位的基础上,做进一步分析和推理,以便大家一起研究探讨,下面简述该案例场 ...

  3. html 巧用data-for藏自定义属性

    <div class="form-ele"> <label for="week" class="label col-1"& ...

  4. Cppcheck - A tool for static C/C++ code analysis

    cppcheck是一个个检测源码的工具,对编译工具的一个补充,mark Cppcheck - A tool for static C/C++ code analysis Syntax: cppchec ...

  5. [转]java异常中Exception捕获不到的异常

    一 概念 众所周知java提供了丰富的异常类,这些异常类之间有严格的集成关系,分类为 父类Throwable Throwable的两个子类Error和Exception Exception的两个子类C ...

  6. QAbstractItemView区分单双击

    系统不可能知道你这一次单击鼠标是为了双击指令,所以在你第一次按下鼠标时,系统会发出一个WM_XBUTTONDOWN(也就是clicked), 当你第二次单击鼠标时,系统先发送WM_XBUTTONDOW ...

  7. CAD绘制室外台阶步骤5.4

    1.在CAD的平面上用PL命令绘制台阶,如图: 绘制好了之后.进入三维模型,“工具""移位”选择台阶,回车,"Z"回车,输入数值“-450”如图 2.输入命令“ ...

  8. frameset的固定放置模式,不能放入<form runat="server">中

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="admin_default.as ...

  9. Vue + Element UI 实现权限管理系统 (管理应用状态)

    使用 Vuex 管理应用状态 1. 引入背景 像先前我们是有导航菜单栏收缩和展开功能的,但是因为组件封装的原因,隐藏按钮在头部组件,而导航菜单在导航菜单组件,这样就涉及到了组件收缩状态的共享问题.收缩 ...

  10. U启动安装原版Win7系统教程

    1.制作u启动u盘启动盘2.下载原版win7系统镜像并存入u盘启动盘3.硬盘模式更改为ahci模式 第一步: 将准备好的u启动u盘启动盘插在电脑usb接口上,然后重启电脑,在出现开机画面时通过u盘启动 ...