I am again working on my PhD and I need to get my development environment sorted out. I have almost had it with OpenModelica, because it is so hard to get going on my Mac. I have tried to contribute code to the build process, but the configure script still bombs out based on environment variables that have to be set by hand and so forth. I have therefore decided to try JModelica instead. I duly followed the start of the install instructions, including grabbing a version of the repository using svn (I was not warned that the repo is about 130 MiB, though!).
Installing Ipopt
Ipopt is an interior point solver, part of the COIN-OR project. JModelica includes some nifty optimisation functionality via Optimica so it is quite good to have Ipopt (even though it is not required). So I download the latest Ipopt tarball and now I’m faced with more dependancies: BLAS and LAPACK. After some toying around with these packages, I learned the following:
- The Mac dev tools inclode cBLAS and cLAPACK as part of the vecLib framework (something to remember). However, these don’t play well with gfortran on 10.6
- You can download and build them yourself with little effort, but most build tools assume you are going to use -lblas to access it, which is a bit harder to override.
- Ipopt actually has scripts for downloading these for compiling Ipopt, as documented here (although, crucially, not in the install documentation I was following in the distribution)
- The Ipopt instructions advise using the HSL libraries, but the process you have to go through to get them takes time, I’ve done it, but I still don’t have access, so I’m just going for Mumps instead.
cd ThirdParty
for lib in Blas Lapack ASL Metis Mumps; do
cd $lib;
./get.$lib
cd ..
done
cd ..
./configure --prefix=/usr/local # to get stuff where I want it
make
lpBlas.cpp:211: error: ‘dtrsm’ was not declared in this scope
IpBlas.cpp:211: error: ‘DTRSM’ was not declared in this scope
IpBlas.cpp:211: error: ‘F77_FUNC’ cannot be used as a function
Ipopt/config.log
I noticed that ld was complaining about the archetecture. I modify my call to configure thus:
FFLAGS="-arch=x86_64"
Now make runs! Make test succeeds and I can do
sudo make install
and get to the main game.
Building JModelica
cd JModelica
mkdir build
cd build
../configure --with-ipopt=/usr/local/ --prefix=/usr/local
make
Three minutes later, success! Now do build docs (which requires doxygen, obtained via fink and graphviz, using the Mac install package), which takes ages.
Python support
| Package | URL | Steps I took to install |
|---|---|---|
| JPype | http://jpype.sourceforge.net/ | Download, run sudo python setup.py install |
| lxml | http://codespeak.net/lxml/ | sudo easy_install lxml |
| NumPy 1.2.0 | http://numpy.scipy.org/ | Already installed |
| Scipy 0.7 | http://www.scipy.org/ | Already installed |
| PySundials 2.3 | http://sourceforge.net/projects/pysundials/ | Install SUNDIALS, change reference in src/sundials_core_aux.c from sundials/sundials_smalldense.h to sundials/sundials_dense.h. sudo python setup.py install |
| pyreadline =1.5 | http://ipython.scipy.org/dist/ | sudo easy_install pyreadline |
| Matplotlib | http://matplotlib.sourceforge.net/ | already installed |
| Nose | http://code.google.com/p/python-nose/ | sudo easy_install nose |
And now it still doesn’t work, because Matplotlib is causing segfaults. I guess it’s time to call it a day — more in getting Matplotlib to go tomorrow.
Leave a Reply