Difference between revisions of "Hmatrix on Mac OS X"
(instructions for the new version)
|Line 82:||Line 82:|
OK, passed 100 tests.
OK, passed 100 tests.
Revision as of 08:11, 7 December 2007
Please update this page with anything you discover along the way.
Installing GHC using MacPorts
First, you will want to install GHC using MacPorts, not the standalone installers. Assuming that you have uninstalled any other versions of ghc, type:
sudo port install ghc
This may take several hours to bootstrap on a slow machine.
GSLHaskell requires working versions of GSL, BLAS and LAPACK. You can get GSL and BLAS from DarwinPorts:
sudo port install gsl
The accelerated version of LAPACK bundled with MacOS X 10.4 appears to link with GSLHaskell, though I haven't tested it extensively.
darcs get http://perception.inf.um.es/~aruiz/darcs/hmatrix --partial
Next, edit hmatrix.cabal to refer to the appropriate versions of BLAS and LAPACK:
extra-libraries: gsl gslcblas LAPACK
To build and install the package, type:
runhaskell Setup.lhs configure runhaskell Setup.lhs build sudo runhaskell Setup.lhs install
These instructions are awkward, and can probably be improved with better knowledge of GHC and/or Cabal.
To load GSLHaskell using GHCI, you need to add two directories to your LD_LIBRARY_PATH:
To build an example program using GHC, type:
cd examples ghc --make -optl-L/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/ plot.hs
Plotting with gnuplot and Aquaterm
Install gnuplot using MacPorts:
sudo port install gnuplot
If Aquaterm fails to compile, upgrade to the latest version of XCode. Tell gnuplot what terminal to use:
You should now be able to build and run examples/plot.hs, and see three nicely anti-aliased plots. If you're using an xterm, you can also choose to leave GNUTERM unset to use gnuplot's built-in X11 support, which is uglier, but apparently allows rotation of 3D plots using the mouse.
With minor changes the instructions work for fink. (I have already had the ghc and ghc-bin packages) In short:
fink install gsl fink install atlas fink install darcs darcs get http://perception.inf.um.es/~aruiz/darcs/hmatrix --partial (fink instal gnuplot)
runhaskell Setup.lhs configure runhaskell Setup.lhs build su runhaskell Setup.lhs install exit cd examples export LD_LIBRARY_PATH=/sw/lib/ runhaskell tests OK, passed 100 tests. OK, passed 100 tests. etc.
Note that the latest version requires cabal 1.2 and the present fink version of ghc (6.6) has lower version. Nevertheless after installing cabal (which itself requires zlib and filepath) hmatrix installs without problems.