Skip to content
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

Needs to include stdio.h in nginx/auto/feature for this to work #265

Open
kzcabstone opened this issue Jan 19, 2022 · 2 comments
Open

Needs to include stdio.h in nginx/auto/feature for this to work #265

kzcabstone opened this issue Jan 19, 2022 · 2 comments

Comments

@kzcabstone
Copy link

https://github.com/SpiderLabs/ModSecurity-nginx/blob/2497e6ac654d0b117b9534aa735b757c6b11c84f/config#L15

nginx src version: 1.20.2

When I was trying to compile the nginx connector module, nginx configure was complaining about libmodsecurity not found. Command line I was using:

./configure --with-http_ssl_module --with-threads  --with-compat --add-dynamic-module=/usr/local/opt/ModSecurity-nginx/

I checked nginx/objs/autoconf.err and this is in it

----------------------------------------
checking for ModSecurity library in "/usr/local/opt/ModSecurity/src/.libs/" and "/usr/local/opt/ModSecurity/headers/" (specified by the MODSECURITY_LIB and MODSECURITY_INC env)

objs/autotest.c:6:5: error: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Werror,-Wimplicit-function-declaration]
    printf("hello");;
    ^
objs/autotest.c:6:5: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
1 error generated.
----------
#include <sys/types.h>
#include <unistd.h>
#include <modsecurity/modsecurity.h>

int main(void) {
    printf("hello");;
    return 0;
}

So I think you need to either set $NGX_INCLUDE_UNISTD_H or not use printf

@liudongmiao
Copy link

see #275.

@mikelolasagasti
Copy link

Found similar issue since some compilation flags changed for Fedora.

With the following standard build command it fails:

./configure --add-dynamic-module=/builddir/build/BUILD/ModSecurity-nginx-1.0.3
(...)
configuring additional dynamic modules
adding module in /builddir/build/BUILD/ModSecurity-nginx-1.0.3
checking for ModSecurity library ... not found
checking for ModSecurity library in /usr/local/modsecurity ... not found
 ./configure: error: ngx_http_modsecurity_module requires the ModSecurity library.

With manually setting MODSECURITY_LIB and MODSECURITY_INC also fails

export MODSECURITY_LIB=/usr/lib64/
export MODSECURITY_INC=/usr/include/modsecurity
./configure --add-dynamic-module=/builddir/build/BUILD/ModSecurity-nginx-1.0.3
(...)
configuring additional dynamic modules
adding module in /builddir/build/BUILD/ModSecurity-nginx-1.0.3
checking for ModSecurity library in "/usr/lib64/" and "/usr/include/modsecurity" (specified by the MODSECURITY_LIB and MODSECURITY_INC env) ... not found
        ./configure: error: ngx_http_modsecurity_module requires the ModSecurity library and MODSECURITY_LIB is defined as "/usr/lib64/" and MODSECURITY_INC (path for modsecurity.h) "/usr/include/modsecurity", but we cannot find ModSecurity there.

Applying patch in #275 works just fine in both cases:

./configure --add-dynamic-module=/builddir/build/BUILD/ModSecurity-nginx-1.0.3
(...)
adding module in /builddir/build/BUILD/ModSecurity-nginx-1.0.3
checking for ModSecurity library in "/usr/lib64/" and "/usr/include/modsecurity" (specified by the MODSECURITY_LIB and MODSECURITY_INC env) ... found
 + ngx_http_modsecurity_module was configured

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

3 participants