Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#201 closed defect (fixed)

cannot build with gcc 4.7.1 and -O2

Reported by: Brent Garber Owned by: somebody
Priority: major Milestone:
Component: nginx-core Version: 1.3.x
Keywords: Cc:
uname -a: Linux 3.4.2-x86_64-linode25 #2 SMP Tue Jun 26 16:10:49 EDT 2012 x86_64 GNU/Linux
nginx -V: 1.3.5

Description

gcc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -O2 -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/src/http/ngx_http_core_module.o \
		src/http/ngx_http_core_module.c
src/http/ngx_http_core_module.c: In function ‘ngx_http_get_forwarded_addr’:
src/http/ngx_http_core_module.c:2779:13: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
cc1: all warnings being treated as errors
make[1]: *** [objs/src/http/ngx_http_core_module.o] Error 1
make[1]: Leaving directory `/usr/src/nginx-1.3.5'
make: *** [build] Error 2
make -f objs/Makefile install
make[1]: Entering directory `/usr/src/nginx-1.3.5'
gcc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -O2 -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/src/http/ngx_http_core_module.o \
		src/http/ngx_http_core_module.c
src/http/ngx_http_core_module.c: In function ‘ngx_http_get_forwarded_addr’:
src/http/ngx_http_core_module.c:2779:13: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
cc1: all warnings being treated as errors
make[1]: *** [objs/src/http/ngx_http_core_module.o] Error 1
make[1]: Leaving directory `/usr/src/nginx-1.3.5'
make: *** [install] Error 2

Attachments (1)

p (2.3 KB ) - added by Ruslan Ermilov 12 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 by Brent Garber, 12 years ago

This is GCC 4.7.1

comment:2 by Brent Garber, 12 years ago

Appeared somewhere between r4623 and r4629 but with different build errors in that range, cannot narrow it down any more.

And only appears when compiling with -O2, -O1 appears to compile w/o errors.

Last edited 12 years ago by Brent Garber (previous) (diff)

in reply to:  1 comment:3 by Ruslan Ermilov, 12 years ago

Replying to Brent Garber <bgarber42@gmail.com>:

This is GCC 4.7.1

What Linux distribution do you use?

According to http://www.linode.com/faq.cfm, there's plenty of options.

comment:4 by Brent Garber, 12 years ago

Debian unstable, GNU toolchain is 4.7.1-7, 4.6.3-9 works with -O2 however.

Last edited 12 years ago by Brent Garber (previous) (diff)

by Ruslan Ermilov, 12 years ago

Attachment: p added

in reply to:  4 comment:5 by Ruslan Ermilov, 12 years ago

Replying to Brent Garber <bgarber42@gmail.com>:

Debian unstable, GNU toolchain is 4.7.1-7, 4.6.3-9 works with -O2 however.

Please try the patch I have attached.

comment:6 by Brent Garber, 12 years ago

That seems to do the trick:

# ./nginx -V
nginx version: nginx/1.3.5
built by gcc 4.7.1 (Debian 4.7.1-7) 
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --user=www-data --group=www-data --with-ipv6 --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-pcre-jit --with-sha1-asm --with-sha1=/usr/include --with-cc-opt=-O2 --with-cpu-opt=native

in reply to:  6 comment:7 by Ruslan Ermilov, 12 years ago

Thanks for testing!

comment:8 by Ruslan Ermilov, 12 years ago

Summary: Cannot Build on Linuxcannot build with gcc 4.7.1 and -O2

comment:9 by Ruslan Ermilov, 12 years ago

Resolution: fixed
Status: newclosed

In 4829/nginx:

(The changeset message doesn't reference this ticket)

comment:10 by Maxim Dounin, 12 years ago

In 4858/nginx:

(The changeset message doesn't reference this ticket)

Note: See TracTickets for help on using tickets.