More on shared objects problem - Mailing list pgsql-hackers

From D'Arcy" "J.M." Cain
Subject More on shared objects problem
Date
Msg-id m11965j-0000dNC@druid.net
Whole thread Raw
Responses Re: [HACKERS] More on shared objects problem
List pgsql-hackers
Many thanks to everyone who helped so far especially Todd Vierling for
the RTFF.  I think I am closer but I still have a problem.  Here is the
rule in my makefile now.

.o.so:   ld -shared -L${PGDIR}/lib --export-dynamic -rpath ${PGDIR}/lib \           -lpq -lc -o $@ $<

ldd now shows this.

glaccount.so:        -lpq => /usr/pgsql/lib/libpq.so        -lc.12 => /usr/lib/libc.so.12

I then went into the PostgreSQL code and added a dlerror() call to the
error message after dlopen().  I still get an error but now I get a little
more information.

ERROR:  Load of file /usr/pgsql/modules/glaccount.so failed: dlopen (/usr/pgsql/modules/glaccount.so) failed
(/usr/pgsql/modules/glaccount.so:Undefined symbol "CurrentMemoryContext" (reloc type = 6, symnum = 6))
 

CurrentMemoryContext is defined in the postmaster (I checked with nm) which
is the program doing the dlopen.  Here is the relevant line from nm.

08138544 D CurrentMemoryContext

So it looks like everything should be working but it doesn't.  Is this
possibly a case of bogus error message or am I misunderstanding it?  Is
ELF fully baked or do I need to revert to a pre-ELF system?

Hmm.  I just noticed that nm is an old binary and that it doesn't build
from current sources due to a missing bfd.h.  Is nm like ldconfig and
not needed any more on ELF systems or is there just a problem with
the current sources?

-- 
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 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.


pgsql-hackers by date:

Previous
From: Vadim Mikheev
Date:
Subject: Re: [HACKERS] Delaying insertion of default values
Next
From: Vince Vielhaber
Date:
Subject: Re: [HACKERS] postgres Web problem