[GH-ISSUE #81] build error in nginx 1.21.5 PCRE2 #196

Closed
opened 2026-03-13 16:58:18 +03:00 by kerem · 8 comments
Owner

Originally created by @ehdud8451 on GitHub (Dec 31, 2021).
Original GitHub issue: https://github.com/ADD-SP/ngx_waf/issues/81

  • How to trigger this bug?
    in build source
  • The name and version of the OS.
    Ubuntu 20.04 LTS
  • The version or branch of ngx_waf.
    ngx_waf 10.1.0
  • Output of nginx -V.
    nginx 1.21.5
  • Log
    /usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c: In function ‘_change_modsecurity_pcre_callback’:
    /usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c:2412:9: error: ‘pcre_malloc’ undeclared (first use in this function); did you mean ‘realloc’?
    2412 | if (pcre_malloc != _modsecurity_pcre_malloc) {
    | ^~~~~~~~~~~
    | realloc
    /usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c:2412:9: note: each undeclared identifier is reported only once for each function it appears in
    /usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c:2416:38: error: ‘pcre_free’ undeclared (first use in this function); did you mean ‘curl_free’?
    2416 | _old_modsecurity_pcre_free = pcre_free;
    | ^~~~~~~~~
    | curl_free
    /usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c: In function ‘_recover_modsecurity_pcre_callback’:
    /usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c:2435:9: error: ‘pcre_malloc’ undeclared (first use in this function); did you mean ‘realloc’?
    2435 | pcre_malloc = _old_modsecurity_pcre_malloc;
    | ^~~~~~~~~~~
    | realloc
    /usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c:2436:9: error: ‘pcre_free’ undeclared (first use in this function); did you mean ‘curl_free’?
    2436 | pcre_free = _old_modsecurity_pcre_free;
    | ^~~~~~~~~
    | curl_free
    make[1]: *** [objs/Makefile:1789: objs/addon/src/ngx_http_waf_module_config.o] Error 1

--

I think error occurred when nginx 1.21.5 use pcre2.
github.com/nginx/nginx@c6fec0b027 (diff-bcb19bf17a)

what can i do?

Originally created by @ehdud8451 on GitHub (Dec 31, 2021). Original GitHub issue: https://github.com/ADD-SP/ngx_waf/issues/81 * How to trigger this bug? in build source * The name and version of the OS. Ubuntu 20.04 LTS * The version or branch of `ngx_waf`. ngx_waf 10.1.0 * Output of `nginx -V`. nginx 1.21.5 * Log /usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c: In function ‘_change_modsecurity_pcre_callback’: /usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c:2412:9: error: ‘pcre_malloc’ undeclared (first use in this function); did you mean ‘realloc’? 2412 | if (pcre_malloc != _modsecurity_pcre_malloc) { | ^~~~~~~~~~~ | realloc /usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c:2412:9: note: each undeclared identifier is reported only once for each function it appears in /usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c:2416:38: error: ‘pcre_free’ undeclared (first use in this function); did you mean ‘curl_free’? 2416 | _old_modsecurity_pcre_free = pcre_free; | ^~~~~~~~~ | curl_free /usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c: In function ‘_recover_modsecurity_pcre_callback’: /usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c:2435:9: error: ‘pcre_malloc’ undeclared (first use in this function); did you mean ‘realloc’? 2435 | pcre_malloc = _old_modsecurity_pcre_malloc; | ^~~~~~~~~~~ | realloc /usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c:2436:9: error: ‘pcre_free’ undeclared (first use in this function); did you mean ‘curl_free’? 2436 | pcre_free = _old_modsecurity_pcre_free; | ^~~~~~~~~ | curl_free make[1]: *** [objs/Makefile:1789: objs/addon/src/ngx_http_waf_module_config.o] Error 1 -- I think error occurred when nginx 1.21.5 use pcre2. https://github.com/nginx/nginx/commit/c6fec0b027569a4e0b1d8aaee7dea0f2e4d6052b#diff-bcb19bf17af086d8a980b0f90c7e3e1f9cc4bdd0881fa3c95b2ca16fe6c11438 what can i do?
kerem 2026-03-13 16:58:18 +03:00
  • closed this issue
  • added the
    bug
    Nginx
    labels
Author
Owner

@ADD-SP commented on GitHub (Dec 31, 2021):

Try the branch current-dev, it might work.

<!-- gh-comment-id:1003291520 --> @ADD-SP commented on GitHub (Dec 31, 2021): Try the branch `current-dev`, it might work.
Author
Owner

@ADD-SP commented on GitHub (Dec 31, 2021):

Solved?

<!-- gh-comment-id:1003314492 --> @ADD-SP commented on GitHub (Dec 31, 2021): Solved?
Author
Owner

@ehdud8451 commented on GitHub (Dec 31, 2021):

I'm sorry for the late response.
An error was found in connection with this, but I'll check if this is an error related to ngx_waf and reply again.

<!-- gh-comment-id:1003362310 --> @ehdud8451 commented on GitHub (Dec 31, 2021): I'm sorry for the late response. An error was found in connection with this, but I'll check if this is an error related to ngx_waf and reply again.
Author
Owner

@ehdud8451 commented on GitHub (Dec 31, 2021):

-ldl -lpthread -lcrypt -lm -Wl,-rpath,/usr/local/modsecurity/lib -l modsecurity -l curl -l sodium -lpcre2-8 /usr/local/src/openssl/.openssl/lib/libssl.a /usr/local/src/openssl/.openssl/lib/libcrypto.a -ldl -lpthread -lz
-Wl,-E
/usr/bin/ld: objs/addon/src/ngx_http_waf_module_config.o: undefined reference to symbol 'pcre_malloc'
/usr/bin/ld: /lib/x86_64-linux-gnu/libpcre.so.3: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [objs/Makefile:320: objs/nginx] Error 1
make[1]: Leaving directory '/usr/local/src/nginx/nginx-1.21.5'
make: *** [Makefile:10: build] Error 2

I'm a beginner. I can't check why this error appears. What can I do?

<!-- gh-comment-id:1003369644 --> @ehdud8451 commented on GitHub (Dec 31, 2021): -ldl -lpthread -lcrypt -lm -Wl,-rpath,/usr/local/modsecurity/lib -l modsecurity -l curl -l sodium -lpcre2-8 /usr/local/src/openssl/.openssl/lib/libssl.a /usr/local/src/openssl/.openssl/lib/libcrypto.a -ldl -lpthread -lz \ -Wl,-E /usr/bin/ld: objs/addon/src/ngx_http_waf_module_config.o: undefined reference to symbol 'pcre_malloc' /usr/bin/ld: /lib/x86_64-linux-gnu/libpcre.so.3: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[1]: *** [objs/Makefile:320: objs/nginx] Error 1 make[1]: Leaving directory '/usr/local/src/nginx/nginx-1.21.5' make: *** [Makefile:10: build] Error 2 I'm a beginner. I can't check why this error appears. What can I do?
Author
Owner

@ADD-SP commented on GitHub (Dec 31, 2021):

It looks like there are some compatibility issues with pcre2, I'll let you know when I fix it.

<!-- gh-comment-id:1003374920 --> @ADD-SP commented on GitHub (Dec 31, 2021): It looks like there are some compatibility issues with pcre2, I'll let you know when I fix it.
Author
Owner

@ADD-SP commented on GitHub (Jan 1, 2022):

Retry the branch current-dev :) .

<!-- gh-comment-id:1003553896 --> @ADD-SP commented on GitHub (Jan 1, 2022): Retry the branch `current-dev` :) .
Author
Owner

@ADD-SP commented on GitHub (Jan 3, 2022):

@ehdud8451 Solved?

<!-- gh-comment-id:1004005046 --> @ADD-SP commented on GitHub (Jan 3, 2022): @ehdud8451 Solved?
Author
Owner

@ADD-SP commented on GitHub (Jan 7, 2022):

v10.1.1 can now be compiled with PCRE2.

<!-- gh-comment-id:1007128302 --> @ADD-SP commented on GitHub (Jan 7, 2022): `v10.1.1` can now be compiled with PCRE2.
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#196
No description provided.