Received: from rm-rstar.sfu.ca (root@rm-rstar.sfu.ca [142.58.120.21]) by hub.org (8.9.2/8.9.1) with ESMTP id NAA69979 for ; Fri, 5 Feb 1999 13:34:37 -0500 (EST) (envelope-from gburnham@sfu.ca) Received: from apemantus (apemantus.educ.sfu.ca [142.58.6.61]) by rm-rstar.sfu.ca (8.9.1/8.9.1/SFU-5.0H) with SMTP id KAA07404 for ; Fri, 5 Feb 1999 10:34:36 -0800 (PST) Message-ID: <008601be5136$35720020$3d063a8e@educ.sfu.ca> From: "Gregory W Burnham" To: Subject: Re: [INTERFACES] Using libpq without LD_LIBRARY_PATH Date: Fri, 5 Feb 1999 10:34:42 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.0810.800 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.0810.800 I have the following two environment variable set: PGDATA=/var/lib/pgsql/base PGLIB=/usr/lib/psql and I use the following to compile my cgis (from a make file): search: common/CCgi.o common/CHeadlineRecord.o common/CStoryRecord.o common/CStudentRecord.o common/CDatabase.o common/CPairs.o proj.h news-search/news-search.h g++ -DUN_PRODUCTION common/CCgi.o common/CStoryRecord.o common/CStudentRecord.o common/CHeadlineRecord.o common/CDatabase.o common/CPairs.o news-search/news-search.cpp -lpq -o /home/httpd/cgi-bin/news-search.cgi ----- Original Message ----- From: Matthew Hagerty To: Sent: Friday, February 05, 1999 10:13 AM Subject: [INTERFACES] Using libpq without LD_LIBRARY_PATH >Greetings, > >I am trying to get a simple C program to compile and run without having to >define the LD_LIBRARY_PATH environment variable. First I tried this: > >gcc -o test -I/usr/local/pgsql/include -L/usr/local/pgsql/lib -lpq test.c > >With LD_LIBRARY_PATH defined the program runs fine, without LD_LIBRARY_PATH >defined I get this error: > >ld.so failed: Can't find shared library "libpq.so.2.0" > >So, I changed my compiler like to this: > >gcc -o test -I/usr/local/pgsql/include test.c /usr/local/pgsql/lib/libpq.a > >This produced a linker error like this: > >fe-auth.o: Undefined symbol `_crypt' referenced from text segment >*** Error code 1 > >So, I added -lcrypt to the whole mess, like this: > >gcc -o test -I/usr/local/pgsql/include -lcrypt test.c >/usr/local/pgsql/lib/libpq.a > >Then I get the following warning: > >ld: symbol __GLOBAL_OFFSET_TABLE_ remains undefined > >Where does all this stop? Can I static link with libpq? If so, how is it >done? As a last ditch effort I added symbolic links in my /usr/local/lib >directory to libpq.a, libpq.so and libpq.so.2, and compiled like this: > >gcc -o test -I/usr/local/pgsql/include -lpq test.c > >This compiled okay, but when I run the program I get this warning: > >/usr/libexec/ld.so: warning: /usr/local/lib/libpq.so.2: minor version -1 >older than expected 0, using it anyway > > >Any insight would be greatly appreciated. > >Thank you, >Matthew Hagerty > > > Gregory W Burnham Software Engineer Excite Labs Faculty Of Education Simon Fraser University Vancouver, B.C. (604) 291 3615 ph (604) 291 5679 fx