将fastdfs-nginx-module模块添加到nginx,nginx编译错误

背景

nginx需要使用到fastdfs-nginx-module,我把它添加进nginx中,成功之后,我执行nginx中的objs/Makefile文件。

假如说已经在nginx源码目录中,我会执行如下命令:

make objs/Makefile

错误

编译到快结束时会出现这些错误:

cc1: all warnings being treated as errors make[1]: * [objs/Makefile:1335: objs/addon/src/ngx_http_fastdfs_module.o] Error 1 make[1]: Leaving directory '/home/ubuntu/mypacket/nginx-1.16.1' make: * [Makefile:8: build] Error 2

编译过程中的错误如下: error: ‘%s’ directive output may be truncated writing up to 510 bytes into a region of size between 111 and 127 [-Werror=format-truncation=] 902 | file_id_without_group = uri + 1; //skip / | ~~~~~~~ 903 | snprintf(file_id, sizeof(file_id), "%s/%s", \ | ^~

error: ‘%s’ directive output may be truncated writing up to 510 bytes into a region of size 128 [-Werror=format-truncation=] 857 | snprintf(file_id, sizeof(file_id), "%s", uri + 1); |

原因

Makefile文件中,设置的编译等级比较高,使用-werror选项,导致如果出现任何警告都将视为错误,所以就会导致编译失败。

解决方法

在Makefile中,将-werror删除。重新执行:

make objs/Makefile

 就可以成功。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值