4

I am compiling a large library which uses the autotools build process. There are many makefiles. Each of them are getting CFLAGS = .... -Werror.

When I attempt to compile there are some minor warnings which kill the build on my setup.

I would like to try building despite the warnings so I need to take the -Werror out of all the makefiles. Is there a way to prevent autotools from putting in -Werror in all these makefiles?

Alex
  • 1,602
  • 20
  • 33
Kelly Stevens
  • 319
  • 2
  • 13
  • 1
    Check `configure.ac` - it might contain something like `AM_INIT_AUTOMAKE([-Werror])`. Do not edit the Makefile/s as those are generated. – Till May 03 '16 at 16:08

3 Answers3

3

I poked around in configure.ac and found this:

AC_ARG_ENABLE([werror],
  AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
  [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])

So I ran configure like this:

./configure --disable-werror

It worked like a charm. No more -Werror flags in my makefile. Thanks for your comment Till!

Alex
  • 1,602
  • 20
  • 33
Kelly Stevens
  • 319
  • 2
  • 13
  • 1
    Note for anyone who ended up here that this is highly project dependent. Some projects use "--disable-werror" others use "--disable-Werror" and some projects may not offer a flag to modify builds in this manner. Take a look through the project's 'configure.ac' file and './configure --help' output to see if such flags are offered. – Kris Bahnsen May 05 '22 at 21:13
1

My sed way, after Makefile created

find . -name Makefile -exec sed -i s'/-Werror//g' {} \;

In Mac replace sed with gsed

Ken
  • 1,141
  • 12
  • 12
0

For autotools based project you may need to pass:

./autogen.sh --disable-Werror

Observe the upper-case W in Werror.

lanoxx
  • 12,249
  • 13
  • 87
  • 142
  • 1
    Note for anyone who ended up here that this is highly project dependent. Some projects use "--disable-werror" others use "--disable-Werror" and some projects may not offer a flag to modify builds in this manner. Take a look through the project's 'configure.ac' file and './configure --help' output to see if such flags are offered. – Kris Bahnsen May 05 '22 at 21:13