Thread: linking error
I am running Redhat linux (2.0.34) and postgreSQL 6.3.2. I'm trying to use the C-interface via libpq, but I'm having linking problems. The following is the result when attempting to compile sample1 from the postgres libpq documentation: [rbarrett@localhost rbarrett]$ gcc -O3 -Wall sample1.c -I /usr/local/pgsql/include/ -L /usr/local/pgsql/lib/ -lpq /usr/local/pgsql/lib//libpq.a(fe-auth.o): In function `pg_password_sendauth': fe-auth.o(.text+0x17): undefined reference to `crypt' Does anyone know how I can fix this? Need I upgrade to 6.4? Thanks, Randy Barrett
"Randall W. Barrett" <rbarr@shadow.net> writes: > [rbarrett@localhost rbarrett]$ gcc -O3 -Wall sample1.c -I > /usr/local/pgsql/include/ -L /usr/local/pgsql/lib/ -lpq > /usr/local/pgsql/lib//libpq.a(fe-auth.o): In function > `pg_password_sendauth': > fe-auth.o(.text+0x17): undefined reference to `crypt' > Does anyone know how I can fix this? Need I upgrade to 6.4? For the moment you should be able to fix it by adding -lcrypt to the end of the gcc command. I've been trying to fix things so that it's not necessary to do that ... but it's proving very hard to make it work properly everywhere :-(. Cross-references between shared libraries seem not to be very portable on Unix systems yet. regards, tom lane
Tom, Thanks. Randy Barrett On Fri, 11 Dec 1998, Tom Lane wrote: > "Randall W. Barrett" <rbarr@shadow.net> writes: > > [rbarrett@localhost rbarrett]$ gcc -O3 -Wall sample1.c -I > > /usr/local/pgsql/include/ -L /usr/local/pgsql/lib/ -lpq > > > /usr/local/pgsql/lib//libpq.a(fe-auth.o): In function > > `pg_password_sendauth': > > fe-auth.o(.text+0x17): undefined reference to `crypt' > > > Does anyone know iqqhow I can fix this? Need I upgrade to 6.4? > > For the moment you should be able to fix it by adding -lcrypt to > the end of the gcc command. I've been trying to fix things so that > it's not necessary to do that ... but it's proving very hard to > make it work properly everywhere :-(. Cross-references between > shared libraries seem not to be very portable on Unix systems yet. > > regards, tom lane > >