How to build SML#

This page describes how to build SML# 0.60 series and version 0.90 from the source tarball.

Build on UNIX like systems (including Mac OS X)

Prerequisites

SML/NJ or MLton
Necessary to build SML# compiler and extra tools. Required version is SML/NJ 110.65 or above, or MLton-20100608 or above. The latest version is recommended.
GNU MP Bignum Library
Necessary to build SML# runtime system. Both version 4 series and version 5 series are OK, but note that SML# requires 32-bit build. This version of SML# supports only 32-bit mode.
C++ compiler (only for 0.60 series)
Necessary to build SML# virtual machine. It must be able to generate 32-bit code. GCC is recommended.
ISO C99 compiler
Necessary to build SML# native runtime library. It must be able to generate 32-bit code. GCC is recommended.
POSIX compatible commands and tools
A Bounce shell, make, sed and standard file commands are needed to build SML#. We have been writing Makefiles only with standard features so that SML# can be built on any UNIX like systems. If you have some trouble in Makefile, please let us know and use GNU tools for the time being.

(1) Build and install 32-bit GMP library

If you don't have installed 32-bit GMP library, build it first. If you already have, skip this section.

If you use a 32-bit system, just do configure && make && make install. For further descriptions for installation of GMP, please consult the documents of GMP.

$ ./configure
$ make
# make install

If you use a 64-bit system, you must specify ABI=32 to build a 32-bit version of GMP library.

$ ./configure ABI=32
$ make
# make install

You may use --prefix option in order to prevent new one overwriting pre-installed GMP library. For details of configure options of GMP, please consult some documentations of GMP library.

(2) Build SML# compiler and runtime

Extract the source package, move to SMLSharp directory, and do configure.

$ gzip -cd smlsharp-0.40.tar.gz | tar xvf -
$ cd smlsharp-0.40/SMLSharp
$ ./configure

If you have installed GMP library in any other place than standard directories, specify where GMP is to CPPFLAGS and LDFLAGS.

$ ./configure CPPFLAGS=-I/where/is/gmp/include LDFLAGS=-L/where/is/gmp/lib

If your C and C++ compiler works in 64-bit mode by default, specify CC and CXX to use 32-bit mode compiler. For example:

$ ./configure CC='gcc -m32' CXX='g++ -m32'

If your linker works in 64-bit mode by default, specify LD to use 32-bit mode linker. For example:

$ ./configure LD='ld -m elf_i386'

On x64 systems, native code generation is disabled by default since SML# 0.50 is not able to generate x64 code. To enable the native code generator for x86, specify --enable-native option with your system name.

$ ./configure --enable-native=x86-linux    (for Linux system)
$ ./configure --enable-native=x86-darwin   (for Mac OS X)

An typical example to build SML# on an x64 linux is the following:

$ ./configure CC='gcc -m32' CXX='g++ -m32' LD='ld -m elf_i386' \
              CPPFLAGS=-I/where/is/gmp32/include \
              LDFLAGS=-L/where/is/gmp32/lib \
              --enable-native=x86-linux

If you intend to build SML# compiler with MLton, specify --with-mlton option.

$ ./configure --with-mlton

After the configure is successfully finished, just do make.

$ make

If you choose SML/NJ, the make command produces heap images and stub shell scripts. If you choose MLton, native executable files are produced.

(3) Install SML# compiler and runtime.

Do make install.

 # make install

Build on Windows

Prerequisites

MSYS or cygwin
Just one of them is necessary to build SML#. Do not mix both. If you have already installed both, you need to disable one of them by removing it from %PATH% and so on before trying to build SML#. It is not recommended to use cross compiler of cygwin for mingw. We have not tried building SML# on a 64-bit environment.
SML/NJ or MLton
either SML/NJ 110.65 or above, or MLton-20100608 or above is required to build SML#. The latest version is preferred. For mingw environment, Windows binary package distributed on SML/NJ website or MLton website is recommended.
GNU MP Bignum Library
Necessary to build SML# runtime system. Both version 4 series and version 5 series are OK, but note that SML# requires 32-bit build.

(1) Build and install GMP library

If you don't have installed GMP library, build it first. Just do configure && make && make install to build and install GMP library. For details of building GMP, please consult some documentations of GMP library.

(2) Build SML# compiler and runtime with SML/NJ

Extract the source package, move to SMLSharp directory, and do confiure.

$ gzip -cd smlsharp-0.50.tar.gz | tar xvf -
$ cd smlsharp-0.40/SMLSharp
$ ./configure

If you have installed GMP library in any other place than standard directories, specify where GMP is to CPPFLAGS and LDFLAGS.

$ ./configure CPPFLAGS=-I/where/is/gmp/include LDFLAGS=-L/where/is/gmp/lib

If you intend to build SML# compiler with MLton, specify --with-mlton option.

$ ./configure --with-mlton

After the configure is successfully finished, just do make.

$ make

(4) Install SML# compiler and runtime.

Do make install.

 # make install
Last modified:2011/09/15 05:58:46
Keyword(s):
References:[SML# Download]