<!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">

<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 20051202</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.  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> 
</p>
</li>

            <ul>

   The <a class="nonexistent" href="MLLex">MLLex</a> lexer generator. 
            </ul>


    <li class="gap">
<p>
 <tt>/usr/bin/mlnlffigen</tt> 
</p>
</li>

            <ul>

   The <a href="MLNLFFI">ML-NLFFI</a> tool. 
            </ul>


    <li class="gap">
<p>
 <tt>/usr/bin/mlprof</tt> 
</p>
</li>

            <ul>

   A <a href="Profiling">Profiling</a> tool. 
            </ul>


    <li class="gap">
<p>
 <tt>/usr/bin/mlton</tt> 
</p>
</li>

            <ul>

   A script to call the compiler.  This script may be moved anywhere,    however, it makes use of files in <tt>/usr/lib/mlton</tt>.  
            </ul>


    <li class="gap">
<p>
 <tt>/usr/bin/mlyacc</tt> 
</p>
</li>

            <ul>

   The <a class="nonexistent" href="MLYacc">MLYacc</a> parser generator. 
            </ul>


    <li class="gap">
<p>
 <tt>/usr/lib/mlton</tt> 
</p>
</li>

            <ul>

   Directory containing libraries and include files needed during    compilation. 
            </ul>


    <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> 
</p>
</li>

            <ul>

   Man pages. 
            </ul>


    <li class="gap">
<p>
 <tt>/usr/share/doc/mlton</tt> 
</p>
</li>

            <ul>

   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. 
            </ul>



    </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>. </div>



<p>
<hr>
Last edited on 2005-12-01 04:45:57 by <span title="ppp-71-139-183-221.dsl.snfc21.pacbell.net"><a href="StephenWeeks">StephenWeeks</a></span>.
</body></html>
