all warnings being treated as errors,,error: format ‘%u’ expects argument of type ‘unsigned int’

系统管理员 2022-03-08 06:12 626阅读 0赞

在centos7 系统编译tengine 时报错:

src/http/ngx_http_upstream_check_module.c:1489:2: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘ngx_uint_t’ [-Werror=format=]
count, ngx_http_upstream_check_shm_generation);
^
src/http/ngx_http_upstream_check_module.c:1489:2: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘ngx_uint_t’ [-Werror=format=]
src/http/ngx_http_upstream_check_module.c:1492:2: error: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ngx_uint_t’ [-Werror=format=]
check_len += sprintf(check_status + check_len,”peers->peers.nelts = %d\n”, peers->peers.nelts);
^
src/http/ngx_http_upstream_check_module.c:1520:3: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘ngx_uint_t’ [-Werror=format=]
peer[i].conf->port);
^
src/http/ngx_http_upstream_check_module.c:1520:3: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 8 has type ‘ngx_uint_t’ [-Werror=format=]
src/http/ngx_http_upstream_check_module.c:1520:3: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 9 has type ‘ngx_uint_t’ [-Werror=format=]
src/http/ngx_http_upstream_check_module.c:1520:3: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 11 has type ‘ngx_uint_t’ [-Werror=format=]
cc1: all warnings being treated as errors

原因很明显,应该是没有添加编译参数,警告被当成了错误处理。

解决办法;

-Wformat=0 就没问题了。Wformat这个配置在Centos下默认是关闭的,所以一直没报错,如果编译的时候打开,也会提示一样的错误。

记录一下另外一个错误:

如果在linux下安装openssl,执行config和make之后,在执行make install时如果出现下面的错误

cms.pod around line 457: Expected text after =item, not a number
cms.pod around line 461: Expected text after =item, not a number
cms.pod around line 465: Expected text after =item, not a number
cms.pod around line 470: Expected text after =item, not a number
cms.pod around line 474: Expected text after =item, not a number
POD document had syntax errors at /usr/bin/pod2man line 69.

有人验证 安装perl 5.16 可以兼容,安排低版本perl 5.16可以解决问题。

解决: 则在root权限下,执行rm -f /usr/bin/pod2man 然后重新make install

发表评论

表情:
评论列表 (有 0 条评论,626人围观)

还没有评论,来说两句吧...

相关阅读