The Mac OS X operating system also appears to come with a version of LAPACK, and the BLAS library upon which it depends. Neither the operating system nor XCode provide cmake, gfortran, or FFTW. Checking for Python. A Python interpreter is included in recent versions of Mac OS X. To check if Python is already installed, enter the command:. Hi, I'm trying to compile numpy for python 3.4 with Intel MKL on Mac OS X. In this process I have solved many problems myself, but I'm stuck on this one. The best procedure I found until now is using macports, if you try other routes (Enthought Canopy, using default python install, fink) you are on your own, and you will need quite some savvy on installing and compiling software for Mac OS X to get it working! Download and install the macports installation from www.macports.org.
My experiences in installing IPOPT on Mac OS X
by Peter CarbonettoDept. of Computer Science
University of British Columbia
IPOPT is asoftware package for solving nonlinear objectives subject to nonlinearconstraints. It uses primal-dual interior pointmethodology. Importantly, it is open source.
After a great deal of time and trouble, I managed to get in workingon my laptop which is running the Mac OS X operating system.1 In the following, I detail myexperiences in installing the IPOPT package.
Succinctly put, the configure script did not work for IPOPT, so Ihad to install everything from scratch. While this was really quite alabourous process, I didn't know any other way of installing thepackage. On the bright side, I learned a lot about compiling fortranand C++, and linking object code, libraries and executables
1. Installing the Fortran compiler
The first problem I encounter is that I do not have a Fortran 77compiler installed on my machine. I do have the GNU C and C++compilers installed on my computer already (the programs
gcc
and g++
), but the Fortran 77 compiler isalso needed to compile the BLAS, LAPACK and HSL routines. A lot ofpeople are upset that the GNU Fortran compiler g77
wasnot included with the AppleDeveloper Tools because installing it ourselves causes many extraheadaches. But we'll have to make do.There are several ways I can install a Fortran compiler. One is bydownloading GNU Fortran compiler from the High Performance Computingwebpage. Another route is to install
g77
via Fink. Instead, I'm going tofollow the route that gives me the most control: I will download andbuild the entire GNUCompiler Collection (GCC), then put the necessary files in theappropriate places. Even though this route is considerably morecomplicated, it will allow me to ensure that I have the correctversion of the compiler. You see, since I'm running Mac OS X 10.3.9 Ialready have gcc
3.3 installed on my computer in the/usr/bin/
directory. (It is easy to check the version bytyping gcc --version
.) It is important that the compilersI'm using all belong from the same collection otherwise it is verylikely that I will undercover linking errors. I've decided todownload GCC 3.3.6 from my local university FTP mirror.It is crucial that I do not follow the default installationfor GCC, because I may end up overwriting important files. The GCCinstallation instructions advise the same thing. Suppose that I'vechosen to install to the directory . I've done so simply by passingthe option to the . I'm only really interested inthe programs and libraries necessary for compiling and linking Fortrancode. I start by installing the Fortran 77 compiler with thecommand
gcc-install
--prefix=gcc-install
configure
script. After following the correctinstallation steps and waiting a couple hours for the entire packageto be built, I now have a whole bunch of files and subdirectories ingcc-install
In the end, I had installed the following files:
2. Building the BLAS, LAPACK and HSL libraries
Now that I have a Fortran 77 compiler installed on my system, Iproceed to build the libraries needed by IPOPT from scratch. First, Idownload the latest BLAS and LAPACK tarballs from the Netlib FTP repository. The BLASpackage just consists of a bunch of Fortran files. I compile each ofthe individual files into object code, starting with the file
caxpy.f
:This creates an object file
caxpy.o
. The rest of thefiles are compiled similarly. If you want to produce a shared library,you will want to include the -fPIC
option. Also, I'venoticed that the -fexceptions
option should not be usedas it causes linking errors down the road. Once I've compiled all theFortran code, I create a static library via the following commands:I create the LAPACK library in precisely the same fashion, with thesame options passed to
g77
. The only difference is thatthe files in the LAPACK tarball are strewn about in varioussubdirectories. In brief, the quickest way to build the LAPACK libraryis to use the existing Makefile and typeat the command prompt with
lapack/SRC
being thecurrent directory. Before we do that, however, we need to modify a fewof the options passed to the Makefile. First, I movelapack/make.inc.example
tolapack/make.inc
. Looking at this file, I see that itspecifies among other things the program used to compile the Fortrancode, which is g77
, exactly as I want it. Near the bottomof this text file, I change the variable LAPACKLIB
toNow, I can type the
make
command in theSRC
subdirectory and it should proceed to automaticallycreate the library (this takes about ten minutes on my computer).Lastly, I create a library with the HSL subroutines. Afterfollowing the instructions in the IPOPT document for downloading thecode from the HSL Archive, I create the library with the followingcommands:
Mac Os X Update
Now I'm ready to create the IPOPT library.
3. Building the IPOPT library
Installing Lapack On Mac Os X 10.13
I will elect not to follow the standard installation instructions(since they didn't work) and instead build the IPOPT library byhand. Basically, I'm going to follow almost the same steps as I didbefore. The trickiest part is that I need to modify the file
Ipopt/inc/config_ipopt.h
manually; the configure scriptdoes this automatically. My file looked likeNext, I compile the C and C++ source files into object files. Forinstance, a create the object file
IpAdaptiveMuUpdate.o
with the commandwhere
ipopt-include-dir
is the directory containingall the .h
and .hpp
header files. And soon. Once I've compiled all the source files, I create the staticlibrary with the commandsNote that in most cases it will not make sense to archiveall the object files into the library. For instance, youshould not include
IpMa57TSolverInterface.o
unless youhave downloaded that solver (I didn't). By the same token, I didn'tinclude the code for interfacing with the AMPL and CUTEr.Mac Os X 10.11 Download Free
4. Testing the installation with an example
I can't be positive that we built the libraries correctly withouttrying to run a program that actually uses IPOPT. I try the Hock andSchittkowski nonlinear programming test example no. 71, which isincluded with the IPOPT tarball. After copying all the staticlibraries to
libhome
, I compile and link the codewith the following sequence of commands:Now have a program which is executed by typing
./hs071
. Note that the order in which I included theobject files and libraries in the above lines is important. Theg2c
library helps us link the Fortran object code to theC++ object code (recall that I placed this library in/usr/lib
).Footnotes
1 More precisely, I'm using MacOS X version 10.3.9 (Panther), and I have a PowerPC G4 processor. Youmay find that the steps I follow apply to your system, even if itisn't the same process or version of the operating system.