Re: C interface libpq.so.2 problem

Lists: pgsql-generalpgsql-interfaces
From: dsmclennan(at)spipowernet(dot)com(dot)au
To: pgsql-interfaces(at)postgresql(dot)org
Subject: C interface libpq.so.2 problem
Date: 2001-12-03 04:57:22
Message-ID: OFB13671EA.7394FFAD-ONCA256B17.001B323A@spipowernet.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-interfaces

Hi ,

as a new user I have followed the Momjian libpq sample program format

#include "libpq-fe.h"

and cc -I/usr/local/pgsql/include -o myapp myapp.c
-L/usr/local/pgsql/lib -lpq

my application compiles but on execution gives

libpq.so.2: cannot open shared object file

Similar problems have been listed before but none of the suggestions fixed
my problem.
Does anyone recognise this problem?

Thanks

David McLennan

**********************************************************************
This email 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 email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


From: "Tim Barnard" <tbarnard(at)povn(dot)com>
To: <dsmclennan(at)spipowernet(dot)com(dot)au>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: C interface libpq.so.2 problem
Date: 2001-12-06 15:51:42
Message-ID: 007f01c17e6d$eae07c40$a519af3f@hartcomm.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-interfaces

If your running on a RedHat installation --

Add the line: /usr/local/pgsql/lib
to the bottom of the file: /etc/ld.so.conf
then run ldconfig.
Your app will now find the shared file.

Tim

----- Original Message -----
From: <dsmclennan(at)spipowernet(dot)com(dot)au>
To: <pgsql-interfaces(at)postgresql(dot)org>
Sent: Sunday, December 02, 2001 8:57 PM
Subject: C interface libpq.so.2 problem

> Hi ,
>
> as a new user I have followed the Momjian libpq sample program format
>
> #include "libpq-fe.h"
>
> and cc -I/usr/local/pgsql/include -o myapp myapp.c
> -L/usr/local/pgsql/lib -lpq
>
> my application compiles but on execution gives
>
> libpq.so.2: cannot open shared object file
>
> Similar problems have been listed before but none of the suggestions fixed
> my problem.
> Does anyone recognise this problem?
>
> Thanks
>
> David McLennan
>
>
>
> **********************************************************************
> This email 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 email in error please notify
> the system manager.
>
> This footnote also confirms that this email message has been swept by
> MIMEsweeper for the presence of computer viruses.
>
> www.mimesweeper.com
> **********************************************************************
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>
>


From: Andreas Kretzer <andi(at)kretzer-berlin(dot)de>
To: Postgres Interface List <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: C interface libpq.so.2 problem
Date: 2001-12-07 09:44:04
Message-ID: 3C108F64.EF6665C2@kretzer-berlin.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-interfaces

dsmclennan(at)spipowernet(dot)com(dot)au schrieb:

> Hi ,
>
> as a new user I have followed the Momjian libpq sample program format
>
> #include "libpq-fe.h"
>
> and cc -I/usr/local/pgsql/include -o myapp myapp.c
> -L/usr/local/pgsql/lib -lpq
>
> my application compiles but on execution gives
>
> libpq.so.2: cannot open shared object file
>

This looks like an installation problem! Your program is ok, but
when it tries to load the libpq.so it fails. The idea of the shared
objects (that is what .so means; like the DLL in wind*ws) is to
have a library in a specific version and use an _unspecific_ name
for it.

So the library libpq.so is a symbolic link to libpq.so.<major> and
this one could / should be a link to libpq.so.<major>.<minor> where
<major> and <minor> refer to the concrete version of the library.

It looks, like your lipq.so is a symbolic link to a nonexistent
library libpq.so.2 (or that file may have unsufficient rights).
Perhaps it's best you check your files; and make shure that you are
looking at the right ones. The libraries are searched according to
the entries in /etc/modules.conf (after changing this file a
ldconfig is needed).

Newer Postgres versions (or maybe all versions that you compile
yourself) install their libraries under /usr/local/pgsql/lib.
Maybe you had older versions directly from your distribution
in /usr/lib or /usr/i486-linux-libc5/lib or
/usr/i486-linux-libc6/lib. In this case all depends on the
searchpath for the libraries.

You can use 'ldd yourprogram' to find out, which libraries it
depends on. If your program doesn't directly need the libpq.so
you can check out all libraries it uses for their dependencies.

Arrrgh, STOP! I just recognized, that some programs/libs directly
require the libpq.so.2 (not just the generic name libpq.so). If
this is the case with your program, it seems that you just don't
have any libpq.so on your system or forgot to write the library-
path into the above mentioned file /etc/modules.conf (on older
systems there was a /etc/conf.modules - so check this out).

Hope this helps

Andreas


From: "Tim Barnard" <tbarnard(at)povn(dot)com>
To: "Andreas Kretzer" <andi(at)kretzer-berlin(dot)de>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: C interface libpq.so.2 problem
Date: 2001-12-07 15:58:21
Message-ID: 004301c17f37$ffd40b60$a519af3f@hartcomm.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-interfaces

Sorry Andreas, but I think your mixing a couple of things. /etc/modules.conf
is a configuration file for loading kernel modules as opposed to shared
libraries, whereas /etc/ld.so.conf specifies where to look for shared
libraries. adding /usr/local/pgsql/lib to the end of ld.so.conf and run
ldconfig corrects the problem. Of course, this is for RedHat installations.

Hope you don't mind me pointing out the correction :-)

Tim

----- Original Message -----
From: Andreas Kretzer
To: Postgres Interface List
Sent: Friday, December 07, 2001 1:44 AM
Subject: Re: C interface libpq.so.2 problem

dsmclennan(at)spipowernet(dot)com(dot)au schrieb:
Hi ,
as a new user I have followed the Momjian libpq sample program format
#include "libpq-fe.h"
and cc -I/usr/local/pgsql/include -o myapp myapp.c
-L/usr/local/pgsql/lib -lpq
my application compiles but on execution gives
libpq.so.2: cannot open shared object file

This looks like an installation problem! Your program is ok, but
when it tries to load the libpq.so it fails. The idea of the shared
objects (that is what .so means; like the DLL in wind*ws) is to
have a library in a specific version and use an _unspecific_ name
for it.
So the library libpq.so is a symbolic link to libpq.so.<major> and
this one could / should be a link to libpq.so.<major>.<minor> where
<major> and <minor> refer to the concrete version of the library.
It looks, like your lipq.so is a symbolic link to a nonexistent
library libpq.so.2 (or that file may have unsufficient rights).
Perhaps it's best you check your files; and make shure that you are
looking at the right ones. The libraries are searched according to
the entries in /etc/modules.conf (after changing this file a
ldconfig is needed).
Newer Postgres versions (or maybe all versions that you compile
yourself) install their libraries under /usr/local/pgsql/lib.
Maybe you had older versions directly from your distribution
in /usr/lib or /usr/i486-linux-libc5/lib or
/usr/i486-linux-libc6/lib. In this case all depends on the
searchpath for the libraries.
You can use 'ldd yourprogram' to find out, which libraries it
depends on. If your program doesn't directly need the libpq.so
you can check out all libraries it uses for their dependencies.
Arrrgh, STOP! I just recognized, that some programs/libs directly
require the libpq.so.2 (not just the generic name libpq.so). If
this is the case with your program, it seems that you just don't
have any libpq.so on your system or forgot to write the library-
path into the above mentioned file /etc/modules.conf (on older
systems there was a /etc/conf.modules - so check this out).
Hope this helps
Andreas