Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux