[安装fastfds中的nginx执行make命令报错]src/core/ngx_murmurhash.c:37:11: error

在尝试编译nginx时,遇到了-Werror=implicit-fallthrough警告导致的编译错误。该错误源于源代码中可能存在的未明确标记的switch-case转换。为了解决这个问题,可以修改Makefile文件,取消-Werror选项,防止警告被当作错误处理。同时,可以考虑注释掉引发警告的代码行,例如ngx_user.c中的特定语句。通过这些修改,可以成功编译nginx源代码。
摘要由CSDN通过智能技术生成

问题

在nginx文件夹里执行make命令报错

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:
     ^~~~

解决

修改Makefile文件,将Werror字样去掉

[root@localhost fastdfs]# vim ./nginx-1.8.0/objs/Makefile
CC =    cc
CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused Werror -g  -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"'

修改ngx_user.c文件,将cd.current_salt[0] = ~salt[0]注释掉

    /* work around the glibc bug */
   /* cd.current_salt[0] = ~salt[0]; */
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值