nginx编译安装nginx-sticky-module报错

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx编译安装nginx-sticky-module报错相关的知识,希望对你有一定的参考价值。

报错如下:

/usr/local/nginx-sticky-module-1.1/nginx-sticky-module-1.1/ngx_http_sticky_misc.c: In function ‘ngx_http_sticky_misc_text_raw’:

/usr/local/nginx-sticky-module-1.1/nginx-sticky-module-1.1/ngx_http_sticky_misc.c:281:2: error: passing argument 2 of ‘ngx_sock_ntop’ makes integer from pointer without a cast [-Werror]

src/core/ngx_inet.h:110:8: note: expected ‘socklen_t’ but argument is of type ‘u_char *’

/usr/local/nginx-sticky-module-1.1/nginx-sticky-module-1.1/ngx_http_sticky_misc.c:281:2: error: passing argument 3 of ‘ngx_sock_ntop’ makes pointer from integer without a cast [-Werror]

src/core/ngx_inet.h:110:8: note: expected ‘u_char *’ but argument is of type ‘size_t’

/usr/local/nginx-sticky-module-1.1/nginx-sticky-module-1.1/ngx_http_sticky_misc.c:281:2: error: too few arguments to function ‘ngx_sock_ntop’

src/core/ngx_inet.h:110:8: note: declared here

cc1: all warnings being treated as errors

make[1]: *** [objs/addon/nginx-sticky-module-1.1/ngx_http_sticky_misc.o] Error 1

make[1]: Leaving directory `/root/wuxiaoyu/nginx/nginx-1.8.1‘

make: *** [build] Error 2

[email protected]:~/wuxiaoyu/nginx/nginx-1.8.1# 

解决方法

进入nginx-sticky-module-1.1解压之后的文件夹

vim ngx_http_sticky_misc.c  +281

原来:

digest->len = ngx_sock_ntop(in, digest->data, len, 1);

改成:

digest->len =ngx_sock_ntop(in,sizeof(struct sockaddr_in),digest->data, len, 1);




以上是关于nginx编译安装nginx-sticky-module报错的主要内容,如果未能解决你的问题,请参考以下文章

Nginx编译安装及编译参数讲解

nginx编译安装服务启动脚本在哪

安装nginx的时候,是怎么编译老出错啊

Nginx编译安装

编译安装nginx

Linux编译安装nginx并平滑升级和回滚