These instructions are for installing Standard ML of New Jersey (SML/NJ) on Unix and Unix-like operating systems (including Cygwin, Linux, and macOS) from source and the pre-compiled bin files.
To install SML/NJ on macOS using the installer package, see the macOS installation instructions.
To install SML/NJ on Windows using the installer, the Windows installation instructions.
The standard Unix installation of SML/NJ is mostly automated via a installation shell script and installer written in SML. The only manual steps are downloading the installer, unbundling it, and running the script.
Create a directory to do the installation and cd to that directory.
Then use either curl or wget to down load the config.tgz file. For example,
% wget https://smlnj.org/dist/working/110.98/config.tgz
% tar -xzf config.tgz
Optionally edit the
config/targetsfile to add or remove installation targets.
Run the install script. For some x86 Unix systems, there is a choice of 32 vs. 64-bit installations, with the default being 64 bits. For other systems, the installation is always 32-bit.
% config/install.sh options
For systems that support 64-bit installations, the installer options are
Installing 64-bit SML/NJ
As of version 110.94, SML/NJ supports 64-bit installations on most x86-based Unix systems. It is possible to have both the 32 and 64-bit versions installed in the same place (see below for details). The default installation for these systems is 64-bits (as of version 110.98); thus, one can just run the installer command without options:
Installing 32-bit SML/NJ
For non-x86 systems, the only installation option is 32-bits, which is what you get by running the install command without options:
As noted above, the default on x86 systems that report their hardware as “`x86_64`” is 64-bits. If you want to install a 32-bit version instead, you can use the following command:
% config/install.sh -default 32
It is also possible to have both the 32 and 64-bit versions installed in the same place (see below for details).
Troubleshooting the 32-bit install
To install the 32-bit version on a 64-bit architecture, you must have support for compiling and running 32-bit binaries. On macOS (prior to Mojave), this support is standard, but most 64-bit Linux systems are not configured with 32-bit support. In such a case, you will get the message
!!! SML/NJ requires support for 32-bit executables
during the install process. To fix this problem, you will need to acquire the 32-bit emulation libraries for your particular Linux distribution.
For Debian (7.0 Wheezy and later) and recent version of Ubuntu, you will need to enable multiarch support. See https://wiki.ubuntu.com/MultiarchSpec for details, or try the following commands:
% dpkg --add-architecture i386 % apt-get update % apt-get install libc6:i386
You may also need to install the two following packages:
% apt-get install gcc-multilib g++-multilib
For RedHat Fedora (at least Fedora 16), you will need to install
% yum install glibc-devel.i686
For Red Hat Enterprise Linux (or CentOS), you may also have to install the rpm package libgcc-multilib, e.g.:
% yum groupinstall "Development tools" % yum install libgcc.i686 % yum install glibc-devel.i686
Older instructions for RHEL and CentOS: download the
package from rpmseek.com and then run
rpm -ivh libgcc-multilib-xxx.x86_64.rpm
where the libgcc-multilib package is the one you downloaded.
For openSUSE use the YaST administration tool to install the
Installing both 32-bit and 64-bit versions of SML/NJ
It is possible to install both versions in the same location by running
install.sh script twice. For example, the commands
% config/install.sh -32 % config/install.sh -default 64
will install both versions with the 64-bit version as default. One can then use the command sml -32 to run the 32-bit version of the system. Note that the default version must be installed second.