Building for Macintosh platform: Difference between revisions

m
Minor formatting
(Port from old wiki)
 
m (Minor formatting)
Line 1: Line 1:
or, How to Minimalistically GNUify MacOSX For Building Octave From Scratch
or, How to Minimalistically GNUify Mac OS X For Building Octave From Scratch


=Binary-Releases=
=Binary-Releases=
If you are looking for an already build version of Octave for MacOSX then visit one of the following web pages that do provide a binary-release of octave and follow the instructions for installing Octave from these web pages:
If you are looking for an already build version of Octave for Mac OS X then visit one of the following web pages that do provide a binary-release of octave and follow the instructions for installing Octave from these web pages:


     http://octave.sourceforge.net/
     http://octave.sourceforge.net/
     http://www.hmug.org/
     http://fink.sourceforge.net/ (specifically http://pdb.finkproject.org/pdb/package.php/octave)
     http://fink.sourceforge.net/
     http://www.macports.org/ (specifically https://trac.macports.org/browser/trunk/dports/math/octave/Portfile)
     http://www.macports.org/
     http://hpc.sourceforge.net/#octave


At the SourceForge link, you can obtain Octave as a .dmg file, as well as a .dmg of the most recent build of Gnuplot. This should be good enough for most users. Also consider AquaTerm for displaying graphs instead of X11. (Aquaterm is included in gnuplot in the extras folder of the Octave install image, and if you install it separately there might be issues.)
At the SourceForge link, you can obtain Octave as a .dmg file, as well as a .dmg of the most recent build of Gnuplot. This should be good enough for most users. Also consider AquaTerm for displaying graphs instead of X11. (Aquaterm is included in gnuplot in the extras folder of the Octave install image, and if you install it separately there might be issues.)


=Source-Compilation=
=Source-Compilation=
Before building Octave from scratch on a MacOSX platform you need to install several GNU programs and libraries that are not shipped with your Mac. This description will guide you through the procedure of GNUifying your MacOSX step by step, so that you are then be able to configure, compile, install and run the Octave program.
Before building Octave from scratch on a Mac OS X platform you need to install several GNU programs and libraries that are not shipped with your Mac. This description will guide you through the procedure of GNUifying your Mac OS X step by step, so that you are then be able to configure, compile, install and run the Octave program.


If available, then binary-releases of the necessary programs are preferred by this description, otherwise there is no other way as to configure, compile and install other source-releases of these programs. The minimalistical requirements for installing these programs on your Mac are that you have at least MacOSX version 10.4.x running on your Mac (either Core Duo or PPC).
If available, then binary-releases of the necessary programs are preferred by this description, otherwise there is no other way as to configure, compile and install other source-releases of these programs. The minimalistical requirements for installing these programs on your Mac are that you have at least Mac OS X version 10.4.x running on your Mac (either Core Duo or PPC).


The section "Step-By-Step Procedure" describes which programs resp. packages have to be installed at least before trying to compile Octave. The section "Extensions" describes which programs resp. packages have to be installed before trying to compile Octave to reach full functionality. The section "Troubleshooting" describes what to do if one ore more package creation processes fail.
The section "Step-By-Step Procedure" describes which programs resp. packages have to be installed at least before trying to compile Octave. The section "Extensions" describes which programs resp. packages have to be installed before trying to compile Octave to reach full functionality. The section "Troubleshooting" describes what to do if one ore more package creation processes fail.
Line 21: Line 21:


==Step-By-Step Procedure==
==Step-By-Step Procedure==
(1) Install the Xcode-Tools (ie. the gcc-suite, the c-library and other tools) that are shipped with your computer from "MacOSX Install Disc 1". Optionally you can get the latest version of these tools from http://developer.apple.com/tools/download. Follow the instructions from the "About Xcode Tools.pdf" file on how to install these tools. Make sure that you have installed the latest releases.
(1) Install the Xcode-Tools (ie. the gcc-suite, the c-library and other tools) that are shipped with your computer from "Mac OS X Install Disc 1". Optionally you can get the latest version of these tools from http://developer.apple.com/tools/download. Follow the instructions from the "About Xcode Tools.pdf" file on how to install these tools. Make sure that you have installed the latest releases.


Also read the troubleshooting part at the bottom of this file for further details about which build tools could also make troubles.
Also read the troubleshooting part at the bottom of this file for further details about which build tools could also make troubles.


