原创

[linux]nginx编译报错this statement may fall through [-Werror=implicit-fallthrough=]

我使用WDCP面板,在lanmp.sh脚本运行的时候,选择了nginx环境。 跑了半天,就报这个错误

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:

网上说的很清楚了,是因为error的问题,我在objs/Makefile文件中的确看到了CFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused -Werror,网上的说法是去掉这个就可以了,但是因为Makefile文件是自动生成的,能不能在生成的时候,就不要加入-Werror的参数呢? 答案是可以的 在./configure加入--with-cc-opt=-Wno-error参数即可,比如: ./configure --with-cc-opt=-Wno-error 这是初步的解决方案,实际上,还可以这样,在运行lamp.sh脚本前,修改lib/nginx.sh脚本中的14行也可以。 (我这里因为是docker的镜像文件,所以直接用脚本了。)

参考:

跳转

本文来自:[linux]nginx编译报错this statement may fall through [-Werror=implicit-fallthrough=]-小码农,转载请保留本条链接,感谢!

温馨提示:
本文最后更新于 2020年12月28日,已超过 1,186 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我
正文到此结束
该篇文章的评论功能已被站长关闭
本文目录