kvspb / nginx-auth-ldap

LDAP authentication module for nginx
BSD 2-Clause "Simplified" License
739 stars 253 forks source link

make errors [unknown option after ‘#pragma GCC diagnostic’ kind] #162

Open user490 opened 7 years ago

user490 commented 7 years ago

Hello,

Here's the configuration I am using.

./configure --user=nginx --group=nginx --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module --add-module=/home/blah/nginx-auth-ldap/ --with-debug --without-http_rewrite_module

OpenSSL 1.0.2 22 Jan 2015 gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)

I was getting the following error while running make command.

cc1: warnings being treated as errors /home/blah/nginx-auth-ldap//ngx_http_auth_ldap_module.c:43: error: unknown option after ‘#pragma GCC diagnostic’ kind /home/blah/nginx-auth-ldap//ngx_http_auth_ldap_module.c:423:8: error: #warning "http_auth_ldap: Compiling with OpenSSL < 1.0.2, certificate verification will be unavailable. OPENSSL_VERSION_NUMBER == " XSTR(OPENSSL_VERSION_NUMBER) make[1]: *** [objs/addon/nginx-auth-ldap/ngx_http_auth_ldap_module.o] Error 1 make[1]: Leaving directory/home/blah/nginx-1.10.1' make: *** [build] Error 2`

After adding the following commit d5f7e156cf7bb499fc273d031ca676f947ff1b32, I am getting the following error.

home/blah/nginx-auth-ldap//ngx_http_auth_ldap_module.c:44: error: unknown option after ‘#pragma GCC diagnostic’ kind make[1]: *** [objs/addon/nginx-auth-ldap/ngx_http_auth_ldap_module.o] Error 1 make[1]: Leaving directory/home/blah/nginx-1.10.1' make: *** [build] Error 2`

Can anyone please let me know how to fix this.

Many thanks!

cloudsnack commented 7 years ago

your gcc version is 4. gcc 4.4 cannot interpret '#pragma GCC diagnostic warning "-Wcpp"'

Fix it as below.

// make sure manual warnings don't get escalated to errors
#ifdef __clang__
#pragma clang diagnostic warning "-W#warnings"
#else
#ifdef __GNUC__
#if GNUC > 4
#pragma GCC diagnostic warning "-Wcpp"
#endif
#endif
#endif
// TODO: do the same stuff for MSVC and/or other compilers