(2) Install the X11 environment (ie. the Xserver application etc.) that are shipped with your computer from "MacOSX Install Disc 1". The X11 environment can be installed via the "Optional Installs.mpkg" program and is needed by various graphics programs (10). Make sure that you have installed the latest release. Choose "Software-Update" in your menu bar to download and to reinstall the latest versions.
(2) Install the X11 environment (ie. the Xserver application etc.) that are shipped with your computer from "Mac OS X Install Disc 1". The X11 environment can be installed via the "Optional Installs.mpkg" program and is needed by various graphics programs (10). Make sure that you have installed the latest release. Choose "Software-Update" in your menu bar to download and to reinstall the latest versions.


(3) Prepare a directory and the settings on your environment for installing the following programs and libraries. Create the directory /usr/local that is not present by default on your new Mac and set up some variables in either your .profile file (if you plan to use the Terminal.app from MacOSX for compiling Octave) or your .bashrc file (if you plan to use the terminal application from your X11 environment). Do this the following way:
(3) Prepare a directory and the settings on your environment for installing the following programs and libraries. Create the directory /usr/local that is not present by default on your new Mac and set up some variables in either your .profile file (if you plan to use the Terminal.app from Mac OS X for compiling Octave) or your .bashrc file (if you plan to use the terminal application from your X11 environment). Do this the following way:


     sudo mkdir /usr/local
     sudo mkdir /usr/local
