12 Platform-specific notes
This section discusses issues that arise when running or building
MLton on various platforms.
12.1 Running on Cygwin/Windows
MLton uses the Cygwin
emulation layer to provide a Posix-like environment while running on a
Windows machine. To run MLton on Windows, you must first install
Cygwin on your machine. To do this, visit the Cygwin site from your
Windows machine and run their setup.exe script. Then, you can
unpack the MLton binary tgz in your Cygwin environment. This
version of MLton was built on Cygwin 1.5.5-1.
To run MLton cross-compiled executables on Windows, you must
install the Cygwin dll on the Windows machine.
Here are the known problems using MLton on Cygwin.
- Time profiling is disabled.
- Due to several bugs in Cygwin's emulation of fork, Posix.Process.fork is disabled. Any use of fork will raise
OS.SysErr. For idiomatic uses of fork plus exec,
you can instead use the MLton.Process.spawn family of functions, which
work on both Cygwin and Linux.
- We have seen some strangeness in Cygwin's emulation of signals and
signal handlers, but have not been able to pin it down.
12.2 Running on FreeBSD
Here are the known problems using MLton on FreeBSD.
- The executables often run more slowly than on a comparable Linux
machine. We conjecture that part of this is due to costs due to heap
resizing and kernel zeroing of pages. Any help in solving the problem
would be appreciated.
Here are the known problems building MLton on FreeBSD.
- MLton Makefiles use GNU extensions, so you should use gmake
instead of make.
12.3 Running on Sparc/Solaris
Here are some things that may affect performance on Sparc.
- When compiling for Sparc, MLton only supports the C code generator
(-native false). Hence, performance is not as good as it might
be and compile times are longer. Also, the quality of code generated
by gcc is important. By default, MLton calls gcc -O1.
You can change this by calling MLton with -cc-opt -O2. We
have seen this speed up some programs by as much as 30%, especially
those involving floating point; however, it can also more than double
compile times.
- When compiling for Sparc, MLton uses -align 8 by default.
While this speeds up reals, it also may increase object sizes. If
your program does not make significant use of reals, you might see a
speedup with -align 4.
Here are the known problems building MLton on Sparc/Solaris.
- You must install the binutils, gcc, and make
packages. You can find out how to get these at
sunfreeware.com.
- Making the documentation requires that you install latex
and dvips, which are available in the tetex package. It
also requires hevea, for which we haven't yet tracked down a
package.
- Bootstrapping is so slow as to be impractical (many hours on a
500MhZ UltraSparc). For this reason, we strongly recommend building
with a Linux to Solaris cross compiler (Section 13).