Skip to content

[Makefile:16: modules] Error 2, error: 'pcre_malloc' undeclared (first use in this function); did you mean 'old_pcre_malloc'? ...on Raspberry Pi 4 8GB: #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Danrancan opened this issue Jan 4, 2022 · 1 comment

Comments

@Danrancan
Copy link

I am trying to build modesecurity v3 against nginx-1.21.5 ARM for Raspberry Pi 4 8GB on Ubuntu Server 20.04, for raspberry pi 4 64-bit arm.

The steps I have taken thus far (Which have worked on nginx-1.21.4 ARM For Raspberry PI 4 8GB on Ubuntu Server 20.04) have been derived from this tutorial and are printed below. PLEASE NOTE: STEP 22 (make modules) is where the error happens.

  1. Install the apt repository for the Nginx Mainline version in my sources.list.d directory.
  2. sudo apt update
  3. sudo chown username:username /usr/local/src/ -R
  4. mkdir -p /usr/local/src/nginx
  5. cd /usr/local/src/nginx/
  6. sudo apt install dpkg-dev
  7. apt source nginx
  8. git clone --depth 1 -b v3/master --single-branch https://github.com/SpiderLabs/ModSecurity /usr/local/src/ModSecurity/
  9. cd /usr/local/src/ModSecurity/
  10. sudo apt install gcc make build-essential autoconf automake libtool libcurl4-openssl-dev liblua5.3-dev libfuzzy-dev ssdeep gettext pkg-config libpcre3 libpcre3-dev libxml2 libxml2-dev libcurl4 libgeoip-dev libyajl-dev doxygen
  11. git submodule init
  12. git submodule update
  13. ./build.sh
  14. ./configure
  15. make -j4
  16. sudo make install
    Download and Compile ModSecurity v3 Nginx Connector Source Code
  17. git clone --depth 1 https://github.com/SpiderLabs/ModSecurity-nginx.git /usr/local/src/ModSecurity-nginx/
  18. cd /usr/local/src/nginx/nginx-1.21.5
  19. sudo apt build-dep nginx
  20. sudo apt install uuid-dev
  21. ./configure --with-compat --add-dynamic-module=/usr/local/src/ModSecurity-nginx
  22. make modules
Danrancan@Ubuntu_Server_20.04_on_RaspberryPi4_8GB:/usr/local/src/nginx/nginx-1.21.5$ make modules
make -f objs/Makefile modules
make[1]: Entering directory '/usr/local/src/nginx/nginx-1.21.5'
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/local/modsecurity/include -I objs -I src/http -I src/http/modules \
	-o objs/addon/src/ngx_http_modsecurity_module.o \
	/usr/local/src/ModSecurity-nginx/src/ngx_http_modsecurity_module.c
/usr/local/src/ModSecurity-nginx/src/ngx_http_modsecurity_module.c: In function 'ngx_http_modsecurity_pcre_malloc_init':
/usr/local/src/ModSecurity-nginx/src/ngx_http_modsecurity_module.c:78:9: error: 'pcre_malloc' undeclared (first use in this function); did you mean 'old_pcre_malloc'?
   78 |     if (pcre_malloc != ngx_http_modsec_pcre_malloc) {
      |         ^~~~~~~~~~~
      |         old_pcre_malloc
/usr/local/src/ModSecurity-nginx/src/ngx_http_modsecurity_module.c:78:9: note: each undeclared identifier is reported only once for each function it appears in
/usr/local/src/ModSecurity-nginx/src/ngx_http_modsecurity_module.c:82:25: error: 'pcre_free' undeclared (first use in this function); did you mean 'pkey_free'?
   82 |         old_pcre_free = pcre_free;
      |                         ^~~~~~~~~
      |                         pkey_free
/usr/local/src/ModSecurity-nginx/src/ngx_http_modsecurity_module.c: In function 'ngx_http_modsecurity_pcre_malloc_done':
/usr/local/src/ModSecurity-nginx/src/ngx_http_modsecurity_module.c:102:9: error: 'pcre_malloc' undeclared (first use in this function); did you mean 'old_pcre_malloc'?
  102 |         pcre_malloc = old_pcre_malloc;
      |         ^~~~~~~~~~~
      |         old_pcre_malloc
/usr/local/src/ModSecurity-nginx/src/ngx_http_modsecurity_module.c:103:9: error: 'pcre_free' undeclared (first use in this function); did you mean 'pkey_free'?
  103 |         pcre_free = old_pcre_free;
      |         ^~~~~~~~~
      |         pkey_free
make[1]: *** [objs/Makefile:1232: objs/addon/src/ngx_http_modsecurity_module.o] Error 1
make[1]: Leaving directory '/usr/local/src/nginx/nginx-1.21.5'
make: *** [Makefile:16: modules] Error 2

As you can see from above, I get stuck here with Error 2. Is there a solution or workaround for this? I would like to compile this module for nginx v1.21.5 Mainline on Raspberry Pi 4, as soon as possible. Please let me know if there is anything else I can do to help, or when a fix has been made. Thanks Developers!

@defanator
Copy link
Collaborator

@Danrancan see #260.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants