Nginx安装 出现 In function ‘ngx_murmur_hash2’错误

阅读原文


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:432: objs/src/core/ngx_murmurhash.o] Error 1

原因:将警告信息当作错误信息进行了处理
解决方法:使用编辑器打开nginx/objs/Makefile,删除CFLAGS中的-Werror,如图所示;

重新进行make操作即可

接着你会出现问题

src/os/unix/ngx_user.c: In function ‘ngx_libc_crypt’:
src/os/unix/ngx_user.c:35:7: error: ‘struct crypt_data’ has no member named ‘current_salt’
     cd.current_salt[0] = ~salt[0];
       ^
make[1]: *** [objs/Makefile:712: objs/src/os/unix/ngx_user.o] Error 1

原因:源代码问题
解决方法:修改ngx_user.c /src/os/unix/ngx_user.c

注释掉蓝线标注的代码
重新make即可成功

原文地址:https://www.cnblogs.com/userzf/p/15204844.html