Installing SML-NJ

You should download SML-NJ here, and follow the installation guide Here.

Above link should work for Unix, Linux, MacOS X on PowerPC, Windows operating systems.

Specifically, for Ubuntu, you can do the following:

  1. Make a directory where you want to install, and set your path in .bashrc by export SMLROOT=$HOME/Documents/Koke_Cacao/sml.
  2. Download config.tgz and make sure it is the latest version
  3. try tar xzvf config.tgz and config/, if encountered any error, check out this Github Gist for solution
  4. Set your path in .bashrc to PATH=$PATH:$SMLROOT/bin

Installing MLton

You should download binary package Here. It only seem to support darwin macOS and linux.

Before installing MLton, you should install GMP (GNU Multiple Precision arithmetic library) because MLton depends on it.

You can download GMP on this page. Then in the downloaded directory (after untar), following this official guide, do the following commands:

make check
make install

Then you should find some libraries libgmp.[a/la/so/so.10/so.10.4.1] in path /usr/local/lib.

After you untar the MLton binary package, do make install in the directory. You should see /usr/bin/mlton successfully installed and added to your path automatically

Installing MLP

To install MLP, you should install both MLton and GMP.

You should clone the code in this Github repository by doing git clone --depth 1 ...

In the cloned directory, open Makefile.config. Modify the following:

WITH_GMP_DIR := /home/koke_cacao/Documents/Koke_Cacao/SML/Workspace/gmp-6.2.1/
SMLNJ_DIR := /home/koke_cacao/Documents/Koke_Cacao/sml/

WITH-GMP_DIR should be set to your downloaded gmp directory. SMLNJ_DIR should be set to your SMLROOT path.

I am not sure whether above operations are necessary, since MPL detects Mlton automatically. MPL does not seem to work with SML-NJ without Mlton installed. It might automatically detect instead of relying on directory?

Then do make all and make install following the instructions in the github repository. After succeed, you should see /usr/local/bin/mpl successfully installed and added to your path automatically.

For tutorial on how to use MLP, see this Guthub repository


General tips: Make sure you clean all generated files when you retry build.

Dependency Error

If you have the following error message:

config/ !!! SML/NJ requires support for 32-bit executables. On Debian Linux, you may need to apt-get install gcc-multilib g++-multilib ia32-libs.

Then do sudo apt-get install gcc-multilib g++-multilib ia32-libs

If you have the following error message:

E: Package 'ia32-libs' has no installation candidate and However the following packages replace it: lib32ncurses5 lib32z1

Then do sudo apt-get install gcc-multilib g++-multilib lib32ncurses5 lib32z1

Table of Content