Forum: NGINX Compilation error on CentOS-5.7

Cacb99df2c6f0207fe7459f50fd787c6?d=identicon&s=25 Iqbal Aroussi (Guest)
on 2012-02-27 15:49
(Received via mailing list)
Hi,

Can you please help me overcome this problem. I'm trying to compile
Nginx + nginx_udplog_module
from source but I get this error: *cc1: warnings being treated as
errors*
I tried with *nginx-1.0.0* the version in our production servers and *
nginx-1.0.12* the latest stable version.

Best Regards

*Compilation env:*
CentOS release 5.7 (Final)
*uname -a*
Linux  2.6.18-274.18.1.el5 #1 SMP Thu Feb 9 12:45:44 EST 2012 x86_64
x86_64
x86_64 GNU/Linux

*gcc -v*
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada
--enable-java-awt=gtk --disable-dssi --disable-plugin
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--with-cpu=generic
--host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-51)

*Configure options:*
./configure --user=nginx --group=nginx --prefix=/usr/share/nginx
--sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--http-client-body-temp-path=/var/lib/nginx/tmp/client_body
--http-proxy-temp-path=/var/lib/nginx/tmp/proxy
--http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi
--http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi
--http-scgi-temp-path=/var/lib/nginx/tmp/scgi
--pid-path=/var/run/nginx.pid
--lock-path=/var/lock/subsys/nginx --with-http_ssl_module
--with-http_realip_module --with-http_addition_module
--with-http_xslt_module --with-http_image_filter_module
--with-http_geoip_module --with-http_sub_module --with-http_dav_module
--with-http_flv_module --with-http_gzip_static_module
--with-http_random_index_module --with-http_secure_link_module
--with-http_degradation_module --with-http_stub_status_module
--with-http_perl_module --with-mail --with-file-aio
--with-mail_ssl_module
--with-ipv6 --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64
-mtune=generic' --with-cc-opt='-O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64
-mtune=generic' --add-module=/root/nginx_udplog_module-1.0.0

*Output:*
checking for OS
 + Linux 2.6.18-274.18.1.el5 x86_64
checking for C compiler ... found
 + using GNU C compiler
 + gcc version: 4.1.2 20080704 (Red Hat 4.1.2-51)
checking for gcc -pipe switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... not found
checking for sys/param.h ... found
checking for sys/mount.h ... found
checking for sys/statvfs.h ... found
checking for crypt.h ... found
checking for Linux specific features
checking for epoll ... found
checking for sendfile() ... found
checking for sendfile64() ... found
checking for sys/prctl.h ... found
checking for prctl(PR_SET_DUMPABLE) ... found
checking for sched_setaffinity() ... found
checking for crypt_r() ... found
checking for sys/vfs.h ... found
checking for poll() ... found
checking for /dev/poll ... not found
checking for kqueue ... not found
checking for crypt() ... not found
checking for crypt() in libcrypt ... found
checking for F_READAHEAD ... not found
checking for posix_fadvise() ... found
checking for O_DIRECT ... found
checking for F_NOCACHE ... not found
checking for directio() ... not found
checking for statfs() ... found
checking for statvfs() ... found
checking for dlopen() ... not found
checking for dlopen() in libdl ... found
checking for sched_yield() ... found
checking for SO_SETFIB ... not found
checking for accept4() ... not found
checking for kqueue AIO support ... not found
checking for Linux AIO support ... found
configuring additional modules
adding module in /root/nginx_udplog_module-1.0.0
 + ngx_http_udplog_module was configured
checking for PCRE library ... found
checking for OpenSSL library ... found
checking for zlib library ... found
checking for libxslt ... found
checking for libexslt ... found
checking for GD library ... found
checking for perl
 + perl version: v5.8.8 built for x86_64-linux-thread-multi
 + perl interpreter multiplicity found
checking for GeoIP library ... found
creating objs/Makefile
checking for int size ... 4 bytes
checking for long size ... 8 bytes
checking for long long size ... 8 bytes
checking for void * size ... 8 bytes
checking for uint64_t ... found
checking for sig_atomic_t ... found
checking for sig_atomic_t size ... 4 bytes
checking for socklen_t ... found
checking for in_addr_t ... found
checking for in_port_t ... found
checking for rlim_t ... found
checking for uintptr_t ... uintptr_t found
checking for system endianess ... little endianess
checking for size_t size ... 8 bytes
checking for off_t size ... 8 bytes
checking for time_t size ... 8 bytes
checking for AF_INET6 ... found
checking for setproctitle() ... not found
checking for pread() ... found
checking for pwrite() ... found
checking for sys_nerr ... found
checking for localtime_r() ... found
checking for posix_memalign() ... found
checking for memalign() ... found
checking for mmap(MAP_ANON|MAP_SHARED) ... found
checking for mmap("/dev/zero", MAP_SHARED) ... found
checking for System V shared memory ... found
checking for struct msghdr.msg_control ... found
checking for ioctl(FIONBIO) ... found
checking for struct tm.tm_gmtoff ... found
checking for struct dirent.d_namlen ... not found
checking for struct dirent.d_type ... found

