<!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>CompilingWithSMLNJ - 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%;">
      CompilingWithSMLNJ
    <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">
You can compile MLton with <a href="SMLNJ">SML/NJ</a>, however the resulting compiler will run much more slowly than MLton compiled by itself.  We don't recommend using SML/NJ as a means of  <a href="PortingMLton">porting MLton to a new platform</a> or bootstrapping on a new platform.  <p>
If you do want to build MLton with SML/NJ, it is best to have a binary MLton package installed.  If you don't, here are some issues you may encounter when you run <tt>make&nbsp;nj-mlton</tt>. 
</p>
<p>
You will get (many copies of) the error message: 
</p>

<pre>/bin/sh: mlton: not found</pre><p>
The <tt>Makefile</tt> calls <tt>mlton</tt> to determine dependencies, and can proceed in spite of this error.  
</p>
<p>
If you don't have a <tt>mlton</tt> executable, you will get the error message:  
<pre>Error: cannot upgrade basis because the compiler doesn't work</pre>
</p>
<p>
We use <tt>upgrade-basis.sml</tt> to work around basis library differences, allowing a version of MLton written for a newer basis library to be compiled by an older version of MLton.  The file isn't necessary when building with SML/NJ, but is listed in <tt>$(SOURCES)</tt>, so the <tt>Makefile</tt> is attempting to build it. Building <tt>upgrade-basis.sml</tt> requires the old version of MLton to be around so that the right stubs can be built. 
</p>
<p>
To work around this problem, do one of the following. 
</p>

        <ul>

        <li>
<p>
 Manually tweak sources to remove $(UP) until you're finished   building MLton with SML/NJ and have a working MLton. 
</p>
</li>
        <li class="gap">
<p>
 Build <tt>upgrade-basis.sml</tt> on some other machine with a working   MLton and copy it over. 
</p>
</li>

        </ul>


<p>
If you don't have an <tt>mllex</tt> executable, you will get the error message: 
<pre>mllex: Command not found</pre>
</p>
<p>
Building MLton requires <tt>mllex</tt> and <tt>mlyacc</tt> executables, which are distributed with a binary package of MLton.  The easiest solution is to copy the front-end lexer/parser files from a different machine  (<tt>ml.grm.sml</tt>, <tt>ml.grm.sig</tt>, <tt>ml.lex.sml</tt>, <tt>mlb.grm.sig</tt>, <tt>mlb.grm.sml</tt>). 
</p>
</div>



<p>
<hr>
Last edited on 2006-10-19 17:06:01 by <span title="ppp-71-139-198-88.dsl.snfc21.pacbell.net"><a href="StephenWeeks">StephenWeeks</a></span>.
</body></html>
