[GH-ISSUE #8] Failure to compile in CentOS/RHEL 6 or 7 #139

Closed
opened 2026-03-13 16:30:12 +03:00 by kerem · 1 comment
Owner

Originally created by @dvershinin on GitHub (Oct 24, 2020).
Original GitHub issue: https://github.com/ADD-SP/ngx_waf/issues/8

If we compile NGINX with system libraries for OpenSSL, it eventually seems to include a file that has the same constant already defined, then compilation fails:

In file included from ngx_waf-2.0.0/src/../inc/ngx_http_waf_module_core.h:7,
                 from ngx_waf-2.0.0/src/ngx_http_waf_module_core.c:2:
ngx_waf-2.0.0/src/../inc/ngx_http_waf_module_macro.h:19: error: "TRUE" redefined [-Werror]
 #define TRUE                    (1)
 
In file included from /usr/include/krb5.h:8,
                 from /usr/include/openssl/kssl.h:73,
                 from /usr/include/openssl/ssl.h:165,
                 from src/event/ngx_event_openssl.h:15,
                 from src/core/ngx_core.h:84,
                 from ngx_waf-2.0.0/src/../inc/ngx_http_waf_module_core.h:2,
                 from ngx_waf-2.0.0/src/ngx_http_waf_module_core.c:2:
/usr/include/krb5/krb5.h:177: note: this is the location of the previous definition
 #define TRUE    1
 
In file included from ngx_waf-2.0.0/src/../inc/ngx_http_waf_module_core.h:7,
                 from ngx_waf-2.0.0/src/ngx_http_waf_module_core.c:2:
ngx_waf-2.0.0/src/../inc/ngx_http_waf_module_macro.h:20: error: "FALSE" redefined [-Werror]
 #define FALSE                   (0)
 
In file included from /usr/include/krb5.h:8,
                 from /usr/include/openssl/kssl.h:73,
                 from /usr/include/openssl/ssl.h:165,
                 from src/event/ngx_event_openssl.h:15,
                 from src/core/ngx_core.h:84,
                 from ngx_waf-2.0.0/src/../inc/ngx_http_waf_module_core.h:2,
                 from ngx_waf-2.0.0/src/ngx_http_waf_module_core.c:2:
/usr/include/krb5/krb5.h:174: note: this is the location of the previous definition
 #define FALSE   0
 
cc1: all warnings being treated as errors

In CentOS/RHEL 8, this does not happen for whatever reason...although the related files /usr/include/krb5/krb5.h has same "fences":

#ifndef FALSE
#define FALSE   0
#endif
#ifndef TRUE
#define TRUE    1
#endif

I think similar things should be added over to inc/ngx_http_waf_module_macro.h?

Originally created by @dvershinin on GitHub (Oct 24, 2020). Original GitHub issue: https://github.com/ADD-SP/ngx_waf/issues/8 If we compile NGINX with system libraries for OpenSSL, it eventually seems to include a file that has the same constant already defined, then compilation fails: ``` In file included from ngx_waf-2.0.0/src/../inc/ngx_http_waf_module_core.h:7, from ngx_waf-2.0.0/src/ngx_http_waf_module_core.c:2: ngx_waf-2.0.0/src/../inc/ngx_http_waf_module_macro.h:19: error: "TRUE" redefined [-Werror] #define TRUE (1) In file included from /usr/include/krb5.h:8, from /usr/include/openssl/kssl.h:73, from /usr/include/openssl/ssl.h:165, from src/event/ngx_event_openssl.h:15, from src/core/ngx_core.h:84, from ngx_waf-2.0.0/src/../inc/ngx_http_waf_module_core.h:2, from ngx_waf-2.0.0/src/ngx_http_waf_module_core.c:2: /usr/include/krb5/krb5.h:177: note: this is the location of the previous definition #define TRUE 1 In file included from ngx_waf-2.0.0/src/../inc/ngx_http_waf_module_core.h:7, from ngx_waf-2.0.0/src/ngx_http_waf_module_core.c:2: ngx_waf-2.0.0/src/../inc/ngx_http_waf_module_macro.h:20: error: "FALSE" redefined [-Werror] #define FALSE (0) In file included from /usr/include/krb5.h:8, from /usr/include/openssl/kssl.h:73, from /usr/include/openssl/ssl.h:165, from src/event/ngx_event_openssl.h:15, from src/core/ngx_core.h:84, from ngx_waf-2.0.0/src/../inc/ngx_http_waf_module_core.h:2, from ngx_waf-2.0.0/src/ngx_http_waf_module_core.c:2: /usr/include/krb5/krb5.h:174: note: this is the location of the previous definition #define FALSE 0 cc1: all warnings being treated as errors ``` In CentOS/RHEL 8, this does not happen for whatever reason...although the related files `/usr/include/krb5/krb5.h` has same "fences": ``` #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE 1 #endif ``` I think similar things should be added over to `inc/ngx_http_waf_module_macro.h`?
kerem 2026-03-13 16:30:12 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@ADD-SP commented on GitHub (Oct 25, 2020):

Oh~, that's a cheap mistake, since I'm not following the relevant C coding standards. I have corrected the code to avoid a similar bug. Thanks for reminding.

<!-- gh-comment-id:716098915 --> @ADD-SP commented on GitHub (Oct 25, 2020): Oh~, that's a cheap mistake, since I'm not following the relevant C coding standards. I have corrected the code to avoid a similar bug. Thanks for reminding.
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#139
No description provided.