Forum OpenACS Q&A: compiling nspostgres

Collapse
Posted by bill kellerman on
I'm trying to get openacs installed on mac os 10.2.6.

Aolserver beta10, openacs4.6.3, postgresql 7.3.4, nspostgres 4beta1.

I've been able to compile everything I need except for nspostgres.  I've been messing with it for a while, I've searched all the docs I can find, but I don't know enough to troubleshoot why it isn't working.

I'd appreciate any help, or even a link to a precompiled version.  Thanks ahead of time.

Here is the output of running make:

[derek:local/src/nspostgres-4.0beta1] derek% make INST=/usr/local/aolserver/ POSTGRES=/usr/local/pgsql ACS=1

gcc -pipe -DBIND_EMULATION -I/usr/local/pgsql/include -DFOR_ACS_USE -Os -Wall -Wconversion -Wno-implicit-int -fno-common -DMAC_OSX_TCL -DHAVE_CFBUNDLE -DUSE_VFORK -DTCL_DEFAULT_ENCODING=\"utf-8\" -I/usr/local/aolserver/include -I/Library/Frameworks/Tcl.framework/Versions/8.4/Headers -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_READDIR_R=1 -DTCL_WIDE_INT_TYPE=long\ long -DWORDS_BIGENDIAN=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 -DNO_VALUES_H=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_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -Dsocklen_t=unsigned -DHAVE_SIGNED_CHAR=1 -DHAVE_PUTENV_THAT_COPIES=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_FILIO_H=1  -DHAVE_TIMEGM=1 -DHAVE_DRAND48=1 -DHAVE_RANDOM=1 -DHAVE__NSGETENVIRON=1 -DUSE_DYLD=1 -DHAVE_CMMSG=1    -c -o nspostgres.o nspostgres.c
nspostgres.c: In function `Ns_PgTableList':
nspostgres.c:678: warning: passing arg 3 of `Tcl_DStringAppend' as signed due to prototype
nspostgres.c: In function `encode3':
nspostgres.c:748: warning: passing arg 1 of `enc_one' with different width due to prototype
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: In function `decode3':
nspostgres.c:771: warning: passing arg 1 of `get_one' with different width due to prototype
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: In function `stream_actually_write':
nspostgres.c:863: warning: passing arg 3 of `write' as unsigned due to prototype
nspostgres.c: In function `blob_send_to_stream':
nspostgres.c:979: warning: `fd' might be used uninitialized in this function
nspostgres.c:981: warning: `conn' might be used uninitialized in this function
nspostgres.c: In function `parse_bind_variables':
nspostgres.c:1210: warning: unused variable `first_bind'
nspostgres.c: In function `PgBindCmd':
nspostgres.c:1326: warning: unused variable `value_frag_len'
/bin/rm -f nspostgres.so
cc -bundle -L/usr/local/aolserver/lib -o nspostgres.so nspostgres.o -L/usr/local/pgsql/lib -lpq -lcrypto -lssl -lnsthread -lnsd -framework Tcl  -lpthread -framework CoreFoundation
ld: Undefined symbols:
_Ns_Db0or1Row
_Ns_Db1Row
_Ns_DbDML
_Ns_DbDriverName
_Ns_DbExec
_Ns_DbGetRow
_Ns_DbRegisterDriver
_Ns_DbSelect
_Ns_TclDbGetHandle
make: *** [nspostgres.so] Error 1

Collapse
2: Re: compiling nspostgres (response to 1)
Posted by russ m on
AOLServer4 has split DB support out into a separate library, which the nspostgres Makefile doesn't yet know about - you'll need to find the MODLIBS line under the "Libraries required by this module" section heading and change it from
MODLIBS = -L$(PGLIB) -lpq
to
MODLIBS = -L$(PGLIB) -lpq -lnsdb
Collapse
3: Re: compiling nspostgres (response to 2)
Posted by bill kellerman on
craop!  it worked!

i've been messing with this for so long...  THANKS!

Collapse
4: Re: compiling nspostgres (response to 1)
Posted by bill kellerman on
again, thanks for the help everyone (russell, barry).

a wierd thing -- i've been able to compile the nspostgres 4beta driver on redhat linux 7.3 with no trouble.  the problem i refer to in this post was on os x specifically.

is there a specific reason for that?  just in case someone else has this problem in the future...

Collapse
5: Re: compiling nspostgres (response to 1)
Posted by Barry Books on
I think it's an AOL 4.0 feature. The db libs are moved into thier own shared lib. Are you running AOL 4.0 on linux?
Collapse
6: Re: compiling nspostgres (response to 5)
Posted by bill kellerman on
i have two separate installations of aolserver:
- one on macosx with the stuff from the first post and openacs (which is now up and running)
- the second is redhat 7.3, postgresql 7.2.3, aolserver 4beta10, nspostgres4beta1 (no openacs)

i was able to compile nspostgres4 on linux with no problems.  on os x, however, i had to add the modlib flag russel mentioned.

i don't know if it would compile on one versus the other because of something operating system-specific, or because of the different versions of postgresql...?

Collapse
7: Re: compiling nspostgres (response to 1)
Posted by Phillip Harrington on
Hello,

I hope to God someone picks this reply up in "new responses." I've been trying to get nspostgres to compile and I can't. I did the MODLIBS hack mentioned above (since I'm using AOLserver 4).

#MODLIBS  = -L$(PGLIB) -lpq
MODLIBS  = -L$(PGLIB) -lpq -lnsdb

Anyway when I run:
# make INST=/usr/local/aolserver/ POSTGRES=/usr/local/pgsql ACS=1

I get a bunch of errors like below (this isn't the top of the errors unfortunately PuTTY's buffer for copy/paste craps out):

I'm on Red Hat 7.3 posgresql 7.4 and aolserver 4.

nspostgres.h:157: warning: (near initialization for `PgProcs[11]')
nspostgres.h:157: warning: excess elements in scalar initializer
nspostgres.h:157: warning: (near initialization for `PgProcs[11]')
nspostgres.h:158: warning: data definition has no type or storage class
nspostgres.c: In function `Ns_DbDriverInit':
nspostgres.c:49: warning: implicit declaration of function `Ns_DbRegisterDriver'
nspostgres.c: At top level:
nspostgres.c:88: parse error before `*'
nspostgres.c:97: parse error before `*'
nspostgres.c:106: parse error before `*'
nspostgres.c: In function `Ns_PgOpenDb':
nspostgres.c:116: `handle' undeclared (first use in this function)
nspostgres.c:116: (Each undeclared identifier is reported only once
nspostgres.c:116: for each function it appears in.)
nspostgres.c:158: `NS_DML' undeclared (first use in this function)
nspostgres.c: At top level:
nspostgres.c:175: parse error before `*'
nspostgres.c: In function `Ns_PgCloseDb':
nspostgres.c:180: `handle' undeclared (first use in this function)
nspostgres.c: At top level:
nspostgres.c:207: parse error before `*'
nspostgres.c: In function `Ns_PgSetErrorstate':
nspostgres.c:209: `handle' undeclared (first use in this function)
nspostgres.c: At top level:
nspostgres.c:243: parse error before `*'
nspostgres.c: In function `set_transaction_state':
nspostgres.c:244: `handle' undeclared (first use in this function)
nspostgres.c:245: `sql' undeclared (first use in this function)
nspostgres.c:248: `asfuncname' undeclared (first use in this function)
nspostgres.c: At top level:
nspostgres.c:272: parse error before `*'
nspostgres.c: In function `Ns_PgExec':
nspostgres.c:278: `sql' undeclared (first use in this function)
nspostgres.c:283: `handle' undeclared (first use in this function)
nspostgres.c:399: `NS_ROWS' undeclared (first use in this function)
nspostgres.c:403: `NS_DML' undeclared (first use in this function)
nspostgres.c:416: warning: control reaches end of non-void function
nspostgres.c: At top level:
nspostgres.c:420: parse error before `*'
nspostgres.c: In function `Ns_PgResetHandle':
nspostgres.c:424: `handle' undeclared (first use in this function)
nspostgres.c: At top level:
nspostgres.c:456: parse error before `*'
nspostgres.c: In function `Ns_PgSelect':
nspostgres.c:463: `handle' undeclared (first use in this function)
nspostgres.c:468: `sql' undeclared (first use in this function)
nspostgres.c: At top level:
nspostgres.c:502: parse error before `*'
nspostgres.c: In function `Ns_PgGetRow':
nspostgres.c:508: `handle' undeclared (first use in this function)
nspostgres.c:513: `row' undeclared (first use in this function)
nspostgres.c:529: `NS_END_DATA' undeclared (first use in this function)
nspostgres.c: At top level:
nspostgres.c:547: parse error before `*'
nspostgres.c: In function `Ns_PgFlush':
nspostgres.c:552: `handle' undeclared (first use in this function)
nspostgres.c: At top level:
nspostgres.c:574: parse error before `*'
nspostgres.c:575: parse error before `*'
nspostgres.c:575: warning: return type defaults to `int'
nspostgres.c: In function `Ns_PgGetTableInfo':
nspostgres.c:580: `Ns_DbTableInfo' undeclared (first use in this function)
nspostgres.c:580: `tinfo' undeclared (first use in this function)
nspostgres.c:580: invalid lvalue in assignment
nspostgres.c:581: parse error before `int'
nspostgres.c:585: `handle' undeclared (first use in this function)
nspostgres.c:590: `table' undeclared (first use in this function)
nspostgres.c:606: `status' undeclared (first use in this function)
nspostgres.c:607: `name' undeclared (first use in this function)
nspostgres.c:608: `type' undeclared (first use in this function)
nspostgres.c:630: `NS_END_DATA' undeclared (first use in this function)
nspostgres.c:637: warning: control reaches end of non-void function
nspostgres.c: At top level:
nspostgres.c:643: parse error before `Ns_DbHandle'
nspostgres.c: In function `Ns_PgTableList':
nspostgres.c:651: `pds' undeclared (first use in this function)
nspostgres.c:656: `handle' undeclared (first use in this function)
nspostgres.c:664: `fSystemTables' undeclared (first use in this function)
nspostgres.c:672: warning: implicit declaration of function `Ns_DbGetRow'
nspostgres.c:678: warning: passing arg 3 of `Tcl_DStringAppend' as signed due to prototype
nspostgres.c:682: `NS_END_DATA' undeclared (first use in this function)
nspostgres.c: In function `encode3':
nspostgres.c:748: warning: passing arg 1 of `enc_one' with different width due to prototype
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: In function `decode3':
nspostgres.c:771: warning: passing arg 1 of `get_one' with different width due to prototype
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: At top level:
nspostgres.c:789: parse error before `Ns_DbHandle'
nspostgres.c: In function `blob_get':
nspostgres.c:791: `handle' undeclared (first use in this function)
nspostgres.c:800: `lob_id' undeclared (first use in this function)
nspostgres.c:812: `NS_ROWS' undeclared (first use in this function)
nspostgres.c:813: `interp' undeclared (first use in this function)
nspostgres.c: In function `stream_actually_write':
nspostgres.c:863: warning: passing arg 3 of `write' as unsigned due to prototype
nspostgres.c: At top level:
nspostgres.c:876: parse error before `Ns_DbHandle'
nspostgres.c: In function `blob_put':
nspostgres.c:883: `value' undeclared (first use in this function)
nspostgres.c:887: `blob_id' undeclared (first use in this function)
nspostgres.c:900: `handle' undeclared (first use in this function)
nspostgres.c:900: `NS_DML' undeclared (first use in this function)
nspostgres.c:901: `interp' undeclared (first use in this function)
nspostgres.c:881: warning: `value_ptr' might be used uninitialized in this function
nspostgres.c: At top level:
nspostgres.c:916: parse error before `Ns_DbHandle'
nspostgres.c: In function `blob_dml_file':
nspostgres.c:923: `filename' undeclared (first use in this function)
nspostgres.c:929: `interp' undeclared (first use in this function)
nspostgres.c:935: `blob_id' undeclared (first use in this function)
nspostgres.c:947: `handle' undeclared (first use in this function)
nspostgres.c:947: `NS_DML' undeclared (first use in this function)
nspostgres.c: At top level:
nspostgres.c:973: parse error before `Ns_DbHandle'
nspostgres.c: In function `blob_send_to_stream':
nspostgres.c:976: `handle' undeclared (first use in this function)
nspostgres.c:983: `to_conn_p' undeclared (first use in this function)
nspostgres.c:985: `interp' undeclared (first use in this function)
nspostgres.c:996: `filename' undeclared (first use in this function)
nspostgres.c:1020: `lob_id' undeclared (first use in this function)
nspostgres.c:1032: `NS_ROWS' undeclared (first use in this function)
nspostgres.c:979: warning: `fd' might be used uninitialized in this function
nspostgres.c: At top level:
nspostgres.c:1113: parse error before `Ns_DbHandle'
nspostgres.c: In function `DbFail':
nspostgres.c:1115: `handle' undeclared (first use in this function)
nspostgres.c:1118: `interp' undeclared (first use in this function)
nspostgres.c:1118: `cmd' undeclared (first use in this function)
nspostgres.c:1135: `sql' undeclared (first use in this function)
nspostgres.c: In function `parse_bind_variables':
nspostgres.c:1210: warning: unused variable `first_bind'
nspostgres.c: In function `PgBindCmd':
nspostgres.c:1319: `Ns_DbHandle' undeclared (first use in this function)
nspostgres.c:1319: `handle' undeclared (first use in this function)
nspostgres.c:1319: warning: statement with no effect
nspostgres.c:1320: parse error before `*'
nspostgres.c:1333: warning: implicit declaration of function `Ns_TclDbGetHandle'
nspostgres.c:1345: warning: implicit declaration of function `Ns_DbDriverName'
nspostgres.c:1345: warning: comparison between pointer and integer
nspostgres.c:1351: `cmd' undeclared (first use in this function)
nspostgres.c:1354: `set' undeclared (first use in this function)
nspostgres.c:1359: `sql' undeclared (first use in this function)
nspostgres.c:1391: `value' undeclared (first use in this function)
nspostgres.c:1426: `p' undeclared (first use in this function)
nspostgres.c:1461: warning: implicit declaration of function `Ns_DbDML'
nspostgres.c:1465: `rowPtr' undeclared (first use in this function)
nspostgres.c:1465: warning: implicit declaration of function `Ns_Db1Row'
nspostgres.c:1474: warning: implicit declaration of function `Ns_Db0or1Row'
nspostgres.c:1485: warning: implicit declaration of function `Ns_DbSelect'
nspostgres.c:1492: warning: implicit declaration of function `Ns_DbExec'
nspostgres.c:1493: `NS_DML' undeclared (first use in this function)
nspostgres.c:1496: `NS_ROWS' undeclared (first use in this function)
nspostgres.c:1494: warning: unreachable code at beginning of switch statement
nspostgres.c: In function `PgCmd':
nspostgres.c:1522: `Ns_DbHandle' undeclared (first use in this function)
nspostgres.c:1522: `handle' undeclared (first use in this function)
nspostgres.c:1522: warning: statement with no effect
nspostgres.c:1523: parse error before `*'
nspostgres.c:1529: `pgconn' undeclared (first use in this function)
nspostgres.c:1535: warning: comparison between pointer and integer
nspostgres.c: At top level:
nspostgres.c:1670: parse error before `*'
nspostgres.c: In function `Ns_PgBindRow':
nspostgres.c:1677: `handle' undeclared (first use in this function)
nspostgres.c: At top level:
nspostgres.c:1750: parse error before `Ns_DbTableInfo'
nspostgres.c: In function `pg_get_column_index':
nspostgres.c:1755: `interp' undeclared (first use in this function)
nspostgres.c:1755: `indexStr' undeclared (first use in this function)
nspostgres.c:1755: warning: passing arg 3 of `Tcl_GetInt' from incompatible pointer type
nspostgres.c:1760: `tinfo' undeclared (first use in this function)
nspostgres.c: In function `pg_column_command':
nspostgres.c:1786: `Ns_DbHandle' undeclared (first use in this function)
nspostgres.c:1786: `handle' undeclared (first use in this function)
nspostgres.c:1786: warning: statement with no effect
nspostgres.c:1787: `Ns_DbTableInfo' undeclared (first use in this function)
nspostgres.c:1787: `tinfo' undeclared (first use in this function)
nspostgres.c:1787: invalid lvalue in assignment
nspostgres.c:1788: parse error before `int'
nspostgres.c:1831: `colindex' undeclared (first use in this function)
nspostgres.c: In function `pg_table_command':
nspostgres.c:1949: `Ns_DbHandle' undeclared (first use in this function)
nspostgres.c:1949: `handle' undeclared (first use in this function)
nspostgres.c:1949: warning: statement with no effect
nspostgres.c: At top level:
nspostgres.c:2072: parse error before `*'
nspostgres.c:2074: warning: return type defaults to `int'
nspostgres.c: In function `Ns_DbNewTableInfo':
nspostgres.c:2075: `Ns_DbTableInfo' undeclared (first use in this function)
nspostgres.c:2075: `tinfo' undeclared (first use in this function)
nspostgres.c:2075: warning: statement with no effect
nspostgres.c:2086: warning: control reaches end of non-void function
nspostgres.c: At top level:
nspostgres.c:2091: parse error before `*'
nspostgres.c: In function `Ns_DbAddColumnInfo':
nspostgres.c:2093: `tinfo' undeclared (first use in this function)
nspostgres.c:2101: `column_info' undeclared (first use in this function)
nspostgres.c: At top level:
nspostgres.c:2108: parse error before `*'
nspostgres.c: In function `Ns_DbFreeTableInfo':
nspostgres.c:2112: `tinfo' undeclared (first use in this function)
nspostgres.c: At top level:
nspostgres.c:2128: parse error before `*'
nspostgres.c: In function `Ns_DbColumnIndex':
nspostgres.c:2133: `tinfo' undeclared (first use in this function)
nspostgres.c:2136: `name' undeclared (first use in this function)
make: *** [nspostgres.o] Error 1

Collapse
8: Re: compiling nspostgres (response to 7)
Posted by Phillip Harrington on
I ended up using nspostgres 40beta1 and got it to compile. Thanks for the help everyone (offline emails 😃)!

Phil

Collapse
9: Re: compiling nspostgres (response to 1)
Posted by Chris Rasch on
I'm trying to install the latest OpenACS on Mac OS X 10.3.2 (Panther).  However, I'm having trouble getting nspostgres to compile.  Any suggestions would be gratefully accepted.  So far, I believe I've successfully compiled and installed the following:

Mac OS X, 10.3.2 (Panther)
AOLserver 4.0.1
PG 7.4.1
Tcl 8.4.5
nscache-1.5
nssha1-0.1

Home directories of postgres and aolserver respectively:

POSTGRES = /usr/local/pgsql
NSHOME = /usr/local/aolserver

make version: GNU Make version 3.79, Built for powerpc-apple-darwin7.0

I downloaded and untarred nspostgres-4.0beta1 into my /usr/local/aolserver/ directory.

I edited this line in the Makefile from this:

# MODLIBS  = -L$(PGLIB) -lpq

to this:

MODLIBS  = -L$(PGLIB) -lpq -lnsdb

(Per Russell Muetzelfeldt's suggestion above)

However, when I issue the command:

$ make POSTGRES=/usr/local/pgsql INST=/usr/local/aolserver ACS=1

I get the following error message:

gcc -pipe -DBIND_EMULATION -I/usr/local/pgsql/include -DFOR_ACS_USE -Os -Wall -Wconversion -Wno-implicit-int -fno-common -DMAC_OSX_TCL -DHAVE_CFBUNDLE -DUSE_VFORK -DTCL_DEFAULT_ENCODING=\"utf-8\" -I/usr/local/aolserver/include -I/usr/local/aolserver/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_READDIR_R=1 -DTCL_WIDE_INT_TYPE=long\ long -DWORDS_BIGENDIAN=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 -DNO_VALUES_H=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_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_PUTENV_THAT_COPIES=1 -DHAVE_LANGINFO=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_FILIO_H=1  -DHAVE_TIMEGM=1 -DHAVE_POLL=1 -DHAVE_DRAND48=1 -DHAVE_RANDOM=1 -DHAVE__NSGETENVIRON=1 -DUSE_DYLD=1 -DHAVE_CMMSG=1    -c -o nspostgres.o nspostgres.c
nspostgres.c: In function `Ns_PgTableList':
nspostgres.c:678: warning: passing arg 3 of `Tcl_DStringAppend' as signed due to prototype
nspostgres.c: In function `encode3':
nspostgres.c:748: warning: passing arg 1 of `enc_one' with different width due to prototype
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: In function `decode3':
nspostgres.c:771: warning: passing arg 1 of `get_one' with different width due to prototype
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: In function `stream_actually_write':
nspostgres.c:863: warning: passing arg 3 of `write' as unsigned due to prototype
nspostgres.c: In function `blob_send_to_stream':
nspostgres.c:979: warning: `fd' might be used uninitialized in this function
nspostgres.c:981: warning: `conn' might be used uninitialized in this function
nspostgres.c: In function `parse_bind_variables':
nspostgres.c:1210: warning: unused variable `first_bind'
nspostgres.c: In function `PgBindCmd':
nspostgres.c:1326: warning: unused variable `value_frag_len'
/bin/rm -f nspostgres.so
cc -bundle -L/usr/local/aolserver/lib -o nspostgres.so nspostgres.o -L/usr/local/pgsql/lib -lpq -lnsdb -lnsthread -lnsd -L/usr/local/aolserver/lib -ltcl8.4  -lpthread -framework CoreFoundation
ld: Undefined symbols:
_SSL_pending
_BIO_free
_BIO_new_mem_buf
_DH_check
_DH_generate_parameters
_DH_size
_ERR_get_error
_ERR_reason_error_string
_EVP_PKEY_free
_PEM_read_DHparams
_PEM_read_PrivateKey
_PEM_read_X509
_PEM_read_bio_DHparams
_SSL_CTX_ctrl
_SSL_CTX_free
_SSL_CTX_load_verify_locations
_SSL_CTX_new
_SSL_CTX_set_tmp_dh_callback
_SSL_CTX_set_verify
_SSL_CTX_set_verify_depth
_SSL_connect
_SSL_free
_SSL_get_error
_SSL_get_ex_data
_SSL_get_peer_certificate
_SSL_library_init
_SSL_load_error_strings
_SSL_new
_SSL_read
_SSL_set_ex_data
_SSL_set_fd
_SSL_shutdown
_SSL_write
_TLSv1_method
_X509_NAME_get_text_by_NID
_X509_NAME_oneline
_X509_check_private_key
_X509_free
_X509_get_subject_name
make: *** [nspostgres.so] Error 1

Collapse
10: Re: compiling nspostgres (response to 9)
Posted by russ m on
Chris,

It looks like it's trying to link against OpenSSL but can't find the correct libraries - I'm guessing you built your postgres with SSL support.

Try changing the modlibs line to

MODLIBS  = -L$(PGLIB) -lpq -lnsdb -lssl

Collapse
11: Re: compiling nspostgres (response to 1)
Posted by Chris Rasch on
Russell,

I did compile Postgres with OpenSSL support.  Here's the configure line I used:

./configure --with-includes=/sw/include --with-libs=/sw/lib --with-openssl --with-python --with-perl

I tried adding the line you suggested.  This time, I got the following error when I tried to compile nspostgres:

dhcp232:/usr/local/src/aolserver/nspostgres-4.0beta1 chris$ make POSTGRES=/usr/local/pgsql INST=/usr/local/aolserver ACS=1
gcc -pipe -DBIND_EMULATION -I/usr/local/pgsql/include -DFOR_ACS_USE -Os -Wall -Wconversion -Wno-implicit-int -fno-common -DMAC_OSX_TCL -DHAVE_CFBUNDLE -DUSE_VFORK -DTCL_DEFAULT_ENCODING=\"utf-8\" -I/usr/local/aolserver/include -I/usr/local/aolserver/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_READDIR_R=1 -DTCL_WIDE_INT_TYPE=long\ long -DWORDS_BIGENDIAN=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 -DNO_VALUES_H=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_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_PUTENV_THAT_COPIES=1 -DHAVE_LANGINFO=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_FILIO_H=1  -DHAVE_TIMEGM=1 -DHAVE_POLL=1 -DHAVE_DRAND48=1 -DHAVE_RANDOM=1 -DHAVE__NSGETENVIRON=1 -DUSE_DYLD=1 -DHAVE_CMMSG=1    -c -o nspostgres.o nspostgres.c
nspostgres.c: In function `Ns_PgTableList':
nspostgres.c:678: warning: passing arg 3 of `Tcl_DStringAppend' as signed due to prototype
nspostgres.c: In function `encode3':
nspostgres.c:748: warning: passing arg 1 of `enc_one' with different width due to prototype
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: In function `decode3':
nspostgres.c:771: warning: passing arg 1 of `get_one' with different width due to prototype
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: In function `stream_actually_write':
nspostgres.c:863: warning: passing arg 3 of `write' as unsigned due to prototype
nspostgres.c: In function `blob_send_to_stream':
nspostgres.c:979: warning: `fd' might be used uninitialized in this function
nspostgres.c:981: warning: `conn' might be used uninitialized in this function
nspostgres.c: In function `parse_bind_variables':
nspostgres.c:1210: warning: unused variable `first_bind'
nspostgres.c: In function `PgBindCmd':
nspostgres.c:1326: warning: unused variable `value_frag_len'
/bin/rm -f nspostgres.so
cc -bundle -L/usr/local/aolserver/lib -o nspostgres.so nspostgres.o -L/usr/local/pgsql/lib -lpq -lnsdb -lssl -lnsthread -lnsd -L/usr/local/aolserver/lib -ltcl8.4  -lpthread -framework CoreFoundation
ld: /usr/local/pgsql/lib/libpq.a(fe-secure.o) illegal reference to symbol: _BIO_free defined in indirectly referenced dynamic library /usr/lib/libcrypto.0.9.7.dylib
make: *** [nspostgres.so] Error 1

Collapse
12: Re: compiling nspostgres (response to 11)
Posted by russ m on
Chris,

Well the first thing to try woud be adding a "-lcrypto" to the MODLIBS line, but that error message almost looks like there's a problem in how libpq was built (it looks like it's complaining about not having a direct reference to the BIO_free symbol, which would have been set when libpq.a was built).

Do you actually need SSL inside your database? The quick and dirty solution is to rebuild PG without SSL, since that seems to be the source of these problems...

Another thing to try would be to rename all the libpq.so.whatever files under /usr/local/pgsql/lib to libpq.dylib.whatever and rebuild nspostgres - that might let nspostgres link to the shared rather than static version of libpq, which might fix the problem with indirect references. In which case the problem is with the postgres build scripts for using the wrong extension for shared libraries on OSX...

Collapse
13: Re: compiling nspostgres (response to 1)
Posted by Michael Cordova on
I'm trying to install OpenACS 5.4 with AOLserver 4.5 on Mac OS X 10.5 (Leopard). The mac doc is a bit outdated on openacs.org. I'm following the cognovis.de guide.

When compiling nspostgres (and after fixing some other bugs, like -lnsdb flag),
/usr/local/src/aolserver45/nspostgres# make POSTGRES=$PG ACS=1 NSHOME=${NS}
I'm getting that error:

ar rv libnspostgres.a
ar: no archive members specified
usage:  ar -d [-TLsv] archive file ...
        ar -m [-TLsv] archive file ...
        ar -m [-abiTLsv] position archive file ...
        ar -p [-TLsv] archive [file ...]
        ar -q [-cTLsv] archive file ...
        ar -r [-cuTLsv] archive file ...
        ar -r [-abciuTLsv] position archive file ...
        ar -t [-TLsv] archive [file ...]
        ar -x [-ouTLsv] archive [file ...]
make: *** [libnspostgres.a] Error 1
/usr/local/src/aolserver45/nspostgres#

I've also tried:
/usr/local/src/aolserver45/nspostgres# make install POSTGRES=$PG ACS=1 AOLSERVER=/usr/local/aolserver

/usr/local/aolserver/bin/tclsh8.4 /usr/local/aolserver/bin/nsinstall.tcl -d /usr/local/aolserver/bin -e nspostgres.so
installed: /usr/local/aolserver45/bin/nspostgres.so (0755)
/usr/local/aolserver/bin/tclsh8.4 /usr/local/aolserver/bin/nsinstall.tcl -d /usr/local/aolserver/lib -e libnspostgres.dylib
installed: /usr/local/aolserver45/lib/libnspostgres.dylib (0755)
/usr/local/aolserver/bin/tclsh8.4 /usr/local/aolserver/bin/nsinstall.tcl -d /usr/local/aolserver/lib libnspostgres.a
ranlib /usr/local/aolserver/lib/libnspostgres.a
ranlib: can't open file: /usr/local/aolserver/lib/libnspostgres.a (No such file or directory)
make: *** [install-dll] Error 1
/usr/local/src/aolserver45/nspostgres#

But can't fix that.

Collapse
14: Re: compiling nspostgres (response to 13)
Posted by Michael Cordova on
Trying
/usr/local/src/aolserver45/nspostgres# make install POSTGRES=$PG ACS=1 INST=/usr/local/aolserver
I get that error:
/usr/local/aolserver -d /usr/local/aolserver/bin -e nspostgres.so
make: execvp: /usr/local/aolserver: Permission denied
make: *** [install-mod] Error 127
Even after doing /usr/local/src/aolserver45/nspostgres# chmod -R +w /usr/local/aolserver I get the same error.

I feel completely lost.

Collapse
Posted by Raúl Morales Hidalgo on
ar options in OS X are with a dash "-" I guess you'll have to correct that in your Makefile
Collapse
Posted by Cesareo Garci­a Rodicio on
This is old but to ease problems with PG building.

Now I'm on Mac OS X Mountain Lion and nspostgres from Aolserver git.

I don't know how to solve this errors BUT a solution that worked for me is:
- Don't forget to add -lnsdb in Makefile
- Do make file (set ACS and POSGTGRES approprieately)
- You will get these errors
- Forget that and copy that nspostgres.so, that it has been created in that directory, in aolserver/bin

And it works!

Collapse
17: Re: compiling nspostgres (response to 1)
Posted by Jim Lynch on
Hu,

I added to the build system in aolserver nspostgres...

I added POSTGRESQL = SEPARATELY PGLIB = /some/path/lib PGINC = /some/where/include

And, POSTGRESQL = PG_CONFIG (in which case pg_config is the first one found in the $PATH)

And, POSTGRESQL = PG_CONFIG PG_CONFIG = /usr/some/where/bin/pg_config (so you can select which of many postgreses you want)

Read the Makefile, read the README... and finally, I ask a favor:

If you are having any problems compiling nspostgres with my buildtime extensions and you have not altered files, I'd be interested in seeing what your issue is so I can try to correct it.

Thanks

-Jim

Collapse
18: Re: compiling nspostgres (response to 17)
Posted by Jim Lynch on
Hmm, let me correct some things...

Note additions to build system (made in 2007):

- make POSTGRES=SEPARATELY PGINC=... PGLIB=...
- make POSTGRES=PG_CONFIG
- make POSTGRES=PG_CONFIG PG_CONFIG=/path/to/pg_config

NOTE NOTE NOTE!! As of aolserver-4.5.x, the variable INST is used for a different purpose than it used to be, so DO NOT set it to the installation dir!!

Finally, here is an example make command that is used to build a real nspostgres against a debian-installed postgres for an aolserver-4.5.1:

make ACS=1 AOLSERVER=/home/someuser/inst/ POSTGRES=PG_CONFIG PG_CONFIG=/usr/lib/postgresql/8.1/bin/pg_config install

where

someuser is the user that aolserver runs as and compiled as,

/home/someuser/inst is where tcl, aolserver, nspostgres, xotcl, tdom and a few other things are (i.e., their prefix)

and finally

/usr/lib/postgresql/8.1/bin/pg_config is where to find debian's packaging of postgres-8.1.

Collapse
19: Re: compiling nspostgres (response to 1)
Posted by Jim Lynch on
Heya Bill,

Just checking in... did you get nspostgres going?

-Jim

Collapse
Posted by Cesareo Garci­a Rodicio on
I don't know how to solve this error BUT a solution that worked for me was:
- Don't forget to add -lnsdb in Makefile
- Do make file (set ACS and POSGTGRES appropriately)
- You will get those errors
- Forget about that and copy nspostgres.so ( that it has been created in that directory) in aolserver/bin

That worked for me