Nginx modules build fail:field ‘pkt6’ has incomplete type

Preface

I recently upgraded Nginx 1.24.0 and got an error when compiling a third-party 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;
      |                           ^~~~

reason

It can be seen from this that

field ‘pkt6’ has incomplete type

The definition does not match. I checked the information:

https://trac.nginx.org/nginx/ticket/2312

At the same time, I took a look at the source code of the third-party module and found that the source code of the third-party module does not start with nginx rules:

The following two #include statements must appear at the beginning of every nginx file:

#include <ngx_config.h>
#include <ngx_core.h>

Development guide

solve

So modify the file include header order,

#include <ngx_config.h>
#include <ngx_core.h>
....

Done

Guess you like

Origin blog.csdn.net/yangyangye/article/details/133175929