Re: [GENERAL] plpgsql problem: relocation error
От | Gene Selkov, Jr. |
---|---|
Тема | Re: [GENERAL] plpgsql problem: relocation error |
Дата | |
Msg-id | 199911050530.XAA00415@antares обсуждение исходный текст |
Ответ на | RE: [GENERAL] plpgsql problem: relocation error (Stephane FILLON <fillons@offratel.nc>) |
Список | pgsql-general |
> Greetings. > > Using pg6.5.1 on Solaris 2.6, I'm trying to create a very simple function > using plpgsql. Here's the code I've executed: > > /* > CREATE FUNCTION plpgsql_call_handler () RETURNS OPAQUE AS > '/opt/pgsql/lib/plpgsql.so' LANGUAGE 'C'; > > CREATE TRUSTED PROCEDURAL LANGUAGE 'plpgsql' > HANDLER plpgsql_call_handler > LANCOMPILER 'PL/pgSQL'; > */ > > CREATE FUNCTION bool(int2) returns bool as > 'begin > if $1 = 1 or $1 = -1 then > RETURN t; > else > RETURN f; > end if; > end;' > language 'plpgsql'; > > All of this loads fine. In fact, nothing loads at this point. The function and the shared object where it is contained simply become known to postgres. > However, when I test the function, this is what > happens: > > demogdata=> select bool(-1); > ERROR: Load of file /opt/pgsql/lib/plpgsql.so failed: ld.so.1: > /opt/pgsql/bin/postmaster: fatal: relocation error: file > /opt/pgsql/lib/plpgsql.so: symbol CurrentMemoryContext: referenced symbol > not found I do not know a thing about plpgsql, but I have just returned from a hacking session in SunOS5.6 where I saw this very error being the result of inappropriate compiler and linker options. Most notably, the object files must be position-independent (-fPIC). Take a look at the actual Makefile I ended up using (SunOS 5.6 should be identical to Solaris 2.6) ============================================================ SRCDIR= /appl/spinosa/Package_sources/postgresql-6.5.2/src include $(SRCDIR)/Makefile.global CFLAGS+= -fPIC -I$(LIBPQDIR) -I$(SRCDIR)/include # # DLOBJS is the dynamically-loaded object files. The "funcs" queries # include CREATE FUNCTIONs that load routines from these files. # DLOBJS= ec$(DLSUFFIX) ifdef EXPSUFF DLOBJS+= $(DLOBJS:.o=$(EXPSUFF)) endif all: $(DLOBJS) $(DLOBJS): ec.o $(CC) -G -dynamic -o ec.so ec.o clean: rm -f $(DLOBJS) rm -f *.o *~ *# ============================================================ If it's not gcc that you are using, I think you should look for further clues in http://www.postgresql.org/docs/programmer/dfunc1976.htm --Gene
В списке pgsql-general по дате отправления: