Re: error while loading shared libraries: libpq.so.3

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: error while loading shared libraries: libpq.so.3
Дата
Msg-id 20050221171746.GA32721@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: error while loading shared libraries: libpq.so.3  ("Surabhi Ahuja " <surabhi.ahuja@iiitb.ac.in>)
Список pgsql-general
On Mon, Feb 21, 2005 at 02:22:20PM +0530, Surabhi Ahuja  wrote:

> I give the following command now to compile sample.c
> gcc -o sample sample.c -I/usr/local/pgsql/include -L/usr/local/pgsql/lib -rpath/usr/local/pgsql/lib - lpq
>
> it gives this message:
> gcc: unrecognized option `-rpath/usr/local/pgsql/lib'
> (the same happens if i give -R instaed of -rpath

As I said, see your compiler or linker documentation for the correct
option.  Another possibility might be "-Wl,-rpath=/usr/local/pgsql/lib",
but *see the documentation* instead of using trial-and-error.

What's happening is that the run-time linker doesn't know where to
find libpq.  You can fix that a few different ways:

1. You can add run-time link information when you build the program.
That's what the aforementioned options are for; see your documentation
to find out the correct way to do it.  Some people consider this the
"right" way to solve the problem.

2. You can globally change the run-time linker's configuration.
How to do this depends on the platform, so again, you'll have to
consult your local documentation.

3. You can use an environment variable like LD_LIBRARY_PATH to tell
the run-time linker what additional directories to search.  Many
people consider this a workaround rather than a fix and therefore
suggest avoiding it in favor of (1) or possibly (2).

http://www.visi.com/~barr/ldpath.html

NOTE: This is a build procedure issue that has nothing to do with
PostgreSQL, aside from the fact that in this particular case you're
trying to link against a PostgreSQL library.  You'll have the same
problem any time you link against a shared library that's not in
the run-time linker's path.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

В списке pgsql-general по дате отправления:

Предыдущее
От: Geoffrey KRETZ
Дата:
Сообщение: Re: PGS 7.2 : Insert with wrong number of values did not
Следующее
От: "Greg Sabino Mullane"
Дата:
Сообщение: Re: Scalability with large numbers of tables