Thread: Help Wanted for running C code

Help Wanted for running C code

From
Pa O'Clerigh
Date:
Hello help wanted asap for this one please.
I have installed POstgres on my own machine and i am
in charge of its settings.

the problem is when i try and run a small piece of c
code i get an error which states the following:
cc  testing_connection.c  -L/usr/local/pgsql/lib -lpq 
-I/usr/local/pgsql/include -o fred -O0  
$ ./fred
./fred: error in loading shared libraries: libpq.so.2:
cannot open shared object file: No such file or
directory


the program followed all the steps set out in the
postgres documentation on building Libpq programs.
But i still get the above??
Any suggestions please

__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/


Re: Help Wanted for running C code

From
"Mark Pritchard"
Date:
Hi,

You should probably post this on -general or some other list, but I believe
the answer is that the postgres libraries cannot be found by the dynamic
library loader. You can fix this by:

* Including the PGINSTALLDIR/lib directory in your LD_LIBRARY_PATH

or

* Editing your /etc/ld.so.conf to include the above path and running
ldconfig

or

* symlinking from an existing library path (/usr/lib etc) to this file.

Regards,

Mark

> -----Original Message-----
> From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.org]On Behalf Of Pa O'Clerigh
> Sent: Tuesday, 5 March 2002 10:27 PM
> To: pgsql-hackers@postgresql.org
> Subject: [HACKERS] Help Wanted for running C code
>
>
> Hello help wanted asap for this one please.
> I have installed POstgres on my own machine and i am
> in charge of its settings.
>
> the problem is when i try and run a small piece of c
> code i get an error which states the following:
> cc  testing_connection.c  -L/usr/local/pgsql/lib -lpq
> -I/usr/local/pgsql/include -o fred -O0
> $ ./fred
> ./fred: error in loading shared libraries: libpq.so.2:
> cannot open shared object file: No such file or
> directory
>
>
> the program followed all the steps set out in the
> postgres documentation on building Libpq programs.
> But i still get the above??
> Any suggestions please
>
> __________________________________________________
> Do You Yahoo!?
> Try FREE Yahoo! Mail - the world's greatest free email!
> http://mail.yahoo.com/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>



Re: Help Wanted for running C code

From
Patrick Welche
Date:
On Tue, Mar 05, 2002 at 03:26:46AM -0800, Pa O'Clerigh wrote:
... 
> the problem is when i try and run a small piece of c
> code i get an error which states the following:
> cc  testing_connection.c  -L/usr/local/pgsql/lib -lpq 
> -I/usr/local/pgsql/include -o fred -O0  
> $ ./fred
> ./fred: error in loading shared libraries: libpq.so.2:
> cannot open shared object file: No such file or
> directory
...

What does
  ldd fred  file fred

tell you? Maybe
  cc testing_connection -L/usr/local/pgsql/lib -Wl,-R/usr/local/pgsql/lib -lpq\    -I/usr/local/pgsql/include -o fred
-O0

?

Patrick


Re: Help Wanted for running C code

From
Peter Eisentraut
Date:
Pa O'Clerigh writes:

> the problem is when i try and run a small piece of c
> code i get an error which states the following:
> cc  testing_connection.c  -L/usr/local/pgsql/lib -lpq
> -I/usr/local/pgsql/include -o fred -O0
> $ ./fred
> ./fred: error in loading shared libraries: libpq.so.2:
> cannot open shared object file: No such file or
> directory

Add -Wl,-rpath,/usr/local/pgsql/lib, or set and export
LD_LIBRARY_PATH=/usr/local/psgql/lib, or modify /etc/ld.so.conf and run
ldconfig.

-- 
Peter Eisentraut   peter_e@gmx.net