Building ASCEND
This page contains specific instructions for building ASCEND on systems that we know about. First you should read about VersionManagement for information on how to get hold of the source code.
Building ASCEND (as of March 2006) requires the SCons build tool. In our opinion, SCons is a significant advance on Autotools, so we encourage you to give it a chance, if you're not familiar with it.
Note: If you are having trouble building ASCEND, it might be worth checking out the BuildBot (link here) to see if the latest sources have compiled correctly on our test server.
General instructions
Building with SCons (as of Jun 2010, we recommend version 1.x) should be as simple as typing
scons
Get info on the current build options by typing scons -Qh. To clean up after your build, type scons -c. To include any building options, type scons followed by options. For instance, type scons WITH_LOCAL_HELP = /usr/local/share/ascend/manual.
Any build option that you see in scons -Qh can be entered into a file config.py that you can create in the root source directory (ie ~/src/ascend/trunk). For example, you might create a config.py file like this:
WITH_LOCAL_HELP = /usr/local/share/ascend/manual DEFAULT_ASCENDLIBRARY = /usr/local/share/ascend/models
So, if you want to set configuration options so that they always get applied, edit your config.py file.
On top of that, you should also be aware that the SCons build will cache your build options in a file called options.cache. That means that if you type a scons command with command-line options, then later without those command line options, the options from the first run will still be there, because they will have been saved in the cache.
A major fiddle with SCons, especially on Windows, is ensuring that all the required programs are present in your path. You need to install Bison (from the GnuWin32 project). For SCons to run correctly from the MSYS command line, you will also need to add /c/Python25/Scripts:/c/Python25 to your path, so that the 'scons' script is discovered.
The SCons system will manage the building of FORTRAN components and is able to link to an installed version of CONOPT.
For instructions on building with Autotools, see the old versions of this page. We're not actively supporting the Autotools build any more.
Running scons will create a locally-executable version of ASCEND that can be run from the source tree (pygtk/ascdev or tcltk/generic/interface/ascend4, possibly subject to some environment variable settings. Alternatively, you can install ASCEND and run it from a 'proper' location such as ~/bin/ascend or /usr/bin/ascend, etc. To install files for ASCEND, run
scons install INSTALL_PREFIX=/usr/local
The above will install the PyGTK GUI at /usr/local/bin/ascend and the Tcl/Tk GUI at /usr/local/bin/ascend4. Other sensible values of INSTALL_PREFIX include ~/ascend or ~, which will install the PyGTK GUI at ~/ascend/bin/ascend and ~/bin/ascend respectively. These latter ones are good if you don't have root privileges on your system. There are a range of other INSTALL_* options available with our build script, type scons -qH to see them. Also note the importance of the ABSOLUTE_PATHS option for our build script. Note then when you run 'scons install' you don't get all the files in the model library, you only get a filter set according to the PACKAGE metafiles contained in the ModelLibrary.
Tcl/Tk GUI
In order to build the original Tck/Tk GUI, you need a Tcl/Tk distribution. Recently we have modified ASCEND so that it can run with Tcl/Tk 8.4. Standard Tcl/Tk binary packages can be used, such as those included in Fedora Core 5 (Note, the tcl-devel and tk-devel packages required as well). For Windows they available from ActiveState, see:
http://www.activestate.com/activetcl
At present, detection of Tcl/Tk is not particularly sophisticated. SConstruct just looks for tcl.h in your standard include path. So you might need to tweak. Check the scons -h list of configuration options for more. On Debian-based systems, try something like scons TCL_CPPPATH=/usr/include/tcl8.4
Python interface
See PythonWrapper for more information. You will need to have SWIG 1.3.24 or newer and Python 2.4 or newer installed. These are both easy to install for both Windows and Linux.
To run the PyGTK interface requires more dependencies, see the PythonWrapper page for full details.
Instructions for Linux
In general, see Prerequisites for Linux. You will be using scons to build ASCEND. We update these distribution-specific notes at the time that we implement support for that particular distro, so it's possible that if you're using an old distro, you may need to go back and use an old version of the code.
Ubuntu 10.10
ASCEND compiles fine on Ubuntu 10.10, but you need to use the latest code from the 'trunk' of our subversion repo. Subversion r3082 corrects a bug that was preventing use of SCons 2.x, as supplied as part of this distro. Otherwise, required packages are the same as for 10.04, see below. It is recommended that all 'optional' packages are installed at the time of building ASCEND.
Ubuntu 10.04
There is currently a problem with building ASCEND on this platform, due to an error thrown by SWIG version 1.3.40 (ASCEND bug 403). This error is not seen when running SWIG version 1.3.38 or earlier. A temporary workaround is to install the Ubuntu Karmic version if SWIG, available from here. (this bug is now fixed in the subversion repo)
To build ASCEND on a clean Ubuntu 10.04 box, the following packages were required (as of trunk r2777):
- subversion
- swig
(see note above) - g++
- gfortran
- python-dev
- scons
The following are optional but recommended:
- flex
- bison
- graphviz-dev
- libsundials-serial-dev
- coinor-libipopt-dev
- liblapack-dev (used by IPOPT)
- tcl8.5-dev
- tk8.5-dev
- libtktable2.9
- libblas-dev
At runtime, the following packages will add capability to ASCEND:
- ipython
- python-matplotlib
Kubuntu 10.04
Building on Kubuntu (KDE) is identical to Ubuntu (GNOME) with the exception that python-gtk2 and python-glade2 must be installed before running the resulting program. This was tested with trunk r3039. At this point in time, building also requires the package libgsl0-dev, because of some dependencies in FPROPS which need to be removed/made optional.
Ubuntu 9.10
Ongoing development of ASCEND is primarily done on this Ubuntu 9.10. Although ASCEND builds against the standard Ubuntu packages for Sundials, you will obtain better functionality with the IDA solver if you use a version built from latest 2.4.0 source code. The latest release fixes problems with boundary-crossing during integration.
To build ASCEND on a clean Ubuntu 9.10 box, the following packages are required (as of trunk r2667):
- scons
- swig
- python-dev
- scons
- g++
- gfortran
The following packages are optional:
- libsundials-serial-dev
- graphviz-dev
- flex
- bison
- libblas-dev
- tcl8.5-dev
- tk8.5-dev
- tktable2.9
At runtime, the following packages will add capability to ASCEND:
- ipython
- python-matplotlib
For the IPOPT solver, you will also need to build that separately from source -- see IPOPT for details. For the CONOPT and CMSlv solvers, you must obtain libconsub3.so, see CONOPT for details.
Ubuntu 9.04
ASCEND should build on this system without any problems, providing the prerequisited that you need are installed. Watch closely the 'scons' output for fleeting comments which may suggest that you're missing a library or a header file, etc. Prereqs should be the same as for Ubuntu 8.04.
Note that after updating to Ubuntu 9.04, you will probably need to rebuild and reinstall things like IPOPT and CONOPT, as gfortran errors seem to arise otherwise.
For the IDA solver, you may need to add the scons option SUNDIALS_CPPPATH=/usr/include/sundials to make this integrator build correctly.
Ubuntu 8.04 LTS
ASCEND built fine on Ubuntu 8.0.4 LTS when we last tried it. Numerous prerequisites must be installed, but all of these except IPOPT and CONOPT are currently available from the Ubuntu repositories. Specifically, check libsundials-serial-dev, swig, flex, bison, python-dev, tk-dev, libtktable2.9. Haven't yet tested with CONOPT, so conditional modelling has not yet been checked.
Special treatment for the gfortran compiler is no longer required (as was required for Ubuntu 7.10).
Building of a .deb package can be performed using the dtar tool included in the source distribution. Usage: scons dist && ~/ascend/tools/dtar/dtar ~/ascend/dist/ascend-0.9.5.116.tar.bz2 ~/ascend/dist/debian.tar.gz.
Ubuntu 8.04 uses GtkSourceView2 instead of the earlier version, with the result that source code highlighting in GEdit using a different .lang file. We have written a new version of this file, see the page on syntax highlighting for more info.
Currently, LyX 1.5 is not available on Ubuntu, and the manual .lyx files require this newer version. So for the moment, you must use scons WITH_DOC_BUILD=0.
ASCEND has been runninng on earlier Ubuntu versions, right back to version 5.10.
Fedora 11
The following steps build ASCEND on a clean Fedora 11 machine (I tested using the Live CD installed to a qemu/kvm virtual machine):
su yum install scons subversion tk-devel flex bison gcc-gfortran gcc-c++ python-devel sundials-devel graphviz-devel swig scons
Currently (as of 16 Jun 2009), the above results in a error message from g++ while compiling the SWIG output. See bug 403. Testing on Windows has shown that SWIG 1.3.39 and 1.3.40 have this problem, but 1.3.36 does not have this problem. This bug is fixed in the pre-0.9.8 code from our SVN server.
Fedora 9
ASCEND builds without any problems on Fedora 9. You need to install several packages first, including swig, tk-devel, python-devel, scons, flex, bison, gcc-gfortran, gcc-c++. There may be some problems getting the GraphViz and CUnit-related functionality working, let us know if you have problems with that. -- JP, Jun 2008.
You can build an RPM version of ASCEND using scons dist followed by rpm -ta ascend-0.9.5.116.tar.bz2, providing you have RPM correctly set up. See also Building an RPM Package for ASCEND.
OpenSUSE
OpenSUSE does not provide an up to date version of SCons (as of this writing, suse 10.2 comes with scons-0.96.91-37). You will need to download a newer version (0.96.93) (from SF.net. Do not try 0.97 SCons, as it is not yet supported by the ASCEND SConscripts on the SUSE platform.
Update (Mar 2010) it is suggested that you try latest SCons 1.x if possible, and report your experiences here.
Arch Linux
To build ASCEND on Arch Linux, follow these steps:
sudo pacman -S gcc gcc-fortran flex bison python scons swig tcl tk graphviz blas
Download and build sundials manually (see Prerequisites for Linux).
Then follow the Genereal instructions (running scons and scons install).
If you have problem with SWIG 1.3.40 (scons reports that SWIG package was not found), download older version of SWIG(1.3.38 worked for me, 1.3.24 didn't) and build it manually (./configure, make, make install). Then re-run swig with parameter SWIG=/usr/local/bin/swig (or different location where you installed SWIG).
When running ascend script:
LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH TypeError: can only concatenate list (not "NoneType") to list
LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH
if GTKLIBPATH: LDPATH = [INSTALL_LIB] + GTKLIBPATH + LDPATH else: LDPATH = [INSTALL_LIB] + LDPATH
(found here).
Gentoo
This is a record of my 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/
- cd ~/Software/IPOPT
- svn co https://projects.coin-or.org/svn/Ipopt/releases/3.9.1 .
- cd ThirdParty/Blas/
- ./get.Blas
- cd ../Lapack/
- ./get.Lapack
- cd ../Mumps
- ./get.Mumps
- The last command also applied a patch (successfully) and there were no error messages.
- 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).
- HSL site says ma27ad needs FD05,ID05 & ZAO2 but ipopt says neither ma27 nor ma19 need dependencies.
- 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.
- 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.
- cd ../Metis
- ./get.Metis
- cd ../.. (to ~/Software/IPOPT)
- mkdir -p build
- ../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.
- configure should end with “Main configuration of Ipopt successful”.
- make.
- 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.
- make install. You need to be root if you don’t have write access to the installation directory.
Sundials
- Download from https://computation.llnl.gov/casc/sundials/main.html
- F77=gfortran ./configure. The configure script may not find your fortran compiler unless you specify it as shown.
- make; su; make install. The default install directory is /usr/local.
Ascend
- Check out the sources: cd ~/Software svn co svn://ascend.cheme.cmu.edu/ascend/code/trunk ascend
- cd ascend
- In the top level SConstruct file change ‘default_ipopt_libs’ to read: default_ipopt_libs = [“$F2C_LIB”,“blas”,“lapack”,“pthread”,“ipopt”,“coinhsl”,“dl”,
- Make sure the coin* libraries in the previous step are somewhere that gcc can find them, symlink if necessary.
- If there is an options.cache, remove it.
- scons —config=force
- 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.
- Make sure that configure found all the libraries you want ascend to use.
Installation
Once the configuration and build are to your liking the ASCEND can be installed.
- 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.
- perform final installation of Ipopt if necessary.
- su; cd ~/Software/IOPOT/build
- ../configure —prefix=/usr/local
- make (should be nothing to do)
- make install -> libraries will be in /usr/local/lib/coin and /usr/local/lib/coin/ThirdParty
- symlink everything in /usr/local/lib/coin/ThirdParty from /usr/local/lib/coin
- cd ~/Software/ascend
- scons install INSTALL_PREFIX=/usr/local
- 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.
- Once the PATH is changed, re-run the ‘scons install…’ command.
- exit (su)
- You may need to adjust LD_LIBRARY_PATH in order for shared libraries
Instructions for Windows
The only currently-supported way to build ASCEND on Windows is using MinGW/MSYS and the GCC compiler. There has previously been partial success with the Microsoft compiler tools, but these are not currently actively being used or tested.
MinGW / MSYS
The following instructions were tested on 32 bit Windows XP running on a DELL Precision (Core 2 Duo) machine in Nov 2009 and 32 bit Windows VISTA running on a ThinkPad X61 (Core 2 Duo) machine in March 2010.
First install the MinGW/MSYS environment. Download MinGW-5.1.6.exe, and select the basic options plus 'g++' (the C++ compiler). Then download and install MSYS-1.0.11.exe.
Now install Python-2.6.4.msi.
Install pywin32-214.win32-py2.6.exe.
Next, download and install SCons, scons-1.2.0.win32.exe.
Download swigwin-1.3.36 (later versions are OK) and unzip it in your root directory (it's just a folder with that name).
Download and install Flex (2.5.4a-1) and Bison (2.4.1) from GnuWin32, installing in the default location.
Download GFortran 'native installer' for MinGW from [1]. Our release was dated '2009-04-21'.
With a right-click on the My Computer icon, then in the Advanced tab, add the following to your PATH environment variable (no quotes): ';c:\Python26;c:\Python26\Scripts;c:\swigwin-1.3.36;c:\Program Files\GnuWin32\bin;C:\Program Files\gfortran\bin'. For Windows VISTA system, right-click on the Computer icon, choose Properties. In Advance System Settings, you can configure PATH environment variable.
Install NSIS 2.45.
Download 'book.pdf' and save it as 'book.pdf' in ~/ascend/doc.
In MSYS, run scons WITH_DOC_BUILD=0 installer.
The above will allow you to build ASCEND (and also to build the ASCEND installer using nsis/installer.nsi) but not to run it. For that, you additionally need to complete the following steps:
- Download and install the GTK Glade3 windows installer [2]
- Download and install PyGTK [3]
- Download and install PyCairo [4]
- Download and install PyGObject [5]
The above Glade3 installer should have added 'c:\Program Files\Gtk+\bin' to your PATH; you can check that if necessary.
To test the installer, it is recommended you remove GTK Glade3, PyGTK, PyCairo, PyGObject, Tcl/Tk and Python. Then run the installer, and it should discover all those missing things and proceed to reinstall them for you.
File:Mingw-1.png File:Mingw-6.png
SUNDIALS. If you want to use the IDA integrator (recommended) then you should download and install SUNDIALS. See building SUNDIALS on Windows.
Everything should build and you should end up with a file dist/ascend-{version}.exe which is your 'setup' program. Run that then find ASCEND in your Start menu.
MSVC
We don't currently support the use of Microsoft compilters. They probably can be made to work, but we don't see any good reason to work on that.
Windows / Borland C Builder
Some very early efforts to support free Borland 5.5 were made; the core engine basically compiles but there is more work to be done.
Instructions for Mac
Mac OS X 10.5
ASCEND runs fine on Mac OS X 10.5, and probably other versions. Currently we haven't completed the job of bundling ASCEND into a convenient distributable form, but the work is now well underway. See Porting to Mac for details.
There has been no attempt to build or test the Tcl/Tk GUI on Mac at this stage.