Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disable -Werror in configure file

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??

like image 237
mahmood Avatar asked Nov 15 '11 06:11

mahmood


People also ask

How disable conf file in Linux?

To disable a configuration file: sudo a2disconf example-conf.

What does a configure file do?

A configuration file, often shortened to config file, defines the parameters, options, settings and preferences applied to operating systems (OSes), infrastructure devices and applications in an IT context.


2 Answers

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).

like image 81
skim Avatar answered Oct 03 '22 01:10

skim


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.

like image 26
andrew-e Avatar answered Oct 03 '22 01:10

andrew-e