Alexander Farber wrote:
> Hello,
>
> I'm trying to compile a libpq program under Debian 3.1r2 with these
> packages installed:
>
> $ dpkg -l | grep postgres
> ii postgresql 7.4.7-6sarge2 object-relational SQL database
> management sy
> ii postgresql-cli 7.4.7-6sarge2 front-end programs for PostgreSQL
> ii postgresql-con 7.4.7-6sarge2 additional facilities for PostgreSQL
> ii postgresql-dev 7.4.7-6sarge2 development files for libpq
> (PostgreSQL libr
> ii postgresql-doc 7.4.7-6sarge2 documentation for the PostgreSQL
> database ma
>
> That program compiles and works fine with OpenBSD
> and Cygwin (I'm using PostgreSQL 8.x there though...)
>
> On Debian it unfortunately doesn't link:
>
> $ gcc build/pref.o build/message.o build/pgsql.o build/user.o
> build/util.o build/table.o build/common.o build/array.o
> build/xstring.o build/strlcpy.o build/strlcat.o build/daemon.o -o pref
> -L /usr/lib -L /usr/lib/postgresql/lib -lpq
> build/pgsql.o(.text+0x15b): In function `db_prepare':
> server/pgsql.c:57: undefined reference to `PQprepare'
> collect2: ld returned 1 exit status
>
> $ pg_config --version
> PostgreSQL 7.4.7
>
> $ pg_config --libdir
> /usr/lib
>
> $ objdump -x /usr/lib/libpq.a | grep -i PQprepare
> 00000000 *UND* 00000000 pqPrepareAsyncResult
> 00001974 R_386_PLT32 pqPrepareAsyncResult
> 00000490 g F .text 0000007d pqPrepareAsyncResult
> 000012e5 R_386_PLT32 pqPrepareAsyncResult
> 0000130a R_386_PLT32 pqPrepareAsyncResult
> 00000000 *UND* 00000000 pqPrepareAsyncResult
> 00001841 R_386_PLT32 pqPrepareAsyncResult
>
> There are very few hits for the "undefined reference PQprepare"
> on Google (which I take a good sign :-)
>
> Does anybody have an idea please, what could I be doing wrong?
there is no PQprepare in 7.4 - it got introduced in 8.0 (it is not
mentioned in the 7.4 manual either) ...
Stefan