![如何阻止警告在 JHBuild 中被视为错误](https://linux22.com/image/42737/%E5%A6%82%E4%BD%95%E9%98%BB%E6%AD%A2%E8%AD%A6%E5%91%8A%E5%9C%A8%20JHBuild%20%E4%B8%AD%E8%A2%AB%E8%A7%86%E4%B8%BA%E9%94%99%E8%AF%AF.png)
我尝试mutter
使用 JHBuild 构建模块,但失败了:
<snip>
make[4]: Entering directory `/home/wena/src/mutter/src'
CC screen.lo
core/screen.c: In function 'reload_monitor_infos':
core/screen.c:445:16: error: variable 'display' set but not used [-Werror=unused-but-set-variable]
core/screen.c: At top level:
core/screen.c:394:1: error: 'find_monitor_with_rect' defined but not used [-Werror=unused-function]
core/screen.c:418:1: error: 'find_main_output_for_crtc' defined but not used [-Werror=unused-function]
cc1: all warnings being treated as errors
make[4]: *** [screen.lo] Error 1
make[4]: Leaving directory `/home/wena/src/mutter/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/wena/src/mutter/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/wena/src/mutter/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/wena/src/mutter'
make: *** [all] Error 2
*** Error during phase build of mutter: ########## Error running make *** [1/1]
答案1
使用问题中的示例,将以下内容放入“~.jhbuildrc“ 文件 (参考):
module_autogenargs = {"mutter": "--disable-Werror"}
答案2
您应该--enable-compile-warnings=yes
在配置构建时使用该开关。这将阻止-Werror
在编译期间设置编译器标志。
答案3
好吧,如果--disable-Werror
不起作用,您可以添加 -i 选项(for make
)来忽略所有错误,因为看起来我正在构建的程序的开发人员-Werror
在其代码中的某处物理硬编码了该选项。