我正在编译一个使用autotools构建过程的大型库。有许多makefile,每个都会得到CFLAGS = .... -Werror。 当我尝试编译时,我的设置上会出现一些轻微的警告,这些警告会导致构建失败。 我想尝试在警告下进行构建,因此需要从所有makefile中删除-Werror。是否有方法防止autotools在所有这些makefile中放入-Werror?
我在 configure.ac 文件中进行了探索,找到了如下内容:
AC_ARG_ENABLE([werror],
AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
[gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
因此我运行了如下配置:
./configure --disable-werror
它像魔法一样起作用了。我的makefile中不再有-Werror
标志。谢谢你的评论,Till!
find . -name Makefile -exec sed -i s'/-Werror//g' {} \;
sed
替换为gsed
。保留HTML,不解释。对于基于Autotools的项目,您可能需要传递以下内容:
./autogen.sh --disable-Werror
注意 Werror
中的大写字母 W
。
configure.ac
文件 - 它可能包含类似于AM_INIT_AUTOMAKE([-Werror])
的内容。不要编辑Makefile文件,因为这些是由程序生成的。 - Till