Difference between revisions of "Hmatrix on Mac OS X"

From HaskellWiki
Jump to navigation Jump to search
(Basic instructions for GSLHaskell on MacOS X)
m (Fixed formatting of source code)
Line 7: Line 7:
 
First, you will want to install GHC using MacPorts, not the standalone installers. Assuming that you have uninstalled any other versions of Haskell, type:
 
First, you will want to install GHC using MacPorts, not the standalone installers. Assuming that you have uninstalled any other versions of Haskell, type:
   
 
sudo port install ghc
{{{
 
sudo port install ghc
 
}}}
 
   
 
This may take several hours to bootstrap on a slow machine.
 
This may take several hours to bootstrap on a slow machine.
Line 17: Line 15:
 
GSLHaskell requires working versions of GSL, BLAS and LAPACK. You can get GSL and BLAS from DarwinPorts:
 
GSLHaskell requires working versions of GSL, BLAS and LAPACK. You can get GSL and BLAS from DarwinPorts:
   
 
sudo port install gsl
{{{
 
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.
 
The accelerated version of LAPACK bundled with MacOS X 10.4 appears to link with GSLHaskell, though I haven't tested it extensively.
Line 27: Line 23:
 
As of 20 Jan 2007, the Darcs version of GSLHaskell was easier to get working than the older tarball release. Download it as follows:
 
As of 20 Jan 2007, the Darcs version of GSLHaskell was easier to get working than the older tarball release. Download it as follows:
   
 
darcs get http://dis.um.es/~alberto/GSLHaskell --partial
{{{
 
darcs get http://dis.um.es/~alberto/GSLHaskell --partial
 
}}}
 
   
 
Next, edit GSLHaskell/src/GSLHaskell.cabal to refer to the appropriate versions of BLAS and LAPACK:
 
Next, edit GSLHaskell/src/GSLHaskell.cabal to refer to the appropriate versions of BLAS and LAPACK:
   
 
extra-libraries: gsl gslcblas LAPACK
{{{
 
extra-libraries: gsl gslcblas LAPACK
 
}}}
 
   
 
To build and install GSLHaskell, type:
 
To build and install GSLHaskell, type:
   
 
cd GSLHaskell/src
{{{
 
 
runhaskell Setup.hs configure
cd GSLHaskell/src
 
runhaskell Setup.hs configure
+
runhaskell Setup.hs build
runhaskell Setup.hs build
+
sudo runhaskell Setup.hs install
sudo runhaskell Setup.hs install
 
}}}
 
   
 
== Using GSLHaskell ==
 
== Using GSLHaskell ==
Line 52: Line 42:
 
To load GSLHaskell using GHCI, you need to add two directories to your LD_LIBRARY_PATH:
 
To load GSLHaskell using GHCI, you need to add two directories to your LD_LIBRARY_PATH:
   
 
export LD_LIBRARY_PATH=/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/:/opt/local/lib
{{{
 
export LD_LIBRARY_PATH=/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/:/opt/local/lib
 
}}}
 
   
 
To build an example program using GHC, type:
 
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/
cd ../examples
 
ghc --make -optl-L/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/
 
 
plot.hs
 
plot.hs
}}}
 
   
 
== Plotting with gnuplot and Aquaterm ==
 
== Plotting with gnuplot and Aquaterm ==
Line 68: Line 54:
 
Install gnuplot using MacPorts:
 
Install gnuplot using MacPorts:
   
 
sudo port install gnuplot
{{{
 
sudo port install gnuplot
 
}}}
 
   
 
If Aquaterm fails to compile, upgrade to the latest version of XCode. Tell gnuplot what terminal to use:
 
If Aquaterm fails to compile, upgrade to the latest version of XCode. Tell gnuplot what terminal to use:
   
 
export GNUTERM=aqua
{{{
 
export GNUTERM=aqua
 
}}}
 
   
 
You should now be able to build and run GSLHaskell/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.
 
You should now be able to build and run GSLHaskell/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.

Revision as of 15:42, 21 January 2007

Here are some notes on getting GSLHaskell running under MacOS X 10.4 using MacPorts. These notes may be incomplete, and the details may change slightly in the future.

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 Haskell, type:

sudo port install ghc

This may take several hours to bootstrap on a slow machine.

Required libraries

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.

Installing GSLHaskell

As of 20 Jan 2007, the Darcs version of GSLHaskell was easier to get working than the older tarball release. Download it as follows:

darcs get http://dis.um.es/~alberto/GSLHaskell --partial

Next, edit GSLHaskell/src/GSLHaskell.cabal to refer to the appropriate versions of BLAS and LAPACK:

extra-libraries:    gsl gslcblas LAPACK

To build and install GSLHaskell, type:

cd GSLHaskell/src
runhaskell Setup.hs configure
runhaskell Setup.hs build
sudo runhaskell Setup.hs install

Using GSLHaskell

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:

export LD_LIBRARY_PATH=/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/:/opt/local/lib

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:

export GNUTERM=aqua

You should now be able to build and run GSLHaskell/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.