简体   繁体   中英

Stop make from treating warnings as errors

I'm trying to make the little proxy server tcproxy :

user@localhost:tcproxy $ make
cd src && make all
make[1]: Entering directory '/home/user/Downloads/tcproxy/src'
    CC anet.o
In file included from /usr/include/sys/types.h:25:0,
                 from anet.c:33:
/usr/include/features.h:148:3: error: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Werror=cpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^
cc1: all warnings being treated as errors
Makefile:26: recipe for target 'anet.o' failed
make[1]: *** [anet.o] Error 1
make[1]: Leaving directory '/home/user/Downloads/tcproxy/src'
Makefile:10: recipe for target 'all' failed
make: *** [all] Error 2

Compilation is failing because all warnings are being treated as errors

It hasn't been updated in two years and it appears the warning is just from something being deprecated, but I'm hoping it should work nonetheless.

I've Googled how to stop all warnings being treated as errors; someone suggests using -Wno-error but that made no difference in my case.

How can I force the compilation here?

Note

The Makefile simply contains:

#
# tcproxy - Makefile
#
# Author: dccmx <dccmx@dccmx.com>
#

default: all

.DEFAULT:
    cd src && $(MAKE) $@

In src/Makefile there is a line defining :

CFLAGS_GEN = -Wall -Werror -g $(CFLAGS)

Remove the -Werror and the warning you're getting should get ignored.

These are compiler options, not make options, to be clear.

You need to find the options that you use when make invokes your compiler. Look in your makefile for the option -Werror , and remove it from whatever variable it's contained in (probably CFLAGS or some variation).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM