arut / nginx-python-module

Nginx Python Module
BSD 2-Clause "Simplified" License
137 stars 36 forks source link

compile error #1

Closed hongzhidao closed 6 years ago

hongzhidao commented 7 years ago

Hi!

uname -a Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

./configure --add-module=/root/nginx-python-module && make

cc -c -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 /usr/include/python2.6 -I /usr/include/python2.6 -I objs -I src/http -I src/http/modules -I /usr/include/python2.6 -I /usr/include/python2.6 \ -o objs/addon/src/ngx_python.o \ /root/nginx-python-module/src/ngx_python.c In file included from /usr/include/python2.6/pyconfig.h:6, from /usr/include/python2.6/Python.h:8, from /root/nginx-python-module/src/ngx_python.h:13, from /root/nginx-python-module/src/ngx_python.c:11: /usr/include/python2.6/pyconfig-64.h:1022:1: error: "_GNU_SOURCE" redefined In file included from src/core/ngx_config.h:26, from /root/nginx-python-module/src/ngx_python.c:7: src/os/unix/ngx_linux_config.h:13:1: error: this is the location of the previous definition In file included from /usr/include/python2.6/pyconfig.h:6, from /usr/include/python2.6/Python.h:8, from /root/nginx-python-module/src/ngx_python.h:13, from /root/nginx-python-module/src/ngx_python.c:11: /usr/include/python2.6/pyconfig-64.h:1034:1: error: "_POSIX_C_SOURCE" redefined In file included from /usr/include/sys/types.h:26, from src/os/unix/ngx_linux_config.h:18, from src/core/ngx_config.h:26, from /root/nginx-python-module/src/ngx_python.c:7: /usr/include/features.h:162:1: error: this is the location of the previous definition In file included from /usr/include/python2.6/pyconfig.h:6, from /usr/include/python2.6/Python.h:8, from /root/nginx-python-module/src/ngx_python.h:13, from /root/nginx-python-module/src/ngx_python.c:11: /usr/include/python2.6/pyconfig-64.h:1043:1: error: "_XOPEN_SOURCE" redefined In file included from /usr/include/sys/types.h:26, from src/os/unix/ngx_linux_config.h:18, from src/core/ngx_config.h:26, from /root/nginx-python-module/src/ngx_python.c:7: /usr/include/features.h:164:1: error: this is the location of the previous definition make[1]: [objs/addon/src/ngx_python.o] Error 1 make[1]: Leaving directory `/root/nginx-1.10.2' make: [build] Error 2

Thanks.

arut commented 7 years ago

Hello @hongzhidao. Glad to see you here.

I've made a branch for compilation on old Linux kernels: https://github.com/arut/nginx-python-module/tree/oldlinux I hope, later I will come up with a better solution.

BTW tests will not work with python2.6, they use some new unittest features.

hongzhidao commented 7 years ago

And it seems the module only works well with latest nginx version 1.11+ because of the struct ngx_sockaddr_t.

arut commented 7 years ago

Yes.

kobzar commented 7 years ago

The same error

make -f objs/Makefile make[1]: Вход в каталог `/home/kobzar/install/nginx/srv/nginx-1.12.0' cc -c -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 /usr/include/python2.7 -I /usr/include/python2.7 -I objs -I src/http -I src/http/modules -I /usr/include/python2.7 -I /usr/include/python2.7 \ -o objs/addon/src/ngx_python.o \ /home/kobzar/install/nginx/srv/mods/nginx-python-module/src/ngx_python.c In file included from /usr/include/python2.7/pyconfig.h:6:0, from /usr/include/python2.7/Python.h:8, from /home/kobzar/install/nginx/srv/mods/nginx-python-module/src/ngx_python.h:13, from /home/kobzar/install/nginx/srv/mods/nginx-python-module/src/ngx_python.c:11: /usr/include/python2.7/pyconfig-64.h:1166:0: ошибка: «_GNU_SOURCE» переопределён [-Werror]

define _GNU_SOURCE 1

^ In file included from src/core/ngx_config.h:26:0, from /home/kobzar/install/nginx/srv/mods/nginx-python-module/src/ngx_python.c:7: src/os/unix/ngx_linux_config.h:13:0: замечание: это расположение предыдущего определения

define _GNU_SOURCE / pread(), pwrite(), gethostname() /

^ In file included from /usr/include/python2.7/pyconfig.h:6:0, from /usr/include/python2.7/Python.h:8, from /home/kobzar/install/nginx/srv/mods/nginx-python-module/src/ngx_python.h:13, from /home/kobzar/install/nginx/srv/mods/nginx-python-module/src/ngx_python.c:11: /usr/include/python2.7/pyconfig-64.h:1188:0: ошибка: «_POSIX_C_SOURCE» переопределён [-Werror]

define _POSIX_C_SOURCE 200112L

^ In file included from /usr/include/sys/types.h:25:0, from src/os/unix/ngx_linux_config.h:18, from src/core/ngx_config.h:26, from /home/kobzar/install/nginx/srv/mods/nginx-python-module/src/ngx_python.c:7: /usr/include/features.h:168:0: замечание: это расположение предыдущего определения

define _POSIX_C_SOURCE 200809L

^ In file included from /usr/include/python2.7/pyconfig.h:6:0, from /usr/include/python2.7/Python.h:8, from /home/kobzar/install/nginx/srv/mods/nginx-python-module/src/ngx_python.h:13, from /home/kobzar/install/nginx/srv/mods/nginx-python-module/src/ngx_python.c:11: /usr/include/python2.7/pyconfig-64.h:1210:0: ошибка: «_XOPEN_SOURCE» переопределён [-Werror]

define _XOPEN_SOURCE 600

^ In file included from /usr/include/sys/types.h:25:0, from src/os/unix/ngx_linux_config.h:18, from src/core/ngx_config.h:26, from /home/kobzar/install/nginx/srv/mods/nginx-python-module/src/ngx_python.c:7: /usr/include/features.h:170:0: замечание: это расположение предыдущего определения

define _XOPEN_SOURCE 700

^ cc1: all warnings being treated as errors make[1]: [objs/addon/src/ngx_python.o] Ошибка 1 make[1]: Выход из каталога `/home/kobzar/install/nginx/srv/nginx-1.12.0' make: [build] Ошибка 2

arut commented 7 years ago

@kobzar what Linux version do you have? did you try the branch?

kobzar commented 7 years ago

yes. But issue the same. And my kernel isn't old. Linux server 3.10.0-514.16.1.el7.x86_64 #1 SMP Wed Apr 12 15:04:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

kobzar commented 7 years ago

CFLAGS="$CFLAGS -Werror" resolve the issue.

arut commented 7 years ago

Yes, but patching nginx is a bad idea anyway.

msva commented 6 years ago

I've just built module pretty fine (with the warnings, tho, but it is no -Werror anywhere) with nginx-1.13.3 on 4.12.1 and 4.12.4

arut commented 6 years ago

This should have been fixed in v0.2.0.