Nginx 安装错误:'make[1]: *** [objs/Makefile:465:objs/src/core/ngx_murmurhash.o] 错误 1' 解决方法
在安装 Nginx 时,可能会遇到以下错误:
make -f objs/Makefile
make[1]: 进入目录“/home/liu-jy/桌面/nginx-1.10.1”
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../pcre-8.40 -I ../zlib-1.2.11 -I objs \ -o objs/src/core/ngx_murmurhash.o \ src/core/ngx_murmurhash.csrc/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=]
37 | h ^= data[2] << 16;
37 | ~~^~~~~~~~~~~~~~~~src/core/ngx_murmurhash.c:38:5: note: here
38 | case 2:
38 | ^~~~src/core/ngx_murmurhash.c:39:11: error: this statement may fall through [-Werror=implicit-fallthrough=]
39 | h ^= data[1] << 8;
39 | ~~^~~~~~~~~~~~~~~src/core/ngx_murmurhash.c:40:5: note: here
40 | case 1:
40 | ^~~~cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:465:objs/src/core/ngx_murmurhash.o] 错误 1
make[1]: 离开目录“/home/liu-jy/桌面/nginx-1.10.1”
make: *** [Makefile:8:build] 错误 2
这个错误是由于使用了 -Werror 标志,将所有警告视为错误,包括隐式的掉落。
解决方法:
- 打开 Makefile 文件,找到
CFLAGS变量,并将其中的-Werror标志移除。 - 保存文件 后再运行
make命令即可。
此外,您也可以在命令行中运行 make -k 命令跳过错误并继续构建。
原文地址: https://www.cveoy.top/t/topic/ovME 著作权归作者所有。请勿转载和采集!