<!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>RunningOnNetBSD - 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%;">
      RunningOnNetBSD
    <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 fine on <a class="external" href="http://www.netbsd.org/"><img src="moin-www.png" alt="[WWW]" height="11" width="11">NetBSD</a>. <h2 id="head-f540b96714cb4fb53f52a3c6b891109f21c9ec21">Installing the correct packages for NetBSD</h2>
<p>
The NetBSD system installs 3rd party packages by a mechanism known as pkgsrc. This is a tree of Makefiles which when invoked downloads the source code, builds a package and installs it on the system. In order to run MLton on NetBSD, you will have to install several packages for it to work: 
</p>

    <ul>

    <li>
<p>
 <tt>shells/bash</tt> 
</p>
</li>
    <li class="gap">
<p>
 <tt>devel/gmp</tt> 
</p>
</li>
    <li class="gap">
<p>
 <tt>devel/gmake</tt> 
</p>
</li>

    </ul>


<p>
In order to get graphical call-graphs of profiling information, you will need the additional package 
</p>

    <ul>

    <li>
<p>
 <tt>graphics/graphviz</tt> 
</p>
</li>

    </ul>


<p>
To build the documentation for MLton, you need <tt>htmldoc</tt>. 
</p>
<h2 id="head-94491c2cf063e8b634a4582f510f3a6735669262">Tips for compiling and using MLton on NetBSD</h2>
<p>
MLton can be a memory-hog on computers with little memory.  While 640Mb of RAM ought to be enough to self-compile MLton one might want to do some tuning to the NetBSD VM subsystem in order to succeed.  The notes presented here is what <a href="JesperLouisAndersen">JesperLouisAndersen</a> uses for compiling MLton on his laptop. 
</p>
<h3 id="head-3bf1043eef710e5b57c1d91fccdbbd6535c8e3e0">The NetBSD VM subsystem</h3>
<p>
NetBSD uses a VM subsystem named <a class="external" href="http://www.ccrc.wustl.edu/pub/chuck/tech/uvm/"><img src="moin-www.png" alt="[WWW]" height="11" width="11">UVM</a>. <a class="external" href="http://www.selonen.org/arto/netbsd/vm_tune.html"><img src="moin-www.png" alt="[WWW]" height="11" width="11">Tuning the VM system</a> can be done via the <tt>sysctl(8)</tt>-interface with the "VM" MIB set. 
</p>
<h3 id="head-53250437dad54a0be46b79ac843e8ef296be4249">Tuning the NetBSD VM subsystem for MLton</h3>
<p>
MLton uses a lot of anonymous pages when it is running. Thus, we will need to tune up the default of 80 for anonymous pages.  Setting 
</p>

<pre>sysctl -w vm.anonmax=95
sysctl -w vm.anonmin=50
sysctl -w vm.filemin=2
sysctl -w vm.execmin=2
sysctl -w vm.filemax=4
sysctl -w vm.execmax=4
</pre><p>
makes it less likely for the VM system to swap out anonymous pages. For a full explanation of the above flags, see the documentation. 
</p>
<p>
The result is that my laptop goes from a MLton compile where it swaps a lot to a MLton compile with no swapping. 
</p>
</div>



<p>
<hr>
Last edited on 2006-07-20 19:36:43 by <span title="ppp-71-139-187-151.dsl.snfc21.pacbell.net"><a href="StephenWeeks">StephenWeeks</a></span>.
</body></html>
