Skip to content

Instantly share code, notes, and snippets.

@tedz2usa
Last active April 8, 2024 13:37
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tedz2usa/725307535cb4c336941d13e2e5cf86eb to your computer and use it in GitHub Desktop.
Save tedz2usa/725307535cb4c336941d13e2e5cf86eb to your computer and use it in GitHub Desktop.
Installing SML-NJ on Ubuntu 18.04
Installation Tips for SML/NJ on Ubuntu 18.04
Ted Zhu
First, follow the steps outlined in the SML/NJ installation instructions for Unix:
http://smlnj.org/install/
The final step,
$ config/install.sh
Should reveal the following errors:
Error:
mkdir: cannot create directory ‘/usr/local/sml/bin’: Permission denied
config/install.sh: !!! Unable to make directory /usr/local/sml/bin!
Resolution:
Run sudo before the install script:
$ sudo config/install.sh
______________________________________________________________
Error:
/usr/local/sml/config/chk-global-names.sh: 19: /usr/local/sml/config/chk-global-names.sh: cc: not found
config/install.sh: !!! Problems checking for underscores in asm names.
Resolution:
Install compilation tools for Ubuntu (gcc, etc.)
$ sudo apt install build-essential
______________________________________________________________
Eror:
config/install.sh: !!! SML/NJ requires support for 32-bit executables. On Debian Linux,
you may need to apt-get install gcc-multilib g++-multilib ia32-libs. On RH Fedora, try: yum install glibc-devel.i686 libgcc.i686
Resolution:
Attempt to install all the SML/NJ recommended packages for 32-bit support.
$ sudo apt-get install gcc-multilib g++-multilib ia32-libs
______________________________________________________________
Error:
Package ia32-libs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
lib32ncurses5 lib32z1
E: Package 'ia32-libs' has no installation candidate
Resolution:
Install only "gcc-multilib"
$ sudo apt-get install gcc-multilib
______________________________________________________________
Now the final installation step of SML/NJ should work successfully, on Ubuntu 18.04 (64-bit).
$ sudo config/install.sh
...
... Installation complete.
______________________________________________________________
To add the 'sml' executable to PATH, add the following line to ~/.profile:
PATH=$PATH:/usr/local/sml/bin
Restart your terminal and you should be able to run 'sml'.
______________________________________________________________
To enable the arrow keys for history navigation inside the 'sml' interpreter, install and use rlwrap.
$ sudo add-apt-repository universe
$ sudo apt-get update
$ sudo apt install rlwrap
Then to run 'sml' with arrow key history navigation:
$ rlwrap sml
______________________________________________________________
Please leave a comment below if this guide has helped you!
@ahmadmust8
Copy link

how to add PATH to ~/.profile
when i want to access ~/.profile i get this message :
bash: /home/ahmad/.profile: Permission denied

@velrajganesan
Copy link

thanks, awesome post!.

@mikhaildubov
Copy link

Thank you - this saved me a lot of time.

@prathikshaa-r
Copy link

prathikshaa-r commented Jan 16, 2020

Or maybe just https://riptutorial.com/sml/example/23479/installation
sudo apt install smlnj
Since Ubuntu has a package manager!

@twome
Copy link

twome commented Jan 26, 2021

I get this error running config/install.sh after installing only gcc-multilib:

[ ... seemingly normal installer output ...]
echo "v-x86-linux" > v-x86-linux
gcc -ansi -c -O2 -m32 -I../config -I../objs -I../include ../config/gen-common.c
gcc -ansi -O2 -m32 -DHOST_X86 -DTARGET_X86 -DOPSYS_UNIX -DOPSYS_LINUX -D_GNU_SOURCE -DGNU_ASSEMBLER -DDLOPEN -D_FILE_OFFSET_BITS=64 -I../config -I../objs -I../include -o gen-sizes ../config/gen-sizes.c gen-common.o
./gen-sizes
./gen-sizes: 1: ./gen-sizes: Syntax error: word unexpected (expecting ")")
makefile:142: recipe for target 'ml-sizes.h' failed
make[1]: *** [ml-sizes.h] Error 2
make[1]: Leaving directory '/home/leon/cl-apps/smlnj/base/runtime/objs'
mk.x86-linux:30: recipe for target 'all' failed
make: *** [all] Error 2
config/install.sh: !!! Run-time system build failed for some reason.

I'm running WSL.

@HUGHNew
Copy link

HUGHNew commented Apr 4, 2021

It seems that I can do this simply by apt running WSL2(Ubuntu 18.04 LTS)
sudo apt install smlnj -y

@lyfer233
Copy link

Thank you very much. The advise is useful and perfect!

@rhsiun
Copy link

rhsiun commented Jan 31, 2022

Thank you very much!!!

@ritog
Copy link

ritog commented May 21, 2023

Thanks, it really helped me.

Install only "gcc-multilib"

I also installed lib32z1 along with it.


Here are the pages that were also helpful:

  1. https://askubuntu.com/questions/578172/cannot-install-ia32-libs-on-ubuntu-14-04-64bit
  2. http://www.smlnj.org/install/
  3. http://www.smlnj.org/dist/working/110.80/

@shubhamkumar13
Copy link

I am getting the following error : ./install.sh: !!! File config/preloads is missing.
I am using ubuntu 20.04

@ameryisafreeelf
Copy link

Very helpful, appreciate you going step by step!

@GShadow5
Copy link

GShadow5 commented Apr 8, 2024

@shubhamkumar13 I know I'm late to the party, but I ran into this issue for a moment too. For anyone who also has the issue, the solution is to run the script from outside the config folder.
./config/install.sh
instead of
./install.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment