Skip site navigation (1) Skip section navigation (2)

Re: C interface problem

From: Andreas Kretzer <andi(at)kretzer-berlin(dot)de>
To: Postgres Interface List <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: C interface problem
Date: 2001-12-07 09:44:04
Message-ID: (view raw or whole thread)
Lists: pgsql-generalpgsql-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
> cannot open shared object file

This looks like an installation problem! Your program is ok, but
when it tries to load the 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 is a symbolic link to<major> and
this one could / should be a link to<major>.<minor> where
<major> and <minor> refer to the concrete version of the library.

It looks, like your is a symbolic link to a nonexistent
library (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
you can check out all libraries it uses for their dependencies.

Arrrgh, STOP! I just recognized, that some programs/libs directly
require the (not just the generic name If
this is the case with your program, it seems that you just don't
have any 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


In response to


pgsql-interfaces by date

Next:From: Tim BarnardDate: 2001-12-07 15:58:21
Subject: Re: C interface problem
Previous:From: altaDate: 2001-12-06 17:08:54
Subject: HOWTO: PostgreSQL & Perl DBD on SuSE 7.3

pgsql-general by date

Next:From: qradiusDate: 2001-12-07 10:13:08
Subject: shmget problem on solaris
Previous:From: mordicusDate: 2001-12-07 09:20:31
Subject: Re: Trigger problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group