首页 > 代码库 > nginx编译安装nginx-sticky-module报错

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

root@wuxy-it-mail-dns:~/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报错