<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="AsciiDoc 8.6.10">
<title>CompilingWithSMLNJ</title>
<link rel="stylesheet" href="./asciidoc.css" type="text/css">
<link rel="stylesheet" href="./pygments.css" type="text/css">


<script type="text/javascript" src="./asciidoc.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
asciidoc.install();
/*]]>*/
</script>
<link rel="stylesheet" href="./mlton.css" type="text/css">
</head>
<body class="article">
<div id="banner">
<div id="banner-home">
<a href="./Home">MLton 20201002</a>
</div>
</div>
<div id="header">
<h1>CompilingWithSMLNJ</h1>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="paragraph"><p>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&#8217;t recommend using SML/NJ as a means of
<a href="PortingMLton">porting MLton</a> to a new platform or bootstrapping on a
new platform.</p></div>
<div class="paragraph"><p>If you do want to build MLton with SML/NJ, it is best to have a binary
MLton package installed.  If you don&#8217;t, here are some issues you may
encounter when you run <span class="monospaced">make smlnj-mlton</span>.</p></div>
<div class="paragraph"><p>You will get (many copies of) the error messages:</p></div>
<div class="listingblock">
<div class="content monospaced">
<pre>/bin/sh: mlton: command not found</pre>
</div></div>
<div class="paragraph"><p>and</p></div>
<div class="listingblock">
<div class="content monospaced">
<pre>make[2]: mlton: Command not found</pre>
</div></div>
<div class="paragraph"><p>The <span class="monospaced">Makefile</span> calls <span class="monospaced">mlton</span> to determine dependencies, and can
proceed in spite of this error.</p></div>
<div class="paragraph"><p>If you don&#8217;t have an <span class="monospaced">mllex</span> executable, you will get the error
message:</p></div>
<div class="listingblock">
<div class="content monospaced">
<pre>mllex: Command not found</pre>
</div></div>
<div class="paragraph"><p>Building MLton requires <span class="monospaced">mllex</span> and <span class="monospaced">mlyacc</span> 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
(<span class="monospaced">ml.grm.sml</span>, <span class="monospaced">ml.grm.sig</span>, <span class="monospaced">ml.lex.sml</span>, <span class="monospaced">mlb.grm.sig</span>,
<span class="monospaced">mlb.grm.sml</span>).</p></div>
</div>
</div>
</div>
<div id="footnotes"><hr></div>
<div id="footer">
<div id="footer-text">
</div>
<div id="footer-badges">
</div>
</div>
</body>
</html>
