1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="AsciiDoc 8.6.8">
<title>Installation</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 20130715</a>
</div>
</div>
<div id="header">
<h1>Installation</h1>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="paragraph"><p>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 <span class="monospaced">/usr</span> or
<span class="monospaced">/usr/local</span>, depending on the platform. A <span class="monospaced">.tgz</span> or <span class="monospaced">.tbz</span> binary
package should be extracted in the root directory. If you install
MLton somewhere else, you must set the <span class="monospaced">lib</span> variable in the
<span class="monospaced">/usr/bin/mlton</span> script to the directory that contains the libraries
(<span class="monospaced">/usr/lib/mlton</span> by default).</p></div>
<div class="paragraph"><p>MLton requires that you have the <a href="GnuMP"> GNU multiprecision</a> library
installed on your machine. MLton must be able to find both the
<span class="monospaced">gmp.h</span> include file and the <span class="monospaced">libgmp.a</span> (or <span class="monospaced">libgmp.so</span> or
<span class="monospaced">libgmp.dylib</span>) library. If you see the error message <span class="monospaced">gmp.h: No such
file or directory</span>, you should copy <span class="monospaced">gmp.h</span> to
<span class="monospaced">/usr/lib/mlton/self/include</span>. If you see the error message
<span class="monospaced">/usr/bin/ld: cannot find -lgmp</span>, you should add a <span class="monospaced">-link-opt -L</span>
argument in the <span class="monospaced">/usr/bin/mlton</span> script so that the linker can find
<span class="monospaced">libgmp</span>. If, for example, <span class="monospaced">libgmp.a</span> is in <span class="monospaced">/tmp</span>, then add
<span class="monospaced">-link-opt -L/tmp</span>.</p></div>
<div class="paragraph"><p>Installation of MLton creates the following files and directories.</p></div>
<div class="ulist"><ul>
<li>
<p>
<span class="monospaced">/usr/bin/mllex</span>
</p>
<div class="paragraph"><p>The <a href="MLLex">MLLex</a> lexer generator.</p></div>
</li>
<li>
<p>
<span class="monospaced">/usr/bin/mlnlffigen</span>
</p>
<div class="paragraph"><p>The <a href="MLNLFFI">ML-NLFFI</a> tool.</p></div>
</li>
<li>
<p>
<span class="monospaced">/usr/bin/mlprof</span>
</p>
<div class="paragraph"><p>A <a href="Profiling">Profiling</a> tool.</p></div>
</li>
<li>
<p>
<span class="monospaced">/usr/bin/mlton</span>
</p>
<div class="paragraph"><p>A script to call the compiler. This script may be moved anywhere,
however, it makes use of files in <span class="monospaced">/usr/lib/mlton</span>.</p></div>
</li>
<li>
<p>
<span class="monospaced">/usr/bin/mlyacc</span>
</p>
<div class="paragraph"><p>The <a href="MLYacc">MLYacc</a> parser generator.</p></div>
</li>
<li>
<p>
<span class="monospaced">/usr/lib/mlton</span>
</p>
<div class="paragraph"><p>Directory containing libraries and include files needed during compilation.</p></div>
</li>
<li>
<p>
<span class="monospaced">/usr/share/man/man1/mllex.1</span>, <span class="monospaced">mlnlffigen.1</span>, <span class="monospaced">mlprof.1</span>, <span class="monospaced">mlton.1</span>, <span class="monospaced">mlyacc.1</span>
</p>
<div class="paragraph"><p>Man pages.</p></div>
</li>
<li>
<p>
<span class="monospaced">/usr/share/doc/mlton</span>
</p>
<div class="paragraph"><p>Directory containing the user guide for MLton, mllex, and mlyacc, as
well as example SML programs (in the <span class="monospaced">examples</span> dir), and license
information.</p></div>
</li>
</ul></div>
</div>
</div>
<div class="sect1">
<h2 id="_hello_world">Hello, World!</h2>
<div class="sectionbody">
<div class="paragraph"><p>Once you have installed MLton, create a file called <span class="monospaced">hello-world.sml</span>
with the following contents.</p></div>
<div class="listingblock">
<div class="content monospaced">
<pre>print "Hello, world!\n";</pre>
</div></div>
<div class="paragraph"><p>Now create an executable, <span class="monospaced">hello-world</span>, with the following command.</p></div>
<div class="listingblock">
<div class="content monospaced">
<pre>mlton hello-world.sml</pre>
</div></div>
<div class="paragraph"><p>You can now run <span class="monospaced">hello-world</span> to verify that it works. There are more
small examples in <span class="monospaced">/usr/share/doc/mlton/examples</span>.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_installation_on_cygwin">Installation on Cygwin</h2>
<div class="sectionbody">
<div class="paragraph"><p>When installing the Cygwin <span class="monospaced">tgz</span>, you should use Cygwin’s <span class="monospaced">bash</span> and
<span class="monospaced">tar</span>. The use of an archiving tool that is not aware of Cygwin’s
mounts will put the files in the wrong place.</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>
|