[GH-ISSUE #93] NGINX latest mainline failed to build #206

Closed
opened 2026-03-13 17:02:04 +03:00 by kerem · 1 comment
Owner

Originally created by @ononoki1 on GitHub (Apr 26, 2022).
Original GitHub issue: https://github.com/ADD-SP/ngx_waf/issues/93

Problem

When building with lastest NGINX mainline version via dpkg-buildpackage, the following error occurs:

In file included from src/event/ngx_event.h:526,
                 from src/http/ngx_http_upstream.h:14,
                 from src/http/ngx_http.h:36,
                 from /github/home/nginx/debian/modules/ngx_waf/inc/ngx_http_waf_module_core.h:16,
                 from /github/home/nginx/debian/modules/ngx_waf/src/ngx_http_waf_module_core.c:1:
src/event/ngx_event_udp.h:45:27: error: field 'pkt6' has incomplete type
   45 |     struct in6_pktinfo    pkt6;
      |                           ^~~~
make[2]: *** [objs/Makefile:2410: objs/addon/src/ngx_http_waf_module_core.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from src/event/ngx_event.h:526,
                 from src/http/ngx_http_upstream.h:14,
                 from src/http/ngx_http.h:36,
                 from /github/home/nginx/debian/modules/ngx_waf/inc/ngx_http_waf_module_type.h:15,
                 from /github/home/nginx/debian/modules/ngx_waf/inc/ngx_http_waf_module_var.h:5,
                 from /github/home/nginx/debian/modules/ngx_waf/src/ngx_http_waf_module_var.c:1:
src/event/ngx_event_udp.h:45:27: error: field 'pkt6' has incomplete type
   45 |     struct in6_pktinfo    pkt6;
      |                           ^~~~
make[2]: *** [objs/Makefile:2417: objs/addon/src/ngx_http_waf_module_var.o] Error 1
make[2]: Leaving directory '/github/home/nginx/debian/build-nginx'
make[1]: *** [Makefile:10: build] Error 2
make[1]: Leaving directory '/github/home/nginx/debian/build-nginx'
make: *** [debian/rules:52: build-arch.nginx] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2

See here for details.

ngx_waf version: current branch v10.1.1

Solution

I searched on the web and found this ticket in NGINX's trac, which says:

The issue is caused by modules including system headers prior to nginx ones. In this particular case, it leads to undefined GNU_SOURCE macro and thus missing type declaration.

Then I tried to fix it in my fork and succeeded, so I created a PR. But the code may not be elegant (I know little about NGINX modules' development). You can edit it to prettify the code.

Originally created by @ononoki1 on GitHub (Apr 26, 2022). Original GitHub issue: https://github.com/ADD-SP/ngx_waf/issues/93 ## Problem When building with lastest NGINX mainline version via `dpkg-buildpackage`, the following error occurs: ```txt In file included from src/event/ngx_event.h:526, from src/http/ngx_http_upstream.h:14, from src/http/ngx_http.h:36, from /github/home/nginx/debian/modules/ngx_waf/inc/ngx_http_waf_module_core.h:16, from /github/home/nginx/debian/modules/ngx_waf/src/ngx_http_waf_module_core.c:1: src/event/ngx_event_udp.h:45:27: error: field 'pkt6' has incomplete type 45 | struct in6_pktinfo pkt6; | ^~~~ make[2]: *** [objs/Makefile:2410: objs/addon/src/ngx_http_waf_module_core.o] Error 1 make[2]: *** Waiting for unfinished jobs.... In file included from src/event/ngx_event.h:526, from src/http/ngx_http_upstream.h:14, from src/http/ngx_http.h:36, from /github/home/nginx/debian/modules/ngx_waf/inc/ngx_http_waf_module_type.h:15, from /github/home/nginx/debian/modules/ngx_waf/inc/ngx_http_waf_module_var.h:5, from /github/home/nginx/debian/modules/ngx_waf/src/ngx_http_waf_module_var.c:1: src/event/ngx_event_udp.h:45:27: error: field 'pkt6' has incomplete type 45 | struct in6_pktinfo pkt6; | ^~~~ make[2]: *** [objs/Makefile:2417: objs/addon/src/ngx_http_waf_module_var.o] Error 1 make[2]: Leaving directory '/github/home/nginx/debian/build-nginx' make[1]: *** [Makefile:10: build] Error 2 make[1]: Leaving directory '/github/home/nginx/debian/build-nginx' make: *** [debian/rules:52: build-arch.nginx] Error 2 dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2 ``` See [here](https://github.com/ononoki1/nginx/runs/6162910522?check_suite_focus=true) for details. ngx_waf version: `current` branch v10.1.1 ## Solution I searched on the web and found [this ticket](https://trac.nginx.org/nginx/ticket/2312) in NGINX's trac, which says: > The issue is caused by modules including system headers prior to nginx ones. In this particular case, it leads to undefined GNU_SOURCE macro and thus missing type declaration. Then I tried to fix it in my fork and succeeded, so I created a [PR](https://github.com/ADD-SP/ngx_waf/pull/92). But the code may not be elegant (I know little about NGINX modules' development). You can edit it to prettify the code.
kerem 2026-03-13 17:02:04 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@ononoki1 commented on GitHub (Apr 26, 2022):

See this pull request for more information. #92

<!-- gh-comment-id:1109320557 --> @ononoki1 commented on GitHub (Apr 26, 2022): See this pull request for more information. #92
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ngx_waf#206
No description provided.