Building ASCEND/Gentoo

From ASCEND
Jump to: navigation, search

This is a record of Roger Mason's experience building ASCEND on a Gentoo Linux box.

gcc (Gentoo 4.3.4 p1.0, pie–10.1.5) 4.3.4 Python 2.6.2 SCons script: v1.2.0.r3842, engine: v1.2.0.r3842

See the list of pre-requisites.
I wanted ipopt and sundials, which are not available in portage.

Ipopt

These instructions are based on a document by Andreas Waechter that you can obtain here:

http://drops.dagstuhl.de/opus/volltexte/2009/2089/

  1. cd ~/Software/IPOPT
  2. svn co https://projects.coin-or.org/svn/Ipopt/releases/3.9.1 .
  3. cd ThirdParty/Blas/
  4. ./get.Blas
  5. cd ../Lapack/
  6. ./get.Lapack
  7. cd ../Mumps
  8. ./get.Mumps
  9. The last command also applied a patch (successfully) and there were no error messages.
  10. download HSL ma27ad.f and ma19ad.f from HSL. (http://www.hsl.rl.ac.uk/). (There are restrictions and you’ll need a username and password).
  11. HSL site says ma27ad needs FD05,ID05 & ZAO2 but ipopt says neither ma27 nor ma19 need dependencies.
  12. ipopt configure fails saying that ma27 is not threadsafe and that you need the newer, threadsafe version. However, there is no indication of where to get it.
  13. Download ma57 instead and make a file called ma57ad.f in the HSL subdirectory of IPOPT by extracting ma57d.f and renaming that file to ma57ad.f. Then download tarballs with the dependencies (fd15d.f, mc21d.f, mc34d.f, mc47d.f, mc59d.f, mc64d.f, mc71ad.f), extract and concatenate them into ma57ad.f.
  14. cd ../Metis
  15. ./get.Metis
  16. cd ../.. (to ~/Software/IPOPT)
  17. mkdir -p build
  18. ../configure. The default install directory is the build directory. The libraries will be in build/coin and build/coin/ThirdParty. I kept the default on a first build. You can specify a different install directory using —prefix=/path/to/install/dir.
  19. configure should end with 'Main configuration of Ipopt successful'.
  20. make.
  21. make test. Some tests are compiled and run. The tests all passed on my system. If Mumps is not included, then ipopt tries to use hsl routines, if they are not present, then tests fail.
  22. make install. You need to be root if you don’t have write access to the installation directory.</ol>

Sundials

  1. Download from https://computation.llnl.gov/casc/sundials/main.html
  2. F77=gfortran ./configure. The configure script may not find your fortran compiler unless you specify it as shown.
  3. make; su; make install. The default install directory is /usr/local.</ol>

Ascend

  1. Check out the sources: cd ~/Software svn co svn://ascend.cheme.cmu.edu/ascend/code/trunk ascend
  2. cd ascend
  3. In the top level SConstruct file change 'default_ipopt_libs' to read: default_ipopt_libs = ['$F2C_LIB','blas','lapack','pthread','ipopt','coinhsl','dl', 'coinmumps','coinmetis']
  4. Make sure the coin* libraries in the previous step are somewhere that gcc can find them, symlink if necessary.
  5. If there is an options.cache, remove it.
  6. scons —config=force IPOPT_LIBPATH=~/Software/IPOPT/build/lib/coin IPOPT_CPPPATH=~/Software/IPOPT/build/include
  7. I used symlinks from ~/Software/IPOPT/build/lib/coin to ~/Software/IPOPT/build/lib/coin/ThirdParty for the coin* libraries.
  • In sundials.py change ‘None’ on line 62 to ’-llapack’ otherwise various symbols won’t be found and sundials won’t be used. I could not find a cleaner way to accomplish this.
  1. Make sure that configure found all the libraries you want ascend to use.</ol>

Installation

Once the configuration and build are to your liking the ASCEND can be installed.

  1. I tried installing ASCEND as an ordinary user in $HOME, but the install command tries to change a file in /usr/lib/python2.6/site-packages, so it fails.
  2. perform final installation of Ipopt if necessary.
  3. su; cd ~/Software/IOPOT/build
  4. ../configure --prefix=/usr/local
  5. make (should be nothing to do)
  6. make install -> libraries will be in /usr/local/lib/coin and /usr/local/lib/coin/ThirdParty
  7. symlink everything in /usr/local/lib/coin/ThirdParty from /usr/local/lib/coin
  8. cd ~/Software/ascend
  9. scons install INSTALL_PREFIX=/usr/local IPOPT_LIBPATH=/usr/local/lib/coin IPOPT_CPPPATH=/usr/local/include
  10. If you have problems at this stage with failures during the build, they are probably caused by a difference in the root PATH compared with that of your ordinary user. I worked round it by echoing my user PATH then appending it to root's path with export PATH=$PATH:... The change to root's path will disappear when you exit the su session.
  11. Once the PATH is changed, re-run the 'scons install' command.
  12. exit (su)
  13. You may need to adjust LD_LIBRARY_PATH in order for shared libraries to be found.