Thread: AW: User functions and AIX

AW: User functions and AIX

From
Zeugswetter Andreas SB
Date:
> IBM is trying to find the answer to this but I thought I would throw
> this out here to see if anyone can help me.  I am compiling a user
> defined type on AIX and it fails when I try to use it.  The type is
> chkpass and it is in the contrib directory.  It fails with a core dump
> at line 88 in chkpass.c.  The line reads as follows.
> 
>     result = (chkpass *) palloc(sizeof(chkpass));
> 
> The top of the backtrace looks like this.
> 
> #0  0x0 in ?? () from (unknown load module)
> #1  0xd1087a60 in chkpass_in (fcinfo=0x0) at chkpass.c:88
> #2  0x10045cf4 in or_clause (clause=0x0) at clauses.c:211
> #3  0x10075d68 in int82ge (fcinfo=0x1015cfc8) at int8.c:343
> #4  0x1005909c in _readArrayRef () at readfuncs.c:924
> #5  0x10059b68 in _readSeqScan () at readfuncs.c:600
> 
> It looks like the dynamically loaded object (chkpass.so) 
> can't determine
> the address of palloc() from the parent.  I assume I need a 
> flag for the
> compile either on the main build to export the addresses or 
> on the build
> of chkpass to tell it where to look up the addresses.  Anyone been
> through this that might be able to shed some light?

Tell me your link line, OS and compiler version. 
And have you forgotten to include -bI:postgres.imp ?
In general it is imho a good idea to copy the appropriate
compile and link flags from the regression test, that compiles
shared libs in .../contrib.

Andreas


Re: AW: User functions and AIX

From
darcy@druid.net (D'Arcy J.M. Cain)
Date:
Thus spake Zeugswetter Andreas SB
> > IBM is trying to find the answer to this but I thought I would throw
...

> Tell me your link line, OS and compiler version. 
> And have you forgotten to include -bI:postgres.imp ?

Bingo!  I can't believe that IBM has been wrestling with this for a week.
Part of the reason we are thinking of going with IBM is for the support.

Here is my Makefile now.  I'm not sure about that -lc there as I get duplicate
symbol warnings but it appears to work fine.

#
#   Local PostgreSQL types
#   Written by D'Arcy J.M. Cain (darcy@druid.net)
#
#   $Id: Makefile,v 1.1 2000/06/23 17:03:40 root Exp $

PGDIR =     /usr/local/pgsql
PGINCDIR =  /home/darcy/postgresql-7.1/src/include
PGLIBDIR =  /usr/local/pgsql/lib
CFLAGS =    -g -O0 -pipe -ansi -Wall -Wshadow -Wpointer-arith -Wcast-qual \           -I ${PGINCDIR} -L ${PGLIBDIR} \
       -Wwrite-strings -Wmissing-prototypes
 
OBJS =      chkpass.o
SH_OBJS =   chkpass.so

.SUFFIXES:  .so

.o.so:   ld -G -o $@ $< -L ${PGLIBDIR} -bI:/usr/local/pgsql/lib/postgres.imp \       -bexpall -bnoentry -lc

.c.o:   gcc ${CFLAGS} -c $<

all: ${SH_OBJS}

install: all   cp ${SH_OBJS} ${PGDIR}/modules   sed "s+%%PGDIR%%+${PGDIR}+g" < chkpass.sql >
${PGDIR}/modules/chkpass.sql

clean:   rm -f ${OBJS} ${SH_OBJS}

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.