编译nginx时make报错[-Werror=implicit-fallthrough=]的解决方案

make报错Werro_

src/core/ngx_murmurhash.c: In function ‘ngx_murmur_hash2’:
src/core/ngx_murmurhash.c:37:11: error: this statement may fall through [-Werror=implicit-fallthrough=]
h ^= data[2] << 16;
^~~~~~~~~~~~~~
src/core/ngx_murmurhash.c:38:5: note: here
case 2:
^~~~
src/core/ngx_murmurhash.c:39:11: error: this statement may fall through [-Werror=implicit-fallthrough=]
h ^= data[1] << 8;
^~~~~~~~~~~~~
src/core/ngx_murmurhash.c:40:5: note: here
case 1:
^~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:473: objs/src/core/ngx_murmurhash.o] Error 1
make[1]: Leaving directory '/root/nginx-1.10.1'
make: *** [Makefile:8: build] Error 2

分析原因:

是编译器将警告当成了错误处理

解决:

打开 nginx的安装目录/objs/Makefile,去掉CFLAGS中的-Werror,再重新make

-Wall 表示打开gcc的所有警告
-Werror,它要求gcc将所有的警告当成错误进行处理

原文地址:https://www.cnblogs.com/hxlinux/p/12900458.html