<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="robots" content="index,nofollow">



<title>Installation - MLton Standard ML Compiler (SML Compiler)</title>
<link rel="stylesheet" type="text/css" charset="iso-8859-1" media="all" href="common.css">
<link rel="stylesheet" type="text/css" charset="iso-8859-1" media="screen" href="screen.css">
<link rel="stylesheet" type="text/css" charset="iso-8859-1" media="print" href="print.css">


<link rel="Start" href="Home">


</head>

<body lang="en" dir="ltr">

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-833377-1";
urchinTracker();
</script>
<table bgcolor = lightblue cellspacing = 0 style = "border: 0px;" width = 100%>
  <tr>
    <td style = "
		border: 0px;
		color: darkblue; 
		font-size: 150%;
		text-align: left;">
      <a class = mltona href="Home">MLton MLTONWIKIVERSION</a>
    <td style = "
		border: 0px;
		font-size: 150%;
		text-align: center;
		width: 50%;">
      Installation
    <td style = "
		border: 0px;
		text-align: right;">
      <table cellspacing = 0 style = "border: 0px">
        <tr style = "vertical-align: middle;">
      </table>
  <tr style = "background-color: white;">
    <td colspan = 3
	style = "
		border: 0px;
		font-size:70%;
		text-align: right;">
      <a href = "Home">Home</a>
      &nbsp;<a href = "Index">Index</a>
      &nbsp;
</table>
<div id="content" lang="en" dir="ltr">
MLton runs on a variety of platforms and is distributed in both source and binary form.  The format for the binary package depends on the platform.  The binary package will install under <tt>/usr</tt> or <tt>/usr/local</tt>, depending on the platform.  A <tt>.tgz</tt> or <tt>.tbz</tt> binary package should be extracted in the root directory. If you install MLton somewhere else, you must set the <tt>lib</tt> variable in the <tt>/usr/bin/mlton</tt> script to the directory that contains the libraries (<tt>/usr/lib/mlton</tt> by default). <p>
MLton requires that you have the <a class="external" href="http://www.gnu.org/software/gmp/gmp.html"><img src="moin-www.png" alt="[WWW]" height="11" width="11">GNU multiprecision library</a> installed on your machine.  MLton must be able to find both the <tt>gmp.h</tt> include file and the <tt>libgmp.a</tt> or <tt>libgmp.so</tt> library. If you see the error message <tt>gmp.h:&nbsp;No&nbsp;such&nbsp;file&nbsp;or&nbsp;directory</tt>, you should copy <tt>gmp.h</tt> to <tt>/usr/lib/mlton/self/include</tt>.  If you see the error message <tt>/usr/bin/ld:&nbsp;cannot&nbsp;find&nbsp;-lgmp</tt>, you should add a <tt>-link-opt&nbsp;-L</tt> argument in the <tt>/usr/bin/mlton</tt> script so that the linker can find <tt>libgmp</tt>.  If, for example, <tt>libgmp.a</tt> is in <tt>/tmp</tt>, then add <tt>-link-opt&nbsp;-L/tmp</tt>. 
</p>
<p>
Installation of MLton creates the following files and directories. 
</p>

    <ul>

    <li>
<p>
 <tt>/usr/bin/mllex</tt>  <br>
The <a class="nonexistent" href="MLLex">MLLex</a> lexer generator. 
</p>
</li>
    <li class="gap">
<p>
 <tt>/usr/bin/mlnlffigen</tt>  <br>
The <a href="MLNLFFI">ML-NLFFI</a> tool. 
</p>
</li>
    <li class="gap">
<p>
 <tt>/usr/bin/mlprof</tt>  <br>
A <a href="Profiling">Profiling</a> tool. 
</p>
</li>
    <li class="gap">
<p>
 <tt>/usr/bin/mlton</tt>  <br>
A script to call the compiler.  This script may be moved anywhere,  however, it makes use of files in <tt>/usr/lib/mlton</tt>.  
</p>
</li>
    <li class="gap">
<p>
 <tt>/usr/bin/mlyacc</tt>  <br>
The <a class="nonexistent" href="MLYacc">MLYacc</a> parser generator. 
</p>
</li>
    <li class="gap">
<p>
 <tt>/usr/lib/mlton</tt>  <br>
Directory containing libraries and include files needed during  compilation. 
</p>
</li>
    <li class="gap">
<p>
 <tt>/usr/share/man/man1/mllex.1</tt>, <tt>mlnlffigen.1</tt>, <tt>mlprof.1</tt>, <tt>mlton.1</tt>, <tt>mlyacc.1</tt>  <br>
Man pages. 
</p>
</li>
    <li class="gap">
<p>
 <tt>/usr/share/doc/mlton</tt>  <br>
Directory containing the user guide for MLton, mllex, and mlyacc,  as well as example SML programs (in the <tt>examples</tt> dir), and  license information. 
</p>
</li>

    </ul>


<h2 id="head-0a0a9f2a6772942557ab5355d76af442f8f65e01">Hello, World!</h2>
<p>
Once you have installed MLton, create a file called <tt>hello-world.sml</tt> with the following contents. 
</p>

<pre>print "Hello, world!\n";
</pre>Now create an executable, <tt>hello-world</tt>, with the following command. 
<pre>mlton hello-world.sml
</pre>You can now run <tt>hello-world</tt> to verify that it works.  There are more small examples in <tt>/usr/share/doc/mlton/examples</tt>. <h2 id="head-5a23e19b85078e1861c93e3cc0336d20456af4e0">Installation on Cygwin</h2>
<p>
When installing the Cygwin <tt>tgz</tt>, you should use Cygwin's <tt>bash</tt> and <tt>tar</tt>.  The use of an archiving tool that is not aware of Cygwin's mounts will put the files in the wrong place. 
</p>
</div>



<p>
<hr>
Last edited on 2007-08-23 04:13:31 by <span title="c-71-57-91-146.hsd1.il.comcast.net"><a href="MatthewFluet">MatthewFluet</a></span>.
</body></html>
