FRiCKLE / ngx_postgres

upstream module that allows nginx to communicate directly with PostgreSQL database.
http://labs.frickle.com/nginx_ngx_postgres/
BSD 2-Clause "Simplified" License
544 stars 123 forks source link

Compilation error with Nginx 1.8.1 #46

Open AlexanderMatveev opened 8 years ago

AlexanderMatveev commented 8 years ago
In file included from /usr/include/time.h:37:0,
                 from src/os/unix/ngx_linux_config.h:51,
                 from src/core/ngx_config.h:26,
                 from src/core/ngx_core.h:12,
                 from /opt/ngx_postgres/ngx_postgres-0.9/src/ngx_postgres_ddebug.h:32,
                 from /opt/ngx_postgres/ngx_postgres-0.9/src/ngx_postgres_upstream.c:33:
src/core/ngx_inet.h:28:51: warning: passing argument 3 of ‘ngx_sock_ntop’ makes pointer from integer without a cast [enabled by default]
     (sizeof(struct sockaddr_un) - offsetof(struct sockaddr_un, sun_path))
                                                   ^
src/core/ngx_inet.h:31:54: note: in expansion of macro ‘NGX_UNIX_ADDRSTRLEN’
 #define NGX_SOCKADDR_STRLEN   (sizeof("unix:") - 1 + NGX_UNIX_ADDRSTRLEN)
                                                      ^
/opt/ngx_postgres/ngx_postgres-0.9/src/ngx_postgres_upstream.c:106:43: note: in expansion of macro ‘NGX_SOCKADDR_STRLEN’
                                           NGX_SOCKADDR_STRLEN, 0);
                                           ^
In file included from src/core/ngx_core.h:76:0,
                 from /opt/ngx_postgres/ngx_postgres-0.9/src/ngx_postgres_ddebug.h:32,
                 from /opt/ngx_postgres/ngx_postgres-0.9/src/ngx_postgres_upstream.c:33:
src/core/ngx_inet.h:110:8: note: expected ‘u_char *’ but argument is of type ‘long unsigned int’
 size_t ngx_sock_ntop(struct sockaddr *sa, socklen_t socklen, u_char *text,
        ^
In file included from /usr/include/time.h:37:0,
                 from src/os/unix/ngx_linux_config.h:51,
                 from src/core/ngx_config.h:26,
                 from src/core/ngx_core.h:12,
                 from /opt/ngx_postgres/ngx_postgres-0.9/src/ngx_postgres_ddebug.h:32,
                 from /opt/ngx_postgres/ngx_postgres-0.9/src/ngx_postgres_upstream.c:33:
src/core/ngx_inet.h:28:51: error: too few arguments to function ‘ngx_sock_ntop’
     (sizeof(struct sockaddr_un) - offsetof(struct sockaddr_un, sun_path))
                                                   ^
src/core/ngx_inet.h:31:54: note: in expansion of macro ‘NGX_UNIX_ADDRSTRLEN’
 #define NGX_SOCKADDR_STRLEN   (sizeof("unix:") - 1 + NGX_UNIX_ADDRSTRLEN)
                                                      ^
/opt/ngx_postgres/ngx_postgres-0.9/src/ngx_postgres_upstream.c:106:43: note: in expansion of macro ‘NGX_SOCKADDR_STRLEN’
                                           NGX_SOCKADDR_STRLEN, 0);
                                           ^
In file included from src/core/ngx_core.h:76:0,
                 from /opt/ngx_postgres/ngx_postgres-0.9/src/ngx_postgres_ddebug.h:32,
                 from /opt/ngx_postgres/ngx_postgres-0.9/src/ngx_postgres_upstream.c:33:
src/core/ngx_inet.h:110:8: note: declared here
 size_t ngx_sock_ntop(struct sockaddr *sa, socklen_t socklen, u_char *text,
        ^
/opt/ngx_postgres/ngx_postgres-0.9/src/ngx_postgres_upstream.c: In function ‘ngx_postgres_upstream_free_connection’:
/opt/ngx_postgres/ngx_postgres-0.9/src/ngx_postgres_upstream.c:556:16: error: ‘ngx_event_t’ has no member named ‘prev’
         if (rev->prev) {
                ^
/opt/ngx_postgres/ngx_postgres-0.9/src/ngx_postgres_upstream.c:560:16: error: ‘ngx_event_t’ has no member named ‘prev’
         if (wev->prev) {
                ^
make[3]: *** [objs/addon/src/ngx_postgres_upstream.o] Error 1
make[3]: Leaving directory `/opt/rebuildnginx/nginx-1.8.1/debian/build-full'
make[2]: *** [build] Error 2
make[2]: Leaving directory `/opt/rebuildnginx/nginx-1.8.1/debian/build-full'
make[1]: *** [build.arch.full] Error 2
make[1]: Leaving directory `/opt/rebuildnginx/nginx-1.8.1'
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2
agentzh commented 8 years ago

@alexmatveev You need to use the latest git master or the latest git tag for it. 0.9 is antient.

AlexanderMatveev commented 8 years ago

@agentzh Would you please create an installation docs?

agentzh commented 8 years ago

@alexmatveev The simplest way is to use the OpenResty bundle which has the latest version of this ngx_postgres module by default: https://openresty.org.