Subject: More on shared objects problem
To: None <current-users@NetBSD.org, pgsql-hackers@PostgreSQL.org>
From: D'Arcy" "J.M. <darcy@druid.druid.net>
List: current-users
Date: 07/27/1999 08:12:19
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.