view README.MacOS @ 12312:b10ea6efdc58 release-3-4-x ss-3-3-91

version is now 3.3.91
author John W. Eaton <jwe@octave.org>
date Mon, 31 Jan 2011 08:36:58 -0500
parents edaf29362c50
children 88a8248f5b97
line wrap: on
line source

1. Easy to install Binary Releases
==================================

A MacOS bundle is available from sourceforge.

  http://octave.sourceforge.net/index.html

There are also Octave packages available from both Fink and MacPorts.  Each
of these package managers handle the details of compiling Octave from source.

  http://www.finkproject.com
  http://www.macports.org/


2. Building from Source
=======================

Stable releases, development snapshots as well as the current developers
sources are available. The sources for stable releases are available from
the links below.

  ftp://ftp.gnu.org/pub/gnu/octave/
  http://ftp.gnu.org/pub/gnu/octave/

Development snapshots, intended for testing, are available from the link
below.

  ftp://alpha.gnu.org/gnu/octave

Links to the stable releases, snap shots, and instructions for obtaining
the current development sources using mercurial can be found on Octave's 
web-site below.

  http://www.gnu.org/software/octave/download.html

Building on MacOS can vary significantly between versions.  These
instructions document the procedure for MacOS 10.6.X.


2.1 Developer's Tools
---------------------

Apple's Xcode Developer's Tools must be installed to build Octave on MacOS X.

A fortran compilar is also required to build Octave.

AT&T Research provides versions of gfortran which have been patched to work
with gcc tool set bundled with Xcode.

  http://r.research.att.com/tools/

Alternatively, the Fink and MacPorts package managers provide more recent
versions of gcc which include gfortan. Those may be used to build the sources
as well. However, care must be taken.

  * The same compiler must be used to build all the dependencies. This is
    necessary to to avoid conflicts between the compiler libraries such as
    libstdc++. For a successful build the first file in LDFLAGS must refer to
    this library. For example, if building with gcc-4.5 obtained from MacPorts
    LDFLAGS would begin as,

      export LDFLAGS="/opt/local/lib/gcc45/libstdc++.6.dylib [...]"

  * As of MacOS 10.6.6, the 64bit BLAS routines that are part of Apple's vecLib
    (framework accelerate) are not functioning correctly.  As a work around, an
    alternative BLAS/LAPACK library, such as ATLAS, must be used.


2.2 Manual Package Management
-----------------------------

Instructions for building Octave are available on the web at the link below.

    http://wiki.octave.org/wiki.pl?BuildFromSource

In additionn, those wishing to build on MacOS X (10.6.x) should read section
2.1 above.

2.2.1 Critical Dependencies
---------------------------

The minimal dependencies needed to build Octave's snap-shots are listed below.

  * Xcode

  * gfortran: Available from http://r.reseach.att.com/tools

  * gnu sed: Availabel from http://www.gnu.org/software/sed/

      ./configure --prefix=/usr
      make
      make install

  * fftw3: Available from http://www.fftw.org/download.html

      export F77="/usr/bin/gfortran"
      export CFLAGS="-arch i686 -arch x86_64"
      export FFLAGS="$CFLAGS"
      export LDLAGS="$CFLAGS"
      ./configure --disable-dependency-tracking
      make
      sudo make install
      make clean
      ./configure --enable-float --disable-dependency-tracking
      make
      sudo make install

A fully functional Octave requires additional dependencies. See the link below
for the details.

    http://wiki.octave.org/wiki.pl?BuildFromSource

2.2.2 Building Octave as a 32bit Application
--------------------------------------------

The commands below are sufficient to build a 32bit Octave.

  export CFLAGS="-m32"
  export FFLAGS="-m32 -ff2c"
  export CPPFLAGS="-m32 -D_REENTRANT"
  export LDFLAGS="-m32"
  ./configure --disable-readline --disable-docs
  make

Octave provides an interegrated tests suite.

  make check

Octave may be run withou installing the application using the utility below.

  ./run-octave


2.3 Building With Dependencies Satisfied by Fink
------------------------------------------------

To install and setup the Fink package manager see the on line documentation.

  http://www.finkproject.org/

Currently, Fink does not have a package available for Octave versions above
3.0.x. These instructions will allow the developers sources to be build and
run, but will not permit Octave to be installed in the usual Fink way.

TODO - when a Fink package is developed for Octave 3.4.x, modify these 
       instructions to model the MacPorts secion.


2.3.1 Dependencies
------------------

To build Octave's sources the list of Fink packages below need to be installed.

  aquaterm
  autoconf (>= 2.6.0)
  automake (>= 1.11)
  fftw3 (>= 3.1.1)
  fftw3-shlibs (>= 3.1.1)
  flex >= 2.5.30
  fltk-aqua-shlibs 
  glpk-dev
  glpk-shlibs
  gnuplot (>= 4.2.6)
  graphicsmagick (<= 1.3.7)
  graphicsmagick-shlibs (<= 1.3.7)
  hdf5 (>= 1.6.5)
  hdf5-shlibs (>= 1.6.5)
  libcurl4
  libcurl4-shlibs
  libncurses5
  libncurses5-shlibs
  libtool >= 2.2.2 
  ncurses
  pcre
  pcre-shlibs
  qhull
  qrupdate (**)
  readline5
  readline5-shlibs 
  sed
  suitesparse (= 3.1.0-1 )

