Обсуждение: Can't not load libpq.so.3
I have install postgresql 7.3.4. I want to use C++ program to update my database.
I link my program with this link option –L/usr/local/pgsql/lib.
The program is linked, but when I run it.
I have this problem
My_program: error while loading shared libraries: libpq.so.3: cannot open shared object file: No such file or directory.
The link libpq.so.3 is the right directory /usr/local/pgsql/lib and it’s linked to libpq.so.3.0.
What happening?
Thanks.
Sincères Salutations.
Fabien DAUMEN - Chef de projet.
NEOPOST – NBG
MIN 26, Halle 4 - 84953 CAVAILLON CEDEX - FRANCE
Tél: (33) 4.90.76.08.08 - Fax: (33) 4.90.06.18.86
This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the system manager
On Mon, Oct 20, 2003 at 10:12:28AM +0200, Fabien DAUMEN wrote: > > I link my program with this link option ?L/usr/local/pgsql/lib. That's good, but it only deals with the compile-time linking. The actual loading of a shared library happens at run-time, and since there's no special reason to assume that the running system will look like the one you compiled your code on, this library path is not remembered. So libpq needs to be in your library *load* path as well as your library *link* path, which you set correctly. Two workarounds suggest themselves: 1. Make sure your OS can find the library at load time. On Linux for example, you'd do this by setting the environment variable LD_LIBRARY_PATH to include the path /usr/local/pgsql/lib before running your program. 2. Alternatively, create a link to libpq.so somewhere in your existing library load path so your system knows where to find it by default. You could call it /usr/local/lib/libpq.so, for instance. Jeroen