Using libpq without LD_LIBRARY_PATH

Поиск
Список
Период
Сортировка
Искать
От
Matthew Hagerty
Тема
Using libpq without LD_LIBRARY_PATH
Дата
Msg-id
4.1.19990205125048.00995ac0@mail.venux.net
Список
Дерево обсуждения
Using libpq without LD_LIBRARY_PATH Matthew Hagerty <matthew@venux.net>
Re: [INTERFACES] Using libpq without LD_LIBRARY_PATH Tom Lane <tgl@sss.pgh.pa.us>
Re: [INTERFACES] Using libpq without LD_LIBRARY_PATH Matthew Hagerty <matthew@venux.net>
Re: [INTERFACES] Using libpq without LD_LIBRARY_PATH James Thompson <jamest@math.ksu.edu>
Re: [INTERFACES] Using libpq without LD_LIBRARY_PATH "Billy G. Allie" <Bill.Allie@mug.org>
Re: [INTERFACES] Using libpq without LD_LIBRARY_PATH Margarita Barvinok <brita@math.lsa.umich.edu>
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

В списке pgsql-interfaces по дате отправления
От: Peter T Mount
Дата:
От: Margarita Barvinok
Дата:
FAQ