nginx-auth-ldap
nginx-auth-ldap copied to clipboard
ngx_http_auth_ldap_module.c:38: error: unknown option after ‘#pragma GCC diagnostic
/usr/local/src/nginx-auth-ldap/ngx_http_auth_ldap_module.c:38: error: unknown option after ‘#pragma GCC diagnostic’ kind /usr/local/src/nginx-auth-ldap/ngx_http_auth_ldap_module.c:395: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 `/usr/local/src/nginx-1.6.2' make: *** [build] Error 2
how do to it?
this is my parameter:
cd /usr/local/src/nginx-1.6.2 && ./configure --user=www --group=www
--prefix=/usr/local/nginx
--with-http_stub_status_module
--with-http_ssl_module
--with-http_gzip_static_module
--with-http_flv_module
--add-module=/usr/local/src/nginx-auth-ldap
--with-http_realip_module && make && make install
I replied over there at issue #123. Also, your email inbox is full. :D
@victorhahncastell or @wanggaolin,
Was wondering if anyone else had the same GCC error for CentOS 6.8. I am having the same issue compiling the ngx_http_auth_ldap_module.c module.
Getting the following error:
/github/ldap/nginx-auth-ldap//ngx_http_auth_ldap_module.c:43: error: unknown option after ‘#pragma GCC diagnostic’ kind github/ldap/nginx-auth-ldap//ngx_http_auth_ldap_module.c:404: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 `github/nginx' make: *** [modules] Error 2
I found some references to a fix for OSX here: https://github.com/kvspb/nginx-auth-ldap/pull/139/files. Is there a known issue for CentOS 6.8 or the specific version of GCC?
Thanks, Any help or suggestions are welcome.
Also wanted to include the current contents of the ngx_http_auth_ldap_module.c section that was linked to this issue:
// used for manual warnings #define XSTR(x) STR(x) #define STR(x) #x // make sure manual warnings don't get escalated to errors #ifdef clang #pragma clang diagnostic warning "-W#warnings" #else #ifdef GNUC #pragma GCC diagnostic warning "-Wcpp" #endif #endif // TODO: do the same stuff for MSVC and/or other compilers
Hi @kennys-pt,
I guess you're compiling with Clang, not GCC, as your compiler does not understand the GCC instruction not to escalate this warning to error. And yes, this is exactly what PR #139 is supposed to fix :)
Anyway, please note that you won't get secure SSL unless you upgrade OpenSSL prior to compiling.
Best, Victor
Edited to add: As PR #139 is merged now re-pulling master should get you ready to go ^^
@kennys-pt: Wait... you're getting this even after the patch, right? Which compiler are you using? Could you give us your gcc -v output please?
@victorhahncastell,
Correct this is after the patch which shows merged into master, in which I pulled down this morning.
Cloned from here: https://github.com/kvspb/nginx-auth-ldap
here is the gcc info:
Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)
Thanks, -Kenny
@kennys-pt,
this is most peculiar. Could you by any chance be compiling using g++ instead of gcc? There seems to be an open issue in the GNU C++ compiler. I can't really think about a reason why gcc would ignore this directive otherwise.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=686178
@kennys-pt: In any case, if you're looking for a quick fix you can always just remove line 404 (the one starting with "#warning")
@victorhahncastell,
Removed line 404 but I still get the GCC error:
make modules
make -f objs/Makefile modules
make[1]: Entering directory /opt/home/kenny/github/nginx' 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 objs -I src/http -I src/http/modules \ -o objs/addon/nginx-auth-ldap/ngx_http_auth_ldap_module.o \ /home/kenny/github/ldap/nginx-auth-ldap//ngx_http_auth_ldap_module.c cc1: warnings being treated as errors /home/kenny/github/ldap/nginx-auth-ldap//ngx_http_auth_ldap_module.c:43: 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
/opt/home/kenny/github/nginx'
make: *** [modules] Error 2
Also removed line 43 and that let it complete the compile. Which confirmed in the objs directory I now have a ngx_http_auth_ldap_module.so file that I can copy to the modules directory and test dynamic loading.
No luck with copying and moving the .so file over and attempting to load it dynamically. Starting nginx: nginx: [emerg] module "/etc/nginx/modules/ngx_http_auth_ldap_module.so" is not binary compatible in /etc/nginx/nginx.conf:8
@victorhahncastell - so I compiled with only a single config
./nginx -V nginx version: nginx/1.10.1 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) configure arguments: --add-dynamic-module=/home/kenny/github/ldap/nginx-auth-ldap/
I added load_module "modules/ngx_http_auth_ldap_module.so"; into nginx.conf and it did not complain about the module ngx_http_auth_ldap_module.so.
However - if I copy ngx_http_auth_ldap_module.so to another machine with the default version nginx 1.10.1 installed from the Nginx repo and the .so file to /installdir/nginx/modules and then add the load module into nginx.conf it fails.
Error: "/etc/nginx/modules/ngx_http_auth_ldap_module.so" is not binary compatible in /etc/nginx/nginx.conf:8
It seems this should support dynamic loading of that module but perhaps since default packaged version of Nginx 1.10.1 does not have that compiled in it wont work?
Thanks again for all the help.
@kennys-pt: I actually have little experience with dynamic nginx modules but it seems plausible that compatibility between different machines is very limited. I suppose those would have to use the same version of libc and other libraries.
Hello all,
Can anyone instruct me to fix this issue? I am using CentOS release 6.4 and git the latest commit
/usr/local/src/nginx-auth-ldap/ngx_http_auth_ldap_module.c:43: error: unknown option after ‘#pragma GCC diagnostic’ kind /usr/local/src/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
@victorhahncastell I just deleted the warning line, but still got "/usr/local/src/nginx-auth-ldap/ngx_http_auth_ldap_module.c:43: error: unknown option after ‘#pragma GCC diagnostic’ kind" error I think there are 2 issues: 1, gcc 2, open ssl.
thanks.
The warning option of "-Wcpp" is available for gcc-5.x or later, thus the corresponding pragma directive leads to an error if you compile the code with gcc-4.x. The remedy is, for example, that the line 42 is replaced by
#if GNUC > 4
I've had the same issue as @tianjiaolaozu on CentOS 6 because of the following:
- nginx compiles with
-Werror
(treating warnings as errors) - CentOS 6 has OpenSSL 1.0.1e and so the LDAP module has a warning on compile
- CentOS 6 has GCC 4.4. This version treats
#pragma GCC diagnostic warning "-Wcpp"
as itself an error and thus skips the statement, leading the the#warning
still being an error.
It doesn't appear that < GCC 4.6 has any way of ignoring unknown pragmas from the code; there's apparently "-Wno-unknown-pragmas"
but that involves getting that option into nginx's compilation. For a toolkit like https://hg.nginx.org/pkg-oss/, that involves forking/etc.
So, in short, this module doesn't compile on CentOS 6 with the default nginx compilation/configure
options. For a workaround, just remove the warning from the source and add a condition with the GCC version (eg https://github.com/jcu-eresearch/nginx-auth-ldap/commit/143188675124822ec5144ba230bd05b116a40a1c).
So this issue is still a problem when compiling for CentOS 6. I've just opened PR #213; suggestions/comments/improvements very welcome.