Subject: shared libraries, dlopen and debugging
To: None <>
From: Brad Knotwell <>
List: tech-toolchain
Date: 10/12/2000 06:07:23
Hello all--

Sorry to bother everyone, but I'm pretty close to out of ideas on a
coupla problems I've been having.


Environment:  pretty vanilla 1.4.2 on x86

file command output:

ixbash-2.04$ file /usr/local/mosml/lib/
/usr/local/mosml/lib/ symbolic link to
ixbash-2.04$ file /usr/local/mosml/lib/
/usr/local/mosml/lib/ NetBSD/i386 demand paged shared library not stripped

relevant portion of ldconfig -r response:

      43:-lmpq.1.0 => /usr/local/mosml/lib/

compile commands:

gcc -Dunix -O2 -fno-defer-pop -fPIC -I/usr/local/mosml/include -I /usr/pkg/include/pgsql -c -o mpq.o mpq.c
ld -shared --export-dynamic -lcrypt -o mpq.o /usr/pkg/lib/libpq.a


Problem #1:

dlopen appears unable to implicitly (absolute paths appear to work
correctly) find libraries w/o major minor numbers.  See the
hocus-pocus with versioning above. 

Problem #2:

When I do create a major/minor numbered file and create a link to it,
the moscow_ml runtime appears to load the library and then dumps core
immediately.  NOTE:  the same exact code works fine on a different
operating system.


I've been down the ktrace (too little information; especially if the
problem has something to do with dependent libraries) and gdb (debugging
the running program or the core image hasn't been fruitful).
Similarly, I've searched for the appropriate magical command-link
incantations for the compiler and linker, but I've had no luck.
Similarly, I've poked around the mosml runtime source as well as
contacted the maintainer (NetBSD port and the compiler).

Do you have any advice on what troubleshooting path might be useful
next?  If I should just wait for 1.5 and ELF, this would be useful to
know as well.

Thanks and sorry this rambled for so long.