【发布时间】:2015-03-05 18:04:52
【问题描述】:
我正在尝试make 小代理服务器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
编译失败,因为all warnings are being treated as errors
它已经两年没有更新了,似乎警告只是来自被弃用的东西,但我希望它仍然可以工作。
我已经在 Google 上搜索过如何停止将所有警告视为错误;有人建议使用-Wno-error,但这对我的情况没有影响。
如何在此处强制编译?
注意
Makefile 只包含:
#
# tcproxy - Makefile
#
# Author: dccmx <dccmx@dccmx.com>
#
default: all
.DEFAULT:
cd src && $(MAKE) $@
【问题讨论】:
-
编译器将警告视为错误,而不是 make。 Make 只是观察编译器说它失败并且因为编译失败而没有继续。因此,您必须修改编译,以便编译器不会就已弃用的功能向您发出警告。对于必须支持多个系统的多个版本的人来说,这个警告并没有让他们的生活变得更轻松。
-
相关的makefile是src目录下的,不是顶层目录。
标签: c linux compiler-errors makefile