Configuration summary
  + using system PCRE library
  + using system OpenSSL library
  + md5: using OpenSSL library
  + sha1 library is not used
  + using system zlib library

  nginx path prefix: "/usr/share/nginx"
  nginx binary file: "/usr/sbin/nginx"
  nginx configuration prefix: "/etc/nginx"
  nginx configuration file: "/etc/nginx/nginx.conf"
  nginx pid file: "/var/run/nginx.pid"
  nginx error log file: "/var/log/nginx/error.log"
  nginx http access log file: "/var/log/nginx/access.log"
  nginx http client request body temporary files:
"/var/lib/nginx/tmp/client_body"
  nginx http proxy temporary files: "/var/lib/nginx/tmp/proxy"
  nginx http fastcgi temporary files: "/var/lib/nginx/tmp/fastcgi"
  nginx http uwsgi temporary files: "/var/lib/nginx/tmp/uwsgi"
  nginx http scgi temporary files: "/var/lib/nginx/tmp/scgi"

*Make:*
make -f objs/Makefile
make[1]: Entering directory `/root/nginx-1.0.0'
gcc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter
-Wunused-function -Wunused-variable -Wunused-value -Werror -g -O2 -g
-pipe
-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic -I src/core -I src/event
-I
src/event/modules -I src/os/unix -I /usr/include/libxml2 -I objs \
 -o objs/src/core/nginx.o \
src/core/nginx.c
cc1: warnings being treated as errors
src/core/nginx.c: In function ngx_set_user:
src/core/nginx.c:1105: warning: unused parameter cmd
src/core/nginx.c: In function ngx_set_env:
src/core/nginx.c:1168: warning: unused parameter cmd
src/core/nginx.c: In function ngx_set_priority:
src/core/nginx.c:1198: warning: unused parameter cmd
src/core/nginx.c: In function ngx_set_cpu_affinity:
src/core/nginx.c:1238: warning: unused parameter cmd
make[1]: *** [objs/src/core/nginx.o] Error 1
make[1]: Leaving directory `/root/nginx-1.0.0'
make: *** [build] Error 2


*Sincerely yours*
*--*
*Iqbal Aroussi*
 *+212 665 025 032*
 *iqbal@aroussi.name*
63367d89c5becdded2cb3820574a8f1f?d=identicon&s=25 Adam Landas (Guest)
on 2012-02-27 15:51
(Received via mailing list)
Hello,
  This is because nginx is compiled with the -Werror flag, remove this
from
your objs/Makefile file, and you should be fine.


Regards,

Adam
Adam LANDAS | Operations | ChinaNetCloud | www.ChinaNetCloud.com
Phone: +86 (21) 6422-1946 | adam.landas@chinanetcloud.com | Skype:
adamlandas
X2 Space 1-601, 1238 Xietu Lu, Shanghai 200032, China
OnDemand 2011 "100 Top Private Company" - We are hiring!
www.chinanetcloud.com/jobs
2974d09ac2541e892966b762aad84943?d=identicon&s=25 trojan2748 (Guest)
on 2012-02-27 15:53
(Received via mailing list)
Hello,
  This is because nginx is compiled with the -Werror flag, remove this
from your objs/Makefile file, and you should be fine.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,223048,223050#msg-223050
Cacb99df2c6f0207fe7459f50fd787c6?d=identicon&s=25 Iqbal Aroussi (Guest)
on 2012-02-27 16:00
(Received via mailing list)
Hi Adam,

Awesome, Thank you so much. worked great.

Best Regards
*

--
*
*Iqbal Aroussi*
 *+212 665 025 032*
 *iqbal@aroussi.name*
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2012-02-27 16:12
(Received via mailing list)
Hello!

On Mon, Feb 27, 2012 at 02:48:06PM +0000, Iqbal Aroussi wrote:

> Hi,
>
> Can you please help me overcome this problem. I'm trying to compile
> Nginx + nginx_udplog_module
> from source but I get this error: *cc1: warnings being treated as errors*
> I tried with *nginx-1.0.0* the version in our production servers and *
> nginx-1.0.12* the latest stable version.

[...]

> --with-ipv6 --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
> -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64
> -mtune=generic' --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
> -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64
> -mtune=generic' --add-module=/root/nginx_udplog_module-1.0.0

You shoot yourself in the foot by using --with-cc-opt="... -Wall
...".  This results in:

