[MLton-user] dynamic linking to libgmp on os x

Matthew Fluet fluet at tti-c.org
Thu Feb 14 11:29:07 PST 2008


On Thu, 14 Feb 2008, Dave Herman wrote:
> It appears that MLton generates binaries in OS X that dynamically link to a 
> hard-wired path for libgmp.3.dylib. Is there a way to remove this hard-wiring 
> so that it'll work on any machine that has libgmp available anywhere in the 
> standard search path?

MLton simply calls gcc with "-lgmp -L/path/to/libgmp" to link the final 
executable.  If there is a way to remove this hard-wiring, it will be 
through some MachO linker magic (i.e., not specific to MLton).

Alternatively, you could statically link to gmp.  It would have been nice 
if one could do so with "-link-opt /path/to/libgmp.a", but that puts it at 
the end of the linker invocation, so the dynamic library gets used. You'll 
need to edit your /usr/local/bin/mlton script and replace the '-lgmp' with 
'/path/to/libgmp.a'.

[On MacOS, one can't use the simpler '-link-opt -static', because there 
aren't static versions of the system libraries.]



More information about the MLton-user mailing list