Forum OpenACS Q&A: I need help compiling nspostgres-4.0. Im stuck!

I need help installing postgres. I read the installation manual and got stuck while installing the aolserver postgres driver. aolserver and postgres seems perfectly fine. i get the following errors after make install....

gcc -pipe -DBIND_EMULATION -I/usr/include -DFOR_ACS_USE -O -D__NO_STRING_INLINES -D__NO_MATH_INLINES -Wall -Wconversion -Wno-implicit-int -fPIC -I/usr/local/aolserver40r10/include -I/usr/local/include -DNO_CONST -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DTCL_THREADS=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_PTHREAD_ATFORK=1 -DHAVE_READDIR_R=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_STRTOLL=1 -DHAVE_STRTOULL=1 -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TM_ZONE=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DPEEK_XCLOSEIM=1 -DHAVE_SYS_IOCTL_H=1 -DTCL_CFG_OPTIMIZED=1 -DTCL_CFG_DEBUG=1 -DHAVE_INTTYPES_H=1 -DHAVE_TIMEGM=1 -DHAVE_POLL=1 -DHAVE_DRAND48=1 -DHAVE_RANDOM=1 -DHAVE_CMMSG=1 -DHAVE_GETADDRINFO=1 -DHAVE_GETNAMEINFO=1 -DHAVE_ZLIB_H=1 -DHAVE_LIBZ=1 -c -o nspostgres.o nspostgres.c
In file included from nspostgres.c:32:
nspostgres.h:48:22: libpq-fe.h: No such file or directory
In file included from nspostgres.c:32:
nspostgres.h:169: error: syntax error before "PGconn"
nspostgres.h:169: warning: no semicolon at end of struct or union
nspostgres.h:171: error: syntax error before '*' token
nspostgres.h:171: warning: data definition has no type or storage class
nspostgres.h:176: error: syntax error before '}' token
nspostgres.h:176: warning: data definition has no type or storage class
nspostgres.c: In function `Ns_PgOpenDb':
nspostgres.c:109: error: `nsConn' undeclared (first use in this function)
nspostgres.c:109: error: (Each undeclared identifier is reported only once
nspostgres.c:109: error: for each function it appears in.)
nspostgres.c:110: error: `PGconn' undeclared (first use in this function)
nspostgres.c:110: error: `pgConn' undeclared (first use in this function)
nspostgres.c:134: warning: implicit declaration of function `PQsetdbLogin'
nspostgres.c:142: warning: implicit declaration of function `PQstatus'
nspostgres.c:142: error: `CONNECTION_OK' undeclared (first use in this function)
nspostgres.c:164: warning: implicit declaration of function `PQerrorMessage'
nspostgres.c:165: warning: implicit declaration of function `PQfinish'
nspostgres.c: In function `Ns_PgCloseDb':
nspostgres.c:178: error: `nsConn' undeclared (first use in this function)
nspostgres.c: In function `Ns_PgSetErrorstate':
nspostgres.c:209: error: `nsConn' undeclared (first use in this function)
nspostgres.c:214: warning: implicit declaration of function `PQresultStatus'
nspostgres.c:215: error: `PGRES_EMPTY_QUERY' undeclared (first use in this function)
nspostgres.c:216: error: `PGRES_COMMAND_OK' undeclared (first use in this function)
nspostgres.c:217: error: `PGRES_TUPLES_OK' undeclared (first use in this function)
nspostgres.c:218: error: `PGRES_COPY_OUT' undeclared (first use in this function)
nspostgres.c:219: error: `PGRES_COPY_IN' undeclared (first use in this function)
nspostgres.c:220: error: `PGRES_NONFATAL_ERROR' undeclared (first use in this function)
nspostgres.c:221: warning: implicit declaration of function `PQresultErrorMessage'
nspostgres.c:221: warning: passing arg 2 of `Tcl_DStringAppend' makes pointer from integer without a cast
nspostgres.c:224: error: `PGRES_FATAL_ERROR' undeclared (first use in this function)
nspostgres.c:225: warning: passing arg 2 of `Tcl_DStringAppend' makes pointer from integer without a cast
nspostgres.c:228: error: `PGRES_BAD_RESPONSE' undeclared (first use in this function)
nspostgres.c:230: warning: passing arg 2 of `Tcl_DStringAppend' makes pointer from integer without a cast
nspostgres.c: In function `set_transaction_state':
nspostgres.c:244: error: `nsConn' undeclared (first use in this function)
nspostgres.c: In function `Ns_PgExec':
nspostgres.c:274: error: `nsConn' undeclared (first use in this function)
nspostgres.c:290: warning: implicit declaration of function `PQclear'
nspostgres.c:308: warning: implicit declaration of function `PQexec'
nspostgres.c:320: error: `CONNECTION_BAD' undeclared (first use in this function)
nspostgres.c:330: error: `PGRES_NONFATAL_ERROR' undeclared (first use in this function)
nspostgres.c:397: error: `PGRES_TUPLES_OK' undeclared (first use in this function)
nspostgres.c:401: error: `PGRES_COPY_IN' undeclared (first use in this function)
nspostgres.c:402: error: `PGRES_COPY_OUT' undeclared (first use in this function)
nspostgres.c:405: error: `PGRES_COMMAND_OK' undeclared (first use in this function)
nspostgres.c:407: warning: implicit declaration of function `PQcmdTuples'
nspostgres.c:407: warning: passing arg 1 of `sscanf' makes pointer from integer without a cast
nspostgres.c:413: warning: passing arg 3 of `Ns_DbSetException' makes pointer from integer without a cast
nspostgres.c: In function `Ns_PgResetHandle':
nspostgres.c:423: error: `nsConn' undeclared (first use in this function)
nspostgres.c:436: error: `PGRES_COMMAND_OK' undeclared (first use in this function)
nspostgres.c: In function `Ns_PgSelect':
nspostgres.c:461: error: `nsConn' undeclared (first use in this function)
nspostgres.c:478: error: `PGRES_TUPLES_OK' undeclared (first use in this function)
nspostgres.c:480: warning: implicit declaration of function `PQnfields'
nspostgres.c:481: warning: implicit declaration of function `PQntuples'
nspostgres.c:485: warning: implicit declaration of function `PQfname'
nspostgres.c: In function `Ns_PgGetRow':
nspostgres.c:506: error: `nsConn' undeclared (first use in this function)
nspostgres.c:534: warning: implicit declaration of function `PQgetvalue'
nspostgres.c: In function `Ns_PgFlush':
nspostgres.c:551: error: `nsConn' undeclared (first use in this function)
nspostgres.c: In function `Ns_PgTableList':
nspostgres.c:679: warning: passing arg 3 of `Tcl_DStringAppend' as signed due to prototype
nspostgres.c: In function `encode3':
nspostgres.c:749: warning: passing arg 1 of `enc_one' with different width due to prototype
nspostgres.c:750: warning: passing arg 1 of `enc_one' with different width due to prototype
nspostgres.c:751: warning: passing arg 1 of `enc_one' with different width due to prototype
nspostgres.c:752: warning: passing arg 1 of `enc_one' with different width due to prototype
nspostgres.c: In function `decode3':
nspostgres.c:772: warning: passing arg 1 of `get_one' with different width due to prototype
nspostgres.c:773: warning: passing arg 1 of `get_one' with different width due to prototype
nspostgres.c:774: warning: passing arg 1 of `get_one' with different width due to prototype
nspostgres.c:775: warning: passing arg 1 of `get_one' with different width due to prototype
nspostgres.c: In function `blob_get':
nspostgres.c:792: error: `nsConn' undeclared (first use in this function)
nspostgres.c:792: error: syntax error before ')' token
nspostgres.c:820: warning: assignment makes pointer from integer without a cast
nspostgres.c:821: warning: assignment makes pointer from integer without a cast
nspostgres.c: In function `stream_actually_write':
nspostgres.c:864: warning: passing arg 3 of `write' as unsigned due to prototype
nspostgres.c: In function `blob_send_to_stream':
nspostgres.c:977: error: `nsConn' undeclared (first use in this function)
nspostgres.c:977: error: syntax error before ')' token
nspostgres.c:1040: warning: assignment makes pointer from integer without a cast
nspostgres.c:1041: warning: assignment makes pointer from integer without a cast
nspostgres.c: In function `DbFail':
nspostgres.c:1116: error: `pgconn' undeclared (first use in this function)
nspostgres.c:1130: warning: assignment makes pointer from integer without a cast
nspostgres.c: In function `parse_bind_variables':
nspostgres.c:1211: warning: unused variable `first_bind'
nspostgres.c: In function `PgBindCmd':
nspostgres.c:1327: warning: unused variable `value_frag_len'
nspostgres.c: In function `PgCmd':
nspostgres.c:1524: error: `pgconn' undeclared (first use in this function)
nspostgres.c:1530: error: syntax error before ')' token
nspostgres.c:1601: warning: implicit declaration of function `PQdb'
nspostgres.c:1603: warning: implicit declaration of function `PQhost'
nspostgres.c:1605: warning: implicit declaration of function `PQoptions'
nspostgres.c:1607: warning: implicit declaration of function `PQport'
nspostgres.c:1614: error: `CONNECTION_OK' undeclared (first use in this function)
nspostgres.c: In function `Ns_PgBindRow':
nspostgres.c:1675: error: `nsConn' undeclared (first use in this function)
nspostgres.c:1691: error: `PGRES_TUPLES_OK' undeclared (first use in this function)
make: *** [nspostgres.o] Error 1

Collapse
Posted by Vinod Kurup on
Hi,

It's having trouble finding the postgresql headers, specifically libpq-fe.h. You have to figure out where on your distro this file is located.

On Debian, it's in /usr/include/postgresql , so in the Makefile, I set:

PGINC = /usr/include/postgresql

You may also have to change PGLIB to point to the Postgresql shared libraries on your distro. On Debian, I use:

PGLIB = /usr/lib/postgresql/lib

Good luck!

Also you in command:

make install POSTGRES=LSB ACS=1 INST=/usr/local/aolserver40r10 AOLSERVER=/usr/local/aolserver40r10

you can change LSB by correct path, in my case right command was:

make install POSTGRES=/usr/local/pgsql ACS=1 INST=/usr/local/aolserver-VERSION AOLSERVER=/usr/local/aolserver-VERSION