> gcc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter
> -Wunused-function -Wunused-variable -Wunused-value -Werror -g -O2 -g -pipe
> -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
> --param=ssp-buffer-size=4 -m64 -mtune=generic -I src/core -I src/event -I
> src/event/modules -I src/os/unix -I /usr/include/libxml2 -I objs \
>  -o objs/src/core/nginx.o \
> src/core/nginx.c

I.e. warning options set by nginx (notably "-Wall ...
-Wno-unused-parameter") are overriden by your "-Wall" which comes
later, and this results in compilation failure due to "-Werror"
also set by nginx.

Not passing "-Wall" by hand will fix this while still ensure that
warnings unexpected in the nginx source code will be fatal.

Maxim Dounin
79518c99454864df949f8c675283698b?d=identicon&s=25 Edho Arief (Guest)
on 2012-02-27 16:17
(Received via mailing list)
2012/2/27 Maxim Dounin <mdounin@mdounin.ru>:
>
>> --with-ipv6 --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
>> -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64
>> -mtune=generic' --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
>> -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64
>> -mtune=generic' --add-module=/root/nginx_udplog_module-1.0.0
>
> You shoot yourself in the foot by using --with-cc-opt="... -Wall
> ...".  This results in:
>

For few seconds I thought this was error report from gentooland.
Cacb99df2c6f0207fe7459f50fd787c6?d=identicon&s=25 Iqbal Aroussi (Guest)
on 2012-02-27 16:29
(Received via mailing list)
Hi Maxim,

Thanks for your reply.
Actually as I was asked to ad support for the *nginx_udplog_module*
module
I copied the configuration options from *nginx -V* output.
I really appreciate your advise and I'll give it a try right away.

Best Regards

nginx -V
nginx: nginx version: nginx/1.0.0
nginx: built by gcc 4.1.2 20080704 (Red Hat 4.1.2-50)
nginx: TLS SNI support disabled
nginx: configure arguments: --user=nginx --group=nginx
--prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--http-client-body-temp-path=/var/lib/nginx/tmp/client_body
--http-proxy-temp-path=/var/lib/nginx/tmp/proxy
--http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi
--http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi
--http-scgi-temp-path=/var/lib/nginx/tmp/scgi
--pid-path=/var/run/nginx.pid
--lock-path=/var/lock/subsys/nginx --with-http_ssl_module
--with-http_realip_module --with-http_addition_module
--with-http_xslt_module --with-http_image_filter_module
--with-http_geoip_module --with-http_sub_module --with-http_dav_module
--with-http_flv_module --with-http_gzip_static_module
--with-http_random_index_module --with-http_secure_link_module
--with-http_degradation_module --with-http_stub_status_module
--with-http_perl_module --with-mail --with-file-aio
--with-mail_ssl_module
--with-ipv6 --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64
-mtune=generic' --with-cc-opt='-O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64
-mtune=generic'
*


--
*
*Iqbal Aroussi*
 *+212 665 025 032*
 *iqbal@aroussi.name*
Cacb99df2c6f0207fe7459f50fd787c6?d=identicon&s=25 Iqbal Aroussi (Guest)
on 2012-02-27 16:42
(Received via mailing list)
Hi Maxim,

Thanks a lot  for your expertise. I removed the *-Wall* option and
everything worked perfectly, without the need to remove *-Werror*

Best Regards.
Really appreciate your support.

*--*
*Iqbal Aroussi*
 *+212 665 025 032*
 *iqbal@aroussi.name*
Cacb99df2c6f0207fe7459f50fd787c6?d=identicon&s=25 Iqbal Aroussi (Guest)
on 2012-02-27 16:51
(Received via mailing list)
Hi,

I was able to compile nginx alone without problems. however it doesn't
compile when I add *nginx_udplog_module-1.0.0* support "*
--add-module=/root/nginx_udplog_module-1.0.0*"
any hints ?

Best Regards

gcc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter
-Wunused-function -Wunused-variable -Wunused-value -Werror -g -O2 -g
-pipe
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic  -I src/core -I src/event
-I
src/event/modules -I src/os/unix -I /usr/include/libxml2 -I objs -I
src/http -I src/http/modules -I src/http/modules/perl -I src/mail \
 -o objs/addon/nginx_udplog_module-1.0.0/ngx_http_udplog_module.o \
/root/nginx_udplog_module-1.0.0/ngx_http_udplog_module.c
/root/nginx_udplog_module-1.0.0/ngx_http_udplog_module.c: In function
ngx_udplog_init_endpoint:
/root/nginx_udplog_module-1.0.0/ngx_http_udplog_module.c:284: error:
incompatible types in assignment
/root/nginx_udplog_module-1.0.0/ngx_http_udplog_module.c: In function
ngx_http_udplogger_send:
/root/nginx_udplog_module-1.0.0/ngx_http_udplog_module.c:338: error:
invalid type argument of ->
/root/nginx_udplog_module-1.0.0/ngx_http_udplog_module.c:338: error:
incompatible type for argument 2 of ngx_log_error_core
make[1]: ***
[objs/addon/nginx_udplog_module-1.0.0/ngx_http_udplog_module.o] Error 1
make[1]: Leaving directory `/root/nginx-1.0.12'
make: *** [build] Error 2

*


--
*
*Iqbal Aroussi*
 *+212 665 025 032*
 *iqbal@aroussi.name*
1ed66911122a5c1beffc061e2cd29f5d?d=identicon&s=25 Joshua Zhu (Guest)
on 2012-02-27 17:11
(Received via mailing list)
Hi,

On Mon, Feb 27, 2012 at 11:51 PM, Iqbal Aroussi <iqbal@aroussi.name>
wrote:

> -Wunused-function -Wunused-variable -Wunused-value -Werror -g -O2 -g -pipe
>  /root/nginx_udplog_module-1.0.0/ngx_http_udplog_module.c: In function
> ngx_http_udplogger_send:
> /root/nginx_udplog_module-1.0.0/ngx_http_udplog_module.c:338: error:
> invalid type argument of ->
> /root/nginx_udplog_module-1.0.0/ngx_http_udplog_module.c:338: error:
> incompatible type for argument 2 of ngx_log_error_core
> make[1]: ***
> [objs/addon/nginx_udplog_module-1.0.0/ngx_http_udplog_module.o] Error 1
> make[1]: Leaving directory `/root/nginx-1.0.12'
> make: *** [build] Error 2
>

If you need the syslog feature, maybe you can give Tengine (
http://tengine.taobao.org) a try? It is a nginx distribution with native
syslog support: http://tengine.taobao.org/document/http_log.html

Regards,
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2012-02-27 17:16
(Received via mailing list)
Hello!

On Mon, Feb 27, 2012 at 03:51:09PM +0000, Iqbal Aroussi wrote:

> -Wunused-function -Wunused-variable -Wunused-value -Werror -g -O2 -g -pipe
> /root/nginx_udplog_module-1.0.0/ngx_http_udplog_module.c: In function
> ‘ngx_http_udplogger_send’:
> /root/nginx_udplog_module-1.0.0/ngx_http_udplog_module.c:338: error:
> invalid type argument of ‘->’
> /root/nginx_udplog_module-1.0.0/ngx_http_udplog_module.c:338: error:
> incompatible type for argument 2 of ‘ngx_log_error_core’
> make[1]: ***
> [objs/addon/nginx_udplog_module-1.0.0/ngx_http_udplog_module.o] Error 1
> make[1]: Leaving directory `/root/nginx-1.0.12'
> make: *** [build] Error 2

It looks like the udplog module version you are using is way too
old and doesn't contain this 2 years old fix for and API change
in nginx 0.8.32:

https://github.com/vkholodkov/nginx-udplog-module/...

You may want to get more recent one from Valery's github.

Maxim Dounin
Cacb99df2c6f0207fe7459f50fd787c6?d=identicon&s=25 Iqbal Aroussi (Guest)
on 2012-02-27 17:26
(Received via mailing list)
Hi Maxim,

it worked great, you saved my day you're a great guy.

Bestest Regards
*


--
*
*Iqbal Aroussi*
 *+212 665 025 032*
 *iqbal@aroussi.name*
2974d09ac2541e892966b762aad84943?d=identicon&s=25 pradeepmohan (Guest)
on 2013-09-25 09:48
(Received via mailing list)
Hi,

Im getting following error while add new module
nginx_udplog_module-1.0.0
after nginx installation. Please

Note :  nginx version nginx-1.0.4.tar.gz
.
/root/SETUP-PACKAGE-BCK/nginx_udplog_module-1.0.0/ngx_http_udplog_module.c:
In function ‘ngx_udplog_init_endpoint’:
/root/SETUP-PACKAGE-BCK/nginx_udplog_module-1.0.0/ngx_http_udplog_module.c:284:
error: incompatible types in assignment
/root/SETUP-PACKAGE-BCK/nginx_udplog_module-1.0.0/ngx_http_udplog_module.c:
In function ‘ngx_http_udplogger_send’:
/root/SETUP-PACKAGE-BCK/nginx_udplog_module-1.0.0/ngx_http_udplog_module.c:338:
error: invalid type argument of ‘->’
/root/SETUP-PACKAGE-BCK/nginx_udplog_module-1.0.0/ngx_http_udplog_module.c:338:
error: incompatible type for argument 2 of ‘ngx_log_error_core’
make[1]: ***
[objs/addon/nginx_udplog_module-1.0.0/ngx_http_udplog_module.o]
Error 1
make[1]: Leaving directory `/root/nginx-1.0.4'
make: *** [build] Error 2

Thanks,
PradeeMohan

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,223048,243119#msg-243119
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.