Some of Octave's dependencies are among the default packages for Fink. These
include the list below, and possibly others as well.

  tetex
  texinfo

(**) Fink does not yet have a package for qrupdate.  However, one is
       available in the tracker at the link below.

  http://sourceforge.net/tracker/index.php?func=detail&aid=2861045&group_id=17203&atid=414256


2.3.2 Building With Dependencies Satisfied by Fink
--------------------------------------------------

After installing each of the dependencies, the sources are compiled by
setting the proper environment variables and then following the standard build
sequence.  The following is an example set of variables to for a 32-bit build
using gcc-4.2. When building from the sources obtained from the mercurial
archive, ./autogen.sh must be run prior to ./configure.

  export FINK_PREFIX="/sw"
  export PREFIX="/usr/local/bin"

  export OPTFLAGS="-O2 -g"
  export LDFLAGS="-L$FINK_PREFIX/lib -L/usr/lib -m32"
  export CFLAGS="-I$FINK_PREFIX/include $OPTFLAGS -m32"
  export CXXFLAGS=$CFLAGS
  export CPPFLAGS=$CXXFLAGS 
  export ACLOCAL_FLAGS="-I$FINK_PREFIX/share/aclocal"
  export PKG_CONFIG_PATH="$FINK_PREFIX/lib/pkgconfig"
  export PATH="$FINK_PREFIX/var/lib/fink/path-prefix-10.6/:$PATH"
  export MACOSX_DEPLOYMENT_TARGET=10.5
  export PATH="$FINK_PREFIX/lib/flex/bin:$PATH"
  export CPPFLAGS="-I$FINK_PREFIX/lib/flex/include $CPPFLAGS"
  export LDFLAGS="-L$FINK_PREFIX/lib/flex/lib $LDFLAGS"
  export CC="gcc-4.2"
  export CPP="cpp-4.2"
  export CXX="g++-4.2"
  export F77="/usr/bin/gfortran-4.2"
  export FLIBS="-lgfortran -lgfortranbegin"
  export FFLAGS="-ff2c $OPTFLAGS -m32"
  export CPPFLAGS="$CPPFLAGS -I$FINK_PREFIX/include/freetype2 \
                             -I$FINK_PREFIX/include/qhull \
                             -I/usr/include"
  export CXXFLAGS="$CXXFLAGS -D_THREAD_SAFE -D_REENTRANT"

  ./configure --prefix=$PREFIX \
              --libexecdir='${prefix}/lib' \
              --with-blas="-Wl,-framework -Wl,vecLib"
  make

Note: This approach to building Octave does not support "make install".

TODO - develop a Fink package for Octave 3.4.x.


2.4 Building With Dependencies Satisfied by MacPorts
----------------------------------------------------

To install and setup the MacPorts package manager see the online documentation

    http://guide.macports.org/

Using MacPorts, two approaches are described. The first describes how to build
and locally install Octave from a formal snapshot of the developer's sources or
from the developer's sources themselves. This is intended to the causual Octave
developer, or for users who want to live on the bleeding edge.

The second describes an approach for building Octave which is intended for
active developers. In this case, MacPorts is used to satisfy Octave's
dependencies, but MacPorts does not build Octave. Futher a direct install of
Octave is not possible (i.e. cannot "make install").


2.4.1 Building and Installing Octave
------------------------------------

With MacPorts building the developer's sources is convenient. MacPorts includes
a port file for octave-devel. To build and run the most recent development
snapshots, enter the commands below.

    sudo port selfupdate
    sudo port install octave-devel

To build the developers sources in one's own way, or if MacPorts' version is
outdated, a custom port file can be added. This requires setting up a local
port file repository (link below).

    http://guide.macports.org/#development.local-repositories

The octave-devel port file may be used as an initial starting point. The port
file is accessible from the web at the link below.

    http://trac.macports.org/browser/trunk/dports/math/octave-devel/Portfile

It is also available locally at the location below. The parametere ${prefix} is
corresponds to where MacPorts is install, which by default is "/opt/local".

    ${prefix}/var/macports/sources/rsync.macports.org/release/ports/math/octave-devel/Portfile

The local source tarball must be placed in the location below, where ${name}
and ${distname} are each specified in the port file.

    ${prefix}/var/macports/distfiles/${name}/${disname}.tar.gz


2.4.2 Building for Active Development of Octave
-----------------------------------------------

To satisfy Octave's dependencies, first install the octave-devel port.

    sudo port selfupdate
    sudo port install octave-devel

Next run octave to determine the configure options needed to build Octave using
MacPorts.  At Octave's prompt type the command below and make note of the result,
${config_opts}.

    octave:1> octave_config_info.config_opts

Now uninstall the Octave port.

    sudo port deactivate octave-devel

This will remove Octave and leave its dependencies in place. Now Octave may be
built from the local mercurial archive by typing the commands below, where the
configure options mentioned above are substituted for the parameter
${config_opts}. If the sources being built are from the mercurial archive, then
./autogen.sh must be run prior to ./configure.

    ./configure ${config_opts}
    make

Octave's intergrated tests may be run.

    make check

However, "make install" should not be run as it may damage or corrupt the
MacPorts installation. To run Octave, type the command below from the root of
the mercurial archive.

    ./run-octave


John W. Eaton
jwe@octave.org

Ben Abbott
bpabbott@mac.com

Last updated: Sat, 28 Oct 2010 16:06:00 EDT