[Gc] Re: Mercury 0.11.0 418 failed tests

Fergus Henderson fjh at cs.mu.oz.au
Tue Feb 10 23:52:58 PST 2004

Richard O'Keefe reported a problem when using Mercury on his Sun Blade 100
(sparc-sun-solaris2.9) system.  The symptom was that although Mercury
programs compiled and linked fine, when they were executed the run-time
loader (ld.so.1) reported a relocation error because it could not resolve
the symbol "GC_stackbottom".

I am CC'ing the mailing list for the Boehm et al collector,
because the same problem may also affect other users of the collector.

The problem is due to a name clash.  The problem is that the Mercury
programs are getting linked with the libgc.so from /opt/SUNWspro/lib
rather than from the one that comes with the Mercury distribution,
and presumably the one in /opt/SUNWspro/lib doesn't define GC_stackbottom.

It was a mistake to ever name a library "gc" -- that is a poor choice
of name which is very likely to result in name clashes.

But nevertheless, I don't see why the Solaris linker is choosing the one
in /opt/SUNWspro/lib.  After all, the Mercury linker script (ml)
explicitly passes `-L' and `-R' options naming the directory which
contains our libgc.so (see the gcc invocation line below).
Anyone have any ideas on how to tell the Solaris linker to link
in our version of libgc.so rather than the SUNWspro one?

I suppose we can resolve the problem by renaming our version of the GC
library as "mer_gc", so that the .so file becomes "libmer_gc.so".
I think it would also be a good idea for the original Boehm et al version
to be renamed to something more distinctive, e.g. "boehm_gc".

P.S.  In the mean time, Richard, I suggest you use the work-around that I
suggested earlier of linking statically.

On 11-Feb-2004, Richard A. O'Keefe <ok at cs.otago.ac.nz> wrote:
> ml --grade asm_fast.gc     -v         --    -o hello hello_init.o \
>         hello.o \
> ml: using grade `asm_fast.gc'
> gcc -s -o hello hello_init.o hello.o -L/users/local/mercury/lib/mercury/lib/asm_fast.gc/sparc-sun-solaris2.9 -L/users/local/mercury/lib/mercury/lib/sparc-sun-solaris2.9 -L/usr/local/lib -R/users/local/mercury/lib/mercury/lib/asm_fast.gc/sparc-sun-solaris2.9 -R/users/local/mercury/lib/mercury/lib/sparc-sun-solaris2.9 -R/usr/local/lib -lmer_std -lmer_rt -lgc -lm |
> mdemangle
> f% ldd ./hello
>         libmer_std.so =>         /users/local/mercury/lib/mercury/lib/asm_fast.gc/sparc-sun-solaris2.9/libmer_std.so
>         libmer_rt.so =>  /users/local/mercury/lib/mercury/lib/asm_fast.gc/sparc-sun-solaris2.9/libmer_rt.so
>         libgc.so =>      /opt/SUNWspro/lib/libgc.so
>         libm.so.1 =>     /usr/lib/libm.so.1
>         libc.so.1 =>     /usr/lib/libc.so.1
>         libdl.so.1 =>    /usr/lib/libdl.so.1
>         /usr/platform/SUNW,Sun-Blade-100/lib/libc_psr.so.1

Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <https://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

More information about the Gc mailing list