yaoweibin / nginx_tcp_proxy_module

add the feature of tcp proxy with nginx, with health check and status monitor
http://yaoweibin.github.com/nginx_tcp_proxy_module
1.65k stars 365 forks source link

error: unknown type name ‘ngx_resolver_addr_t’ #137

Closed opsconquer closed 8 years ago

opsconquer commented 8 years ago

编译tenginx-2.1.2 作为反向代理

报错: In file included from /data/software/nginx_tcp_proxy_module-master/ngx_tcp.h:32:0, from /data/software/nginx_tcp_proxy_module-master//ngx_tcp.c:5: /data/software/nginx_tcp_proxy_module-master/ngx_tcp_upstream.h:143:5: error: unknown type name ‘ngx_resolver_addr_t’ ngx_resolver_addr_t addrs; ^ make[1]: ** [objs/addon/nginx_tcp_proxy_module-master/ngx_tcp.o] Error 1 make[1]: Leaving directory `/home/ec2-user/tengine-2.1.2' make: *\ [build] Error 2

reynaldliu commented 8 years ago

addrs的定义文件在nginx/src/core/ngx_resolver.h

nginx_tcp_proxy_module的头文件在ngx_tcp_upstream.h的结构体ngx_tcp_upstream_resolved_s中 这是因为在1.9版本起addrs的结构体由ngx_addr_t 改为ngx_resolver_addr_t,如果只是为了安装1.8上,只要直接将ngx_resolver_addr_t改为ngx_addr_t 即可,如果要兼容所有版本,改为下面的代码

if (nginx_version) >= 1005008

if (nginx_version) >= 1009001

ngx_resolver_addr_t *addrs;

else

ngx_addr_t *addrs;

endif

else

in_addr_t *addrs;

endif