pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedShared lib grief with 6.4.2
3+ messages / 3 participants
[nested] [flat]
* Shared lib grief with 6.4.2
@ 1999-05-26 03:54 Matthew Hagerty <matthew@venux.net>
0 siblings, 1 reply; 3+ messages in thread
From: Matthew Hagerty @ 1999-05-26 03:54 UTC (permalink / raw)
To: pgsql-interfaces
Greetings,
I'm trying to create a simple function for postgres-6.4.2 under
FreeBSD-3.1-RELEASE and GCC-2.7.2.1. This is the program code, simply
converts a bool to int4:
#include "../include/postgres.h"
int4
bool2int(bool bCondition)
{
if (bCondition)
return(1);
else
return(0);
}
Then on the command line to create the shared lib and a file command to
ensure I created a shared lib:
# gcc -shared -I../include -o procs.so bool2int.c
# file procs.so
procs.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (FreeBSD),
not stripped
Then in psql:
=> create function bool2int(bool) returns int4 as
'/usr/local/pgsql/procs/procs.so' language 'c';
CREATE
=> select bool2int(1=1);
ERROR: Can't find function bool2int in file /usr/local/pgsql/procs/procs.so
=>
Any insight as to why this does not work would be greatly appreciated.
Thank you,
Matthew Hagerty
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [INTERFACES] Shared lib grief with 6.4.2
@ 1999-05-26 09:51 Oleg Bartunov <oleg@sai.msu.su>
parent: Jonathan Davis <haj@idianet.net>
0 siblings, 0 replies; 3+ messages in thread
From: Oleg Bartunov @ 1999-05-26 09:51 UTC (permalink / raw)
To: Jonathan Davis <haj@idianet.net>; +Cc: Matthew Hagerty <matthew@venux.net>; pgsql-interfaces
Look at ports information ! There are several patches and I used
some of them, actually for Makefile.shlib and makefiles/freebsd.
Everything works fine now. BTW, these patches are incorporated now
to 6.5 sources.
Oleg
On Wed, 26 May 1999, Jonathan Davis wrote:
> Date: Wed, 26 May 1999 10:46:25 +0000
> From: Jonathan Davis <haj@idianet.net>
> To: Matthew Hagerty <matthew@venux.net>
> Cc: pgsql-interfaces@postgresql.org
> Subject: Re: [INTERFACES] Shared lib grief with 6.4.2
>
> Matthew Hagerty wrote:
>
> > Greetings,
> >
> > I'm trying to create a simple function for postgres-6.4.2 under
> > FreeBSD-3.1-RELEASE and GCC-2.7.2.1. This is the program code, simply
> > converts a bool to int4:
> >
> > #include "../include/postgres.h"
> >
> > int4
> > bool2int(bool bCondition)
> > {
> > if (bCondition)
> > return(1);
> > else
> > return(0);
> > }
> >
> > Then on the command line to create the shared lib and a file command to
> > ensure I created a shared lib:
> >
> > # gcc -shared -I../include -o procs.so bool2int.c
> > # file procs.so
> > procs.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (FreeBSD),
> > not stripped
> >
> > Then in psql:
> >
> > => create function bool2int(bool) returns int4 as
> > '/usr/local/pgsql/procs/procs.so' language 'c';
> > CREATE
> > => select bool2int(1=1);
> > ERROR: Can't find function bool2int in file /usr/local/pgsql/procs/procs.so
> > =>
> >
> > Any insight as to why this does not work would be greatly appreciated.
> >
> > Thank you,
> > Matthew Hagerty
>
> I do the same thing, and in psql:
>
> postgres=> select bool2int(1=1);
> assertion "u.hdr.e_phentsize == sizeof(Elf_Phdr)" failed: file
> "/usr/src/libexec/rtld-elf/map_object.c", line 118
> pqReadData() -- backend closed the channel unexpectedly.
> This probably means the backend terminated abnormally before or while
> processing the request.
> We have lost the connection to the backend, so further processing is
> impossible. Terminating.
>
> to create the shared lib:
>
> gcc -I../include -I../backend -O2 -m486 -pipe -Wall -Wmissing-prototypes
> -I../interfaces/libpq -I../../include -c bool2int.c -o bool2int.o
> bool2int.c:6: warning: no previous prototype for `bool2int'
> ld -x -r -o bool2int.o.obj bool2int.o
> building shared object bool2int.so
> ranlib bool2int.so.pic
> ld -x -Bshareable -o bool2int.so bool2int.so.pic
>
> I use FreeBSD-3.1
> PostgreSQL-6.4.2
>
>
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [INTERFACES] Shared lib grief with 6.4.2
@ 1999-05-26 10:46 Jonathan Davis <haj@idianet.net>
parent: Matthew Hagerty <matthew@venux.net>
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Davis @ 1999-05-26 10:46 UTC (permalink / raw)
To: Matthew Hagerty <matthew@venux.net>; +Cc: pgsql-interfaces
Matthew Hagerty wrote:
> Greetings,
>
> I'm trying to create a simple function for postgres-6.4.2 under
> FreeBSD-3.1-RELEASE and GCC-2.7.2.1. This is the program code, simply
> converts a bool to int4:
>
> #include "../include/postgres.h"
>
> int4
> bool2int(bool bCondition)
> {
> if (bCondition)
> return(1);
> else
> return(0);
> }
>
> Then on the command line to create the shared lib and a file command to
> ensure I created a shared lib:
>
> # gcc -shared -I../include -o procs.so bool2int.c
> # file procs.so
> procs.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (FreeBSD),
> not stripped
>
> Then in psql:
>
> => create function bool2int(bool) returns int4 as
> '/usr/local/pgsql/procs/procs.so' language 'c';
> CREATE
> => select bool2int(1=1);
> ERROR: Can't find function bool2int in file /usr/local/pgsql/procs/procs.so
> =>
>
> Any insight as to why this does not work would be greatly appreciated.
>
> Thank you,
> Matthew Hagerty
I do the same thing, and in psql:
postgres=> select bool2int(1=1);
assertion "u.hdr.e_phentsize == sizeof(Elf_Phdr)" failed: file
"/usr/src/libexec/rtld-elf/map_object.c", line 118
pqReadData() -- backend closed the channel unexpectedly.
This probably means the backend terminated abnormally before or while
processing the request.
We have lost the connection to the backend, so further processing is
impossible. Terminating.
to create the shared lib:
gcc -I../include -I../backend -O2 -m486 -pipe -Wall -Wmissing-prototypes
-I../interfaces/libpq -I../../include -c bool2int.c -o bool2int.o
bool2int.c:6: warning: no previous prototype for `bool2int'
ld -x -r -o bool2int.o.obj bool2int.o
building shared object bool2int.so
ranlib bool2int.so.pic
ld -x -Bshareable -o bool2int.so bool2int.so.pic
I use FreeBSD-3.1
PostgreSQL-6.4.2
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~1999-05-26 10:46 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-05-26 03:54 Shared lib grief with 6.4.2 Matthew Hagerty <matthew@venux.net>
1999-05-26 10:46 ` Jonathan Davis <haj@idianet.net>
1999-05-26 09:51 ` Oleg Bartunov <oleg@sai.msu.su>
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