[m-dev.] Debugging and dynamic linking

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Nov 27 09:32:24 AEDT 2004


On 26-Nov-2004, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> Maria wants to `--trace deep' a module in a program that links against a
> C library that uses dlopen.  Can anybody tell me precisely what these
> linker errors mean and what should be done to fix the problem?

Are you sure those are errors?  They look a bit like warnings to me.
The linker is warning that the application is statically linked but
uses dlopen(), and that this might have some unexpected consequences.
In particular, if dlopen() is called at run-time, the implementation of
dlopen() will attempt to read the shared libraries at run-time.

dlopen() is used by the debugger's interactive query facility.
If Maria is not planning to use that facility, she can ignore this warning.

Alternatively, the best fix is probably to compile and link the
application for with dynamic linking rather than static linking.
The way to do that is explained in the README.Linux file:

 | To use the shared libraries, you must compile your program with
 | `mmc --pic-reg' and link with `ml --shared' or add
 | `MGNUCFLAGS=--pic-reg' and `MLFLAGS=--shared' to your Mmake file.
 | If you are using `mmc --make' you can set the MERCURY_LINKAGE Mmake
 | variable to "shared" in the Mercury.options file or the environment,
 | or use `mmc --make --linkage shared'.

-- 
Fergus Henderson                    |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list