Line 55: Line 55:
     sudo cp -r ./usr/local/* /usr/local
     sudo cp -r ./usr/local/* /usr/local


Also read the troubleshooting part at the bottom of this file for further details about which Fortran compiler to use for MacOSX.
Also read the troubleshooting part at the bottom of this file for further details about which Fortran compiler to use for Mac OS X.


(6) Download and install a source-release of the program "sed" because the one that is implied in MacOSX is a BSD-flavoured POSIX version and a GNU version is required to build Octave. The source-release of the latest sed program can be downloaded from Internet at http://ftp.gnu.org/pub/gnu/sed. Unpack, configure, compile and install this program the following way:
(6) Download and install a source-release of the program "sed" because the one that is implied in Mac OS X is a BSD-flavoured POSIX version and a GNU version is required to build Octave. The source-release of the latest sed program can be downloaded from Internet at http://ftp.gnu.org/pub/gnu/sed. Unpack, configure, compile and install this program the following way:


     tar -xzf sed-X.x.x.tar.gz
     tar -xzf sed-X.x.x.tar.gz
Line 70: Line 70:
Also read the troubleshooting part at the bottom of this file for further details if an error occurs at compilation.
Also read the troubleshooting part at the bottom of this file for further details if an error occurs at compilation.


(7) Download and install a source-release of the program "bison" because the one that is implied in MacOSX a BSD-flavoured POSIX version and a GNU version is required to build Octave. The source-release of the latest bison program can be downloaded from Internet at http://ftp.gnu.org/pub/gnu/bison. Unpack, configure, compile and install this program the following way:
(7) Download and install a source-release of the program "bison" because the one that is implied in Mac OS X a BSD-flavoured POSIX version and a GNU version is required to build Octave. The source-release of the latest bison program can be downloaded from Internet at http://ftp.gnu.org/pub/gnu/bison. Unpack, configure, compile and install this program the following way:


     tar -xzf bison-X.x.tar.gz
     tar -xzf bison-X.x.tar.gz
Line 81: Line 81:
     sudo mv /usr/bin/bison /usr/bin/__bison
     sudo mv /usr/bin/bison /usr/bin/__bison


(8) Download and install a source-release of the program "gawk". Gawk is not included in MacOSX (the program "awk" is included in MacOSX but "gawk" is needed to compile Octave). The source-version of the latest gawk-release can be downloaded from Internet at http://ftp.gnu.org/pub/gnu/gawk. Unpack, configure, compile and install this program the following way:
(8) Download and install a source-release of the program "gawk". Gawk is not included in Mac OS X (the program "awk" is included in Mac OS X but "gawk" is needed to compile Octave). The source-version of the latest gawk-release can be downloaded from Internet at http://ftp.gnu.org/pub/gnu/gawk. Unpack, configure, compile and install this program the following way:


     tar -xzf gawk-X.x.x.tar.gz
     tar -xzf gawk-X.x.x.tar.gz
Line 88: Line 88:
     make && sudo make install
     make && sudo make install


(9) Download and install a source-release of the "readline" library. There is already a readline-library included in MacOSX but by now I do not know how to include the installed version in the compilation procedure of Octave. The source-version of the latest readline-release can be downloaded from Internet at http://ftp.gnu.org/pub/gnu/readline. Unpack, configure, compile and install this program the following way:
(9) Download and install a source-release of the "readline" library. There is already a readline-library included in Mac OS X but by now I do not know how to include the installed version in the compilation procedure of Octave. The source-version of the latest readline-release can be downloaded from Internet at http://ftp.gnu.org/pub/gnu/readline. Unpack, configure, compile and install this program the following way:


     tar -xzf readline-X.x.tar.gz
     tar -xzf readline-X.x.tar.gz
Line 102: Line 102:
     make && sudo make install
     make && sudo make install


(**) You are already done setting up your MacOSX for configuring, building, installing and running the minimalistic version of Octave. If you want full Octave functionality you need to download and install more source packages before building Octave, read the EXTENSIONS part of this file at the bottom.
(**) You are already done setting up your Mac OS X for configuring, building, installing and running the minimalistic version of Octave. If you want full Octave functionality you need to download and install more source packages before building Octave, read the EXTENSIONS part of this file at the bottom.


(11) Download and install a source-release of the latest "octave" program. The latest release can always be found at http://www.octave.org. Unpack, configure, compile and install this program the following way:
(11) Download and install a source-release of the latest "octave" program. The latest release can always be found at http://www.octave.org. Unpack, configure, compile and install this program the following way:
Line 119: Line 119:
For using the full functionality of Octave some more source-packages need to be installed on your Mac.
For using the full functionality of Octave some more source-packages need to be installed on your Mac.


(+A) Download and install a source-release of the "pcre" library. There is no pcre-library included in MacOSX. The source-version of the latest pcre-release can be downloaded from Internet at http://www.pcre.org. Unpack, configure, compile and install this program the following way:
(+A) Download and install a source-release of the "pcre" library. There is no pcre-library included in Mac OS X. The source-version of the latest pcre-release can be downloaded from Internet at http://www.pcre.org. Unpack, configure, compile and install this program the following way:


     tar -xzf pcre-X.x.tar.gz
     tar -xzf pcre-X.x.tar.gz
Line 126: Line 126:
     make && sudo make install
     make && sudo make install


(+B) Download and install a source-release of the "hdf5" library. There is no hdf5-library included in MacOSX. The source-version of the latest hdf5-release can be downloaded from Internet at ftp://ftp.hdfgroup.org/HDF5/current/. Unpack, configure, compile and install this program the following way:
(+B) Download and install a source-release of the "hdf5" library. There is no hdf5-library included in Mac OS X. The source-version of the latest hdf5-release can be downloaded from Internet at ftp://ftp.hdfgroup.org/HDF5/current/. Unpack, configure, compile and install this program the following way:


     tar -xzf hdf5-X.x.x.tar.gz
     tar -xzf hdf5-X.x.x.tar.gz
Line 135: Line 135:
Note for HDF5 version 1.8.0: Make sure CPPFLAGS contains "-DH5_USE_16_API" when configuring Octave.
Note for HDF5 version 1.8.0: Make sure CPPFLAGS contains "-DH5_USE_16_API" when configuring Octave.


(+C) Download and install a source-release of the "fftw" library. There is no fftw-library included in MacOSX. The source-version of the latest fftw-release can be downloaded from Internet at http://www.fftw.org. Unpack, configure, compile and install this program the following way:
(+C) Download and install a source-release of the "fftw" library. There is no fftw-library included in Mac OS X. The source-version of the latest fftw-release can be downloaded from Internet at http://www.fftw.org. Unpack, configure, compile and install this program the following way:


     tar -xzf fftw-X.x.x.tar.gz
     tar -xzf fftw-X.x.x.tar.gz
Line 142: Line 142:
     make && make check && sudo make install
     make && make check && sudo make install


(+D) Download and install a source-release of the "curl" library. There is no curl-library included in MacOSX. The source-version of the latest curl-release can be downloaded from Internet at http://curl.haxx.se. Unpack, configure, compile and install this program the following way
(+D) Download and install a source-release of the "curl" library. There is no curl-library included in Mac OS X. The source-version of the latest curl-release can be downloaded from Internet at http://curl.haxx.se. Unpack, configure, compile and install this program the following way


     tar -xzf curl-X.x.x.tar.gz
     tar -xzf curl-X.x.x.tar.gz
Line 149: Line 149:
     make && make check && sudo make install
     make && make check && sudo make install


(+E) Download and install a source-release of the "glpk" library. There is no glpk-library included in MacOSX. The source-version of the latest glpk-release can be downloaded from Internet at http://ftp.gnu.org/gnu/glpk. Unpack, configure, compile and install this program the following way
(+E) Download and install a source-release of the "glpk" library. There is no glpk-library included in Mac OS X. The source-version of the latest glpk-release can be downloaded from Internet at http://ftp.gnu.org/gnu/glpk. Unpack, configure, compile and install this program the following way


     tar -xzf glpk-X.x.x.tar.gz
     tar -xzf glpk-X.x.x.tar.gz
Line 156: Line 156:
     make && make check && sudo make install
     make && make check && sudo make install


(+F) Download and install a source-release of the "suitesparse" library. There is no suitesparse-library included in MacOSX. The source-version of the latest release can be downloaded from Internet at http://www.cise.ufl.edu/research/sparse/SuiteSparse. Edit file UFconfig/UFconfig.mk and replace (in about line 76) "-lgoto" with "-lblas". The metis source package is also needed to build the "suitesparse" library, it can be downloaded from internet at http://glaros.dtc.umn.edu/gkhome/views/metis. Unpack, configure, compile and install this program the following way
(+F) Download and install a source-release of the "suitesparse" library. There is no suitesparse-library included in Mac OS X. The source-version of the latest release can be downloaded from Internet at http://www.cise.ufl.edu/research/sparse/SuiteSparse. Edit file UFconfig/UFconfig.mk and replace (in about line 76) "-lgoto" with "-lblas". The metis source package is also needed to build the "suitesparse" library, it can be downloaded from internet at http://glaros.dtc.umn.edu/gkhome/views/metis. Unpack, configure, compile and install this program the following way


     tar -xzf SuiteSparse.tar.gz
     tar -xzf SuiteSparse.tar.gz
Line 221: Line 221:
==Troubleshooting==
==Troubleshooting==


(1) There are reports on the mailing lists of Octave, that automake also needs to be updated because the version that is shipped with MacOSX doesn't work (especially with G5 Macs this problem may occur). So you might need to install a newer version than the one shipped with your Mac.
(1) There are reports on the mailing lists of Octave, that automake also needs to be updated because the version that is shipped with Mac OS X doesn't work (especially with G5 Macs this problem may occur). So you might need to install a newer version than the one shipped with your Mac.


On Core Duo Macs it might appear, that compilation of libcruft/misc/machar.c fails because of a missing define, resp. a define that is in the code but is missinterpreted by the make program of your Mac. So you should do the following before configuring Octave:
On Core Duo Macs it might appear, that compilation of libcruft/misc/machar.c fails because of a missing define, resp. a define that is in the code but is missinterpreted by the make program of your Mac. So you should do the following before configuring Octave:
Line 234: Line 234:
     /usr/bin/libtool: internal link edit command failed  
     /usr/bin/libtool: internal link edit command failed  


This is a known MacOSX problem for over years now and may occur if you have multiply version of Fortran compilers installed on your system. GFortran is one of the known Fortran compilers that do work very well with the gcc-suite that is shipped with your computer. When running "./configure" in your Octave path then make sure that GFortran is the one and only Fortran compiler on your system (the fink version of gfortran installed with the package gcc42 also works).
This is a known Mac OS X problem for over years now and may occur if you have multiply version of Fortran compilers installed on your system. GFortran is one of the known Fortran compilers that do work very well with the gcc-suite that is shipped with your computer. When running "./configure" in your Octave path then make sure that GFortran is the one and only Fortran compiler on your system (the fink version of gfortran installed with the package gcc42 also works).


(3) When installing sed there may occur an error that sed cannot be build. This is a known problem, you first need a working sed (the one implied in MacOSX a BSD-flavoured POSIX version and a GNU version is required to build Octave) to build another sed for your system, so do the following:
(3) When installing sed there may occur an error that sed cannot be build. This is a known problem, you first need a working sed (the one implied in Mac OS X a BSD-flavoured POSIX version and a GNU version is required to build Octave) to build another sed for your system, so do the following:


   (a) Enter the sed directory and edit config.h ca. line 14:
   (a) Enter the sed directory and edit config.h ca. line 14: