最近升级Nginx 1.24.0,编译第三方module出错:
- /usr/src/nginx_modules/ngx_json_post_module/src/ngx_json_post_module.c
- In file included from src/event/ngx_event.h:526,
- from src/http/ngx_http_upstream.h:14,
- from src/http/ngx_http.h:34,
- from /usr/src/nginx_modules/ngx_json_post_module/src/ngx_json_post_module.c:11:
- src/event/ngx_event_udp.h:38:27: error: field ‘pkt6’ has incomplete type
- 38 | struct in6_pktinfo pkt6;
- | ^~~~
从这个可以看出,
field ‘pkt6’ has incomplete type
是定义不匹配,查了一下资料:
https://trac.nginx.org/nginx/ticket/2312
同时,看了一下第三方module的源码,发现第三方module源码,不是以nginx规则开头的:
- The following two #include statements must appear at the beginning of every nginx file:
-
- #include
- #include
所以修改文件include头顺序,
- #include
- #include
- ....
搞定