Compiling lapack 3.1.1 on Leopard

OSX contains an incomplete lapack library by default in the vecLib framework. But if you want the full power of lapack 3.1.1, you have to compile from source. This article documents that process, mostly so when I have to do it again I'll have a reference.

The first thing we notice is that OSX does not contain a fortran compiler in its developer tools. The gfortran project  contains a nice dmg installer. Two other options are compiling from source or using macports. I chose macports.

$ sudo port install gcc43

Create some convenient links for standard gfortran calls.

$ sudo ln -sf /opt/local/bin/gfortran-mp-4.3 /usr/local/bin/gfortran
$ sudo ln -sf /opt/local/bin/gfortran-mp-4.3 /usr/local/bin/g77

Next download lapack.tgz source (current 3.1.1 as of this writing) and untar it.

$ tar xzvf lapack.tgz

Lapack does not contain the standard configure script, so we have to edit the make.inc ourselves. Copy the make.inc.example to make.inc, then apply this patch.

$ patch < make.inc.patch

That's it, all that's left is to compile. I do so with 6 make threads.

$ make -j6

Share on: TwitterFacebookGoogle+Email

Comments !