<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>gsll installation on clisp & cygwin</title>
<meta name="generator" content="muse.el">
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<style type="text/css">
body {
background: white; color: black;
margin-left: 3%; margin-right: 7%;
}
p { margin-top: 1% }
p.verse { margin-left: 3% }
.example { margin-left: 3% }
h2 {
margin-top: 25px;
margin-bottom: 0px;
}
h3 { margin-bottom: 0px; }
</style>
</head>
<body>
<h1>gsll installation on clisp & cygwin</h1>
<!-- Page published by Emacs Muse begins here -->
<p>Mirko Vukovic</p>
<h2>Introduction</h2>
<p class="first">GSLL, GSD, and FSBV had to be slightly adapted to clisp and cygwin.
After the modifications, the FSBV, GSD pass all tests and GSLL passes
the vast majority of them.</p>
<p>The clisp & cygwin modifications are independent of each other. All
modifications are done using read-time conditionalizations (RTC) such
as #+cygwin, #-cygwin, #+clisp, and #-clisp.</p>
<p><strong>Note:</strong> According to gsll documentation, the only <em>required</em> part of fsbv
is convert. However, gsd's foreign-array does not compile because
defcstruct is undefined. defcstruct is defined in file cstruct. We
compile the full fsbv.</p>
<h2>Cygwin setup</h2>
<p class="first">Needed cygwin libraries and utilities:</p>
<ul>
<li>libffi</li>
<li>gcc</li>
<li>gsl and blas libraries</li>
</ul>
<p>Also add /lib/lapack to PATH. I have it added to the windows' PATH,
but it should work with cygwin's PATH.</p>
<h2>On linking to libraries</h2>
<p class="first">GSLL & FSBV call the following libraries:</p>
<ul>
<li>libgslcblas</li>
<li>libgsl</li>
<li>libffi</li>
</ul>
<p>For cygwin, the corresponding libraries are:</p>
<ul>
<li>/bin/cyggslcblas-0.dll</li>
<li>/bin/cyggsl-0.dll</li>
<li>/bin/cygffi-4.dll</li>
</ul>
<p>Make appropriate modifications to the fsbv/init.lisp and
gsll/init/init.lisp files (details below). Library definition and
loading syntax is discussed in the cffi manual.</p>
<h2>FSBV</h2>
<p class="first">Modify the following files:</p>
<ul>
<li><strong>init.lisp</strong> In (cffi:add-foreign-library ...) add RTC #+cygwin to
point to /bin/cygffi-4.dll using</li>
<li><strong>libffi-unix.lisp</strong> Remove FFI_UNIX64 property using #-cygwin.
FFI_UNIX64 is not present in cygwin's ffi.h and if not removed
causes the C compiler to issue an error.</li>
<li><strong>examples.lisp</strong> Add RTC switches #+cygwin to point to
/bin/cyggslcblas-0.dll and /bin/cyggsl-0.dll</li>
</ul>
<p>Finally,</p>
<ul>
<li>Load `fsbv'.</li>
<li>Compile and load `examples.lisp.'</li>
<li>Verify that examples listed at the file beginning work.</li>
</ul>
<h2>GSD</h2>
<p class="first">GSD systems load cleanly on cygwin/clisp. The only modifications are
to the unit-tests.</p>
<p>clisp does not honor grid's requests in creating double-float
grids. Instead it creates float grids, and mapping on them returns
single-floats. As grid specifies test results in term of
double-floats, the test `element-functions' fails because of different
precisions.</p>
<p>We fix that test by relaxing the error tolerance. In file
tests/element-functions.lisp, add the following `let' body around the
tests:</p>
<pre class="example">
(let ((lisp-unit:*epsilon* #+clisp 1e-5 #-clisp nil))
... test-forms ... )
</pre>
<p>Finally,</p>
<ul>
<li>load foreign-array (this loads grid as well)</li>
<li>load grid-tests</li>
<li>Switch to package :grid</li>
<li>grid>(lisp-unit:run-tests)</li>
</ul>
<p>All tests should pass.</p>
<h2>GSLL</h2>
<p class="first">In gsll only <strong>init/init.lisp</strong> needs a few modifications.</p>
<h3>The `gsl-config' function</h3>
<p class="first">This function seems to be needed primarily for the darwin OS.
Nevertheless it is invoked on all platforms because of the #. read
macro in a library definitions.</p>
<p>Unfortunately, asdf:run-shell-command does not do the right job on
clisp and returns `nil.' This causes the read statements to fail.</p>
<p>The fix is to use a separate form for clisp and the original one for
non-clisp. For clisp, the function body should be:</p>
<pre class="example">
#+clisp
(read-line
(ext:run-shell-command
(format nil "gsl-config ~s" arg)
:output :stream)
nil :gsl-config-returned-with-error)
</pre>
<p>If this form returns an error, something is wrong with the gsl setup.
Thus this form could be used as one test of gsl installation
correctness.</p>
<h3>GSL library paths</h3>
<p class="first">Add the cygwin library path definitions to libgslcblas and libgsl.</p>
<h3>Compile, load and test GSLL</h3>
<p class="first">Load systems gsll and gsll-tests. Verify the installation by
switching to the gsll package and executing</p>
<pre class="example">
gsll> (let ((lisp-unit:*epsilon* 1e-5))
(lisp-unit:run-tests))
</pre>
On my system I get:
<pre class="example">
TOTAL: 3376 assertions passed, 22 failed, 9 execution errors.
</pre>
<!-- Page published by Emacs Muse ends here -->
</body>
</html>