Problem creating a function

Started by Cornelia Boenigkover 19 years ago8 messagesgeneral
Jump to latest
#1Cornelia Boenigk
c@cornelia-boenigk.de

Hi all

Trying to create a function I get the following:

codex=# CREATE FUNCTION "bitvg" (integer,integer) RETURNS integer AS
'/home/database/pgdata/cobis/bitvg/bitvg.so', 'bitvg' LANGUAGE 'C';
ERROR: could not load library
"/home/database/pgdata/cobis/bitvg/bitvg.so":
/home/database/pgdata/cobis/bitvg/bitvg.so: Kann die
Shared-Object-Datei nicht ᅵffnen: Datei oder Verzeichnis nicht gefunden

in english: /home/database/pgdata/cobis/bitvg/bitvg.so: cannot open
shared object: file not found

The file does exist in the path /home/database/pgdata/cobis/bitvg/:
-rwxr-xr-x 1 root root 133 Jul 19 13:13 bitvg.c
-rwxr-xr-x 1 root root 782 Jul 19 13:13 bitvg.o
-rwxr-xr-x 1 root root 3198 Jul 19 13:13 bitvg.so

What do I miss?

Thank's in advance
Conni
--
http://pgsql.info | http://postgresql.de | http://pgfakt.de
Telefon: 07127 80 961

#2Joe Conway
mail@joeconway.com
In reply to: Cornelia Boenigk (#1)
Re: Problem creating a function

Cornelia Boenigk wrote:

The file does exist in the path /home/database/pgdata/cobis/bitvg/:
-rwxr-xr-x 1 root root 133 Jul 19 13:13 bitvg.c
-rwxr-xr-x 1 root root 782 Jul 19 13:13 bitvg.o
-rwxr-xr-x 1 root root 3198 Jul 19 13:13 bitvg.so

What do I miss?

Does the postgres user have access to /home/database/pgdata/cobis/bitvg?

Try:
su postgres
cd /home/database/pgdata/cobis/bitvg

Joe

#3Cornelia Boenigk
poppcorn@cornelia-boenigk.de
In reply to: Joe Conway (#2)
Re: Problem creating a function

Hi Joe

Try:
su postgres
cd /home/database/pgdata/cobis/bitvg

Succeeds, ls -la shows all files in that directory and can open them
with less.

Regards
Conni

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Cornelia Boenigk (#1)
Re: Problem creating a function

Cornelia Boenigk <c@cornelia-boenigk.de> writes:

in english: /home/database/pgdata/cobis/bitvg/bitvg.so: cannot open
shared object: file not found

The file does exist in the path /home/database/pgdata/cobis/bitvg/:

The "file not found" might be coming from the dynamic loader trying to
load some other library that bitvg.so depends upon. You should try "ldd"
or local equivalent on bitvg.so to check whether all its dependencies
can be found. Also, try looking in the postmaster log --- on some
platforms, dynamic loader failures spit additional information to stderr
that can't be reported to you by the backend, but will be captured in
the postmaster log file.

regards, tom lane

#5Cornelia Boenigk
poppcorn@cornelia-boenigk.de
In reply to: Tom Lane (#4)
Re: Problem creating a function

Hi Tom

You should try "ldd" or local equivalent on bitvg.so to check
whether all its dependencies can be found.

output:
ldd /home/database/pgdata/cobis/bitvg/bitvg.so
statically linked

Regards
Conni

#6Joe Conway
mail@joeconway.com
In reply to: Cornelia Boenigk (#3)
Re: Problem creating a function

Cornelia Boenigk wrote:

Hi Joe

Try:
su postgres
cd /home/database/pgdata/cobis/bitvg

Succeeds, ls -la shows all files in that directory and can open them
with less.

Kind of odd, particularly given your reply to Tom's question in a nearby
post. Could it be an SELinux issue?

Joe

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Joe Conway (#6)
Re: Problem creating a function

Joe Conway <mail@joeconway.com> writes:

Could it be an SELinux issue?

I'd really expect the strerror result to be something about 'permission
denied' rather than 'file not found', if that were the problem...

regards, tom lane

#8Cornelia Boenigk
poppcorn@cornelia-boenigk.de
In reply to: Tom Lane (#7)
Re: Problem creating a function - solved

Hi Tom, Joe

After compiling the C-source files

# gcc -fpic -c bitvg.c
# gcc -shared -o bitvg.so bitvg.o

the pg_restore created the function.
It is Suse 9.x and PG 8.1.4

Thanks
Conni