17

While making a project with Makefile, I get this error:

error: implicit declaration of function ‘fatal’ [-Werror=implicit-function-declaration]

cc1: all warnings being treated as errors

The ./configure --help shows

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --disable-dependency-tracking  speeds up one-time build
  --enable-dependency-tracking   do not reject slow dependency extractors
  --disable-gtktest       do not try to compile and run a test GTK+ program
  --enable-debug    Turn on debugging

how can I tell configure not to include -Werror??

lanoxx
  • 10,551
  • 8
  • 77
  • 121
mahmood
  • 21,089
  • 43
  • 130
  • 209

5 Answers5

24

Werror is a gcc argument, you cannot remove it directly via ./configure, otherwise an option like --disable-error would show up in the help text. However, it's possible.

Set an environment variable:

export CFLAGS="-Wno-error"

That's for for C compilers. If the project uses C++, do:

export CXXFLAGS="-Wno-error"

In the very rare case the project does not honor this variables, your last resort is to edit the configure.ac file and search for -Werror and remove it from the string it occurs in (be careful though).

qed
  • 21,094
  • 18
  • 110
  • 180
skim
  • 289
  • 2
  • 3
  • 5
    Please note that the difference between `CFLAGS` and `CPPFLAGS` is not that `CFLAGS` is used by C compilers and `CPPFLAGS` is used by C++ compilers, but that `CFLAGS` is used by the Compiler, and `CPPFLAGS` is used by the C Preprocessor. See this SO answer for more details: http://stackoverflow.com/questions/2754966/cflags-vs-cppflags – staticfloat Aug 07 '12 at 07:04
  • 2
    The comment above refers to the original answer, which had CPPFLAGS instead of CXXFLAGS. – Will Bickford Aug 29 '13 at 16:12
6

it seems like the feature has been in autotools for many years:

./configure --disable-werror

unfortunately, i wasn't able to get the following specific case to work:

./configure --enable-wno-error=unused-value

maybe it could work if one escaped '=' symbol, assuming it's possible. Like skim says, one can still use CFLAGS or CXXFLAGS.

andrew-e
  • 674
  • 7
  • 9
2

I had to use --disable-Werror (with an upper-case W) on my module. While sudoman's anwer above suggests to use --disable-werror (with a lower case w).

It may look like a typo but it is actually dependend on your particular configure setup, especially if configure is generated by autoconf. What needs to be passed to the configure script to disable Werror depends on how the build system was setup.

If your project uses the AX_COMPILER_FLAGS option from the autoconf-archive project, then by default -Werror is enabled.

In another module you may find something like this:

+AC_ARG_ENABLE([werror],
+         AC_HELP_STRING([--disable-werror],
+                [do not build with -Werror]),

And thus you would need to use --disable-werror.

lanoxx
  • 10,551
  • 8
  • 77
  • 121
1

This work for me,compiling curlpp, lubuntu 16.10:

./configure --disable-ewarning
FRL
  • 720
  • 7
  • 9
-1

I ran into this problem and it turned out that gcc was not installed on my freshly started EC2 instance running Ubuntu 20.04.

Simply running sudo apt install gcc fixed this issue for me.