[MLton-user] static link on mac

Ville Laurikari ville at laurikari.net
Sat Sep 29 23:06:59 PDT 2007


On Sat, Sep 29, 2007 at 11:17:27PM -0400, Sean McLaughlin wrote:
> I'm using a bunch of external libraries, and would like to make a
> statically linked binary.  On linux I just add -link-opt '-static'
> and it works perfectly.  On mac though, the same thing gives the

Take a look at this:
  http://developer.apple.com/qa/qa2001/qa1118.html

Basically, what that means is that (normally) the C runtime can only
be linked to dynamically.  This is almost always desirable.

I believe what you really want is to statically link only your
external libraries (and perhaps libgmp), not everything.  You can
achieve this by using something like "-link-opt some/path/libsome.a"
for mlton, instead of just "-link-opt -Lsome/path -lsome".

To link with GMP statically, you should either have only a static
version of libgmp available on your system, or replace "-lgmp" with an
explicit reference to the static library (libgmp.a).  You can do this
by editing the mlton wrapper script manually.


--
http://www.iki.fi/vl/



More information about the MLton-user mailing list