[m-dev.] executable sizes

Fergus Henderson fjh at cs.mu.OZ.AU
Fri May 16 03:56:35 AEST 2003

On 15-May-2003, Sam Haldane <samuelah at students.cs.mu.OZ.AU> wrote:
> I'm currently using mercury in a major project (for 481) and have also
> used it to write a program for a 330 assigment (a PCP solver), and let me
> say I reckon it's pretty slick.
> I was just wondering why the executables end up so large?  My PCP solver,
> which wasn't a complex or large program (in mercury at least) compiled to
> a 1.5MB binary under linux and slightly smaller on the uni machines.

This is mainly due to the Mercury standard library being linked in
statically by default.  If you use dynamical linking, the executables
will be a lot smaller.  See README.Linux in the Mercury source or binary
distribution for details.

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 Mmakefile.
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 <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  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