Subject: Re: [HACKERS] Problem with dlopen and PostgreSQL - load of file failed
To: Tom Lane <tgl@sss.pgh.pa.us>
From: D'Arcy" "J.M. <darcy@druid.druid.net>
List: current-users
Date: 07/25/1999 22:39:47
Thus spake Tom Lane
> "D'Arcy" "J.M." Cain <darcy@druid.net> writes:
> > ERROR:  Load of file /usr/pgsql/modules/glaccount.so failed: dlopen (/usr/pgsql/modules/glaccount.so) failed
> 
> Dynamic loaders tend to be pretty horrid about that :-(.  My bet is
> a failure to resolve an external reference to another shared library.
> Try using "ldd" (or local equivalent) on the shlib to find out what
> other shlibs it depends on.  Be suspicious if ldd fails to show all the
> dependencies you expect (eg, practically anything will depend on libc);
> that probably means the linker failed to locate the other shlib when
> linking this one.  Next make sure all those other shlibs are in the
> right places, and are known to the system if your system keeps a table
> of shlibs.  Then start checking *their* dependencies...

OK, so what do I do to fix it?  Do I need more options to my link command?
My link rule is now this.

.o.so:
    ld -Bshareable -L ${PGDIR}/lib -lpq -lc -o $@ $<

And here is what ldd shows.

[darcy@smaug:/usr/pgsql/modules] $ ldd glaccount.so
glaccount.so:
         -lpq => not found
         -lc.12 => /usr/lib/libc.so.12

The file libpq.so exists in the directory ${PGDIR}/lib and I still get the
same problem.  I tried nm and I get the following external symbols.

[darcy@smaug:/usr/pgsql/modules] $ nm -Cn glaccount.so
         U CurrentMemoryContext
         U MemoryContextAlloc
         U _ctype_
         U elog
         U sprintf
         U strtol
[... internal symbols ...]

I assume those first two are in the libpq library that wasn't found.

And I just now had a panic while investigating why ldconfig is not being built.
Can I assume that ldconfig is not used in an ELF system?  Did faking it
out and trying to build it cause the panic?  The panic was;

panic: lockmgr: pid %d, not exclusive lock holder %d unlocking

I have crash files if anyone is interested.

-- 
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.