pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: error while executing a c program with embedded sql
5+ messages / 4 participants
[nested] [flat]

* Re: error while executing a c program with embedded sql
@ 2003-11-09 15:06  radha.manohar@ndsu.nodak.edu
  0 siblings, 3 replies; 5+ messages in thread

From: radha.manohar@ndsu.nodak.edu @ 2003-11-09 15:06 UTC (permalink / raw)
  To: pgsql-novice@postgresql.org; +Cc: pgsql-performance

I have a c program called test1.pgc with some sql statements embedded in
it. The program was preprocessed, compiled and linked. Now, I have the
executable test1.

When I run the executable it says,

./test1: error while loading shared libraries: libecpg.so.3: cannot open
shared object file: No such file or directory

What does it mean by this error message? What should I do to correct this
error and run the executable successfully?

Your response would be very much appreciated.

Thanks and Regards,

Radha





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: error while executing a c program with embedded sql
@ 2003-11-09 15:34  Tom Lane <tgl@sss.pgh.pa.us>
  parent: radha.manohar@ndsu.nodak.edu
  2 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2003-11-09 15:34 UTC (permalink / raw)
  To: radha.manohar@ndsu.nodak.edu; +Cc: pgsql-novice@postgresql.org; pgsql-performance

<radha.manohar@ndsu.nodak.edu> writes:
> ./test1: error while loading shared libraries: libecpg.so.3: cannot open
> shared object file: No such file or directory

The dynamic linker is failing to find either libecpg.so itself, or one
of the shared libraries it depends on (perhaps libpq.so).

If you are on a Linux system you probably want to fix your ldconfig
configuration so that all these libraries are found automatically.
You can run ldd on a particular executable or shared library to see what
libraries it references and whether those libraries are getting found
in the proper places.

Note that it is entirely possible for the program linking stage to
succeed but dynamic linking to fail at runtime.  For various reasons the
search rules are not quite the same in the two contexts ...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: error while executing a c program with embedded sql
@ 2003-11-09 17:32  Oliver Elphick <olly@lfix.co.uk>
  parent: radha.manohar@ndsu.nodak.edu
  2 siblings, 1 reply; 5+ messages in thread

From: Oliver Elphick @ 2003-11-09 17:32 UTC (permalink / raw)
  To: radha.manohar@ndsu.nodak.edu; +Cc: pgsql-novice@postgresql.org

On Sun, 2003-11-09 at 15:06, radha.manohar@ndsu.nodak.edu wrote:
> I have a c program called test1.pgc with some sql statements embedded in
> it. The program was preprocessed, compiled and linked. Now, I have the
> executable test1.
> 
> When I run the executable it says,
> 
> ./test1: error while loading shared libraries: libecpg.so.3: cannot open
> shared object file: No such file or directory
> 
> What does it mean by this error message? What should I do to correct this
> error and run the executable successfully?

Shared libraries are loaded from directories specified to the system by
ldconfig.  Your shared library, libecpg.so.3, is in a PostgreSQL
directory, such as /usr/local/pgsql/lib, which has not been added to the
directories known to the loader.

If you are able to add that directory with ldconfig, that is the best
way to do it, but it requires root privilege.

Otherwise you can set the environment variable LD_LIBRARY_PATH, thus:

	export LD_LIBRARY_PATH=/usr/local/pgsql/lib

before you run the program, or you can use LD_PRELOAD:

	LD_PRELOAD=/usr/local/pgsql/lib/libecpg.so.3 ./test1

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                             http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "O death, where is thy sting? O grave, where is 
      thy victory?"             1 Corinthians 15:55 




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: error while executing a c program with embedded sql
@ 2003-11-10 15:00  radha.manohar@ndsu.nodak.edu
  parent: Oliver Elphick <olly@lfix.co.uk>
  0 siblings, 0 replies; 5+ messages in thread

From: radha.manohar@ndsu.nodak.edu @ 2003-11-10 15:00 UTC (permalink / raw)
  To: olly@lfix.co.uk; +Cc: pgsql-novice@postgresql.org; pgsql-performance

Thanks a lot. IT WORKED! with your suggestions.

Regards,
Radha

> On Sun, 2003-11-09 at 15:06, radha.manohar@ndsu.nodak.edu wrote:
>> I have a c program called test1.pgc with some sql statements embedded
>> in it. The program was preprocessed, compiled and linked. Now, I have
>> the executable test1.
>>
>> When I run the executable it says,
>>
>> ./test1: error while loading shared libraries: libecpg.so.3: cannot
>> open shared object file: No such file or directory
>>
>> What does it mean by this error message? What should I do to correct
>> this error and run the executable successfully?
>
> Shared libraries are loaded from directories specified to the system by
> ldconfig.  Your shared library, libecpg.so.3, is in a PostgreSQL
> directory, such as /usr/local/pgsql/lib, which has not been added to the
> directories known to the loader.
>
> If you are able to add that directory with ldconfig, that is the best
> way to do it, but it requires root privilege.
>
> Otherwise you can set the environment variable LD_LIBRARY_PATH, thus:
>
> 	export LD_LIBRARY_PATH=/usr/local/pgsql/lib
>
> before you run the program, or you can use LD_PRELOAD:
>
> 	LD_PRELOAD=/usr/local/pgsql/lib/libecpg.so.3 ./test1
>
> --
> Oliver Elphick                                Oliver.Elphick@lfix.co.uk
> Isle of Wight, UK
> http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870
> 5839  932A 614D 4C34 3E1D 0C1C
>                  ========================================
>      "O death, where is thy sting? O grave, where is
>       thy victory?"             1 Corinthians 15:55






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [PERFORM] error while executing a c program with embedded sql
@ 2003-11-10 16:27  Rajesh Kumar Mallah <mallah@trade-india.com>
  parent: radha.manohar@ndsu.nodak.edu
  2 siblings, 0 replies; 5+ messages in thread

From: Rajesh Kumar Mallah @ 2003-11-10 16:27 UTC (permalink / raw)
  To: radha.manohar@ndsu.nodak.edu; +Cc: pgsql-novice@postgresql.org

radha.manohar@ndsu.nodak.edu wrote:

>I have a c program called test1.pgc with some sql statements embedded in
>it. The program was preprocessed, compiled and linked. Now, I have the
>executable test1.
>
>When I run the executable it says,
>
>./test1: error while loading shared libraries: libecpg.so.3: cannot open
>shared object file: No such file or directory
>
check where the so file is located.
$ locate libecpg.so.3

say its /usr/local/pgsql/lib
then either add the folder above to /etc/ld.so.conf and run ldconfig
as root.

or

$ export LD_LIBRARY_PATH=/path/to/folder/containing/the/so/file
$ ./test1

the above assumes u are on linux. on unix also its similar.


>
>What does it mean by this error message? What should I do to correct this
>error and run the executable successfully?
>
>Your response would be very much appreciated.
>
>Thanks and Regards,
>
>Radha
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>  
>





^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2003-11-10 16:27 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-11-09 15:06 Re: error while executing a c program with embedded sql radha.manohar@ndsu.nodak.edu
2003-11-09 15:34 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-11-09 17:32 ` Oliver Elphick <olly@lfix.co.uk>
2003-11-10 15:00   ` radha.manohar@ndsu.nodak.edu
2003-11-10 16:27 ` Rajesh Kumar Mallah <mallah@trade-india.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox