Building ASCEND

From ASCEND

Jump to: navigation, search

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. The autotools build is still an option on the trunk of the repository, but it not currently functional on the branch on which most active code development has taken place over the last 18 months (as of Jan 2008). In any case the autotools build does not work on Windows and does not build the PyGTK GUI.

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.

Contents

[edit] General instructions

Building with SCons (as of Jan 08, we recommend version 0.97) 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.

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.

[edit] 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://activestate.com/Products/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

[edit] 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.

[edit] Instructions for Linux

In general, see Prerequisites for Linux. You will be using scons to build ASCEND.

[edit] Ubuntu 8.04

ASCEND builds fine with Ubuntu 8.04. 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, 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.

Building of a .deb package has not yet been trialled.

[edit] Ubuntu 7.10

ASCEND builds fine with Ubuntu 7.10. A change to the way that gfortran from Ubuntu 7.04 is packaged means that the following additional command-line option is required when using SCons:

scons F2C_LIBPATH=/usr/lib/gcc/i486-linux-gnu/4.2.1/

This is necessary so that libgfortran.so can be found when building the LSODE solver. This file is no longer available at /usr/lib/libgfortran.so as it was previously.

Ubuntu 7.10 now 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.

There are some notes from Art about one such Ubuntu 7.10 installation.

[edit] Ubuntu 7.04

ASCEND builds fine with Ubuntu 7.04 with standard Ubuntu .deb packages for all the dependencies. Prerequisites for Ubuntu 7.04 can be installed using Synaptic or apt-get:

  • libufsparse-dev (optional)
  • scons (currently at 0.96.93-2, which is fine)
  • tcl8.4-dev
  • tk8.4-dev
  • tktable2.9 (do not install tktable even though that installs tktable2.9-3)
  • swig-1.3.31
  • gcc
  • flex
  • bison
  • gfortran or g77
  • libsundials-serial-dev

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.

You can find notes on one such installation here.

[edit] Ubuntu 6.10

On Ubuntu 6.10, it is suggested that you make a local install of SWIG 1.3.29. You may find problems with later versions of SWIG, so beware.

You should also use the Debian SUNDIALS package, as the current Ubuntu Edgy package is missing a file. Get libsundials-serial-dev and libsundials-serial0.

The remaining prerequisites will be met if you install the following .deb packages using Synaptic or apt-get:

  • python-scipy
  • python-matplotlib
  • scons (0.96.92 -- problems have been experienced with 0.96.95 and previous 0.96.94 version)
  • ufsparse
  • gfortran
  • gcc
  • flex
  • bison
  • tcl-dev
  • tk-dev
  • tktable
  • python-dev
  • lyx (for building documentation)

With all those things installed, the scons build should 'just work'. You might possible need to set the following build options in order that Tcl/Tk is detected OK, because Tcl/Tk is packaged on Debian/Ubuntu in a slightly unusual way.

scons TCL_CPPPATH=/usr/include/tcl8.4/ 

(The TkTable2.9 .deb package should work OK, although in the past we found that tkTable2.8 was necessary. Compiling that requires --with-tcl=/usr/lib/tcl8.4 --with-tk=/usr/lib/tk8.4)

But otherwise that's it. Check the first 20 lines of the SCons output to check that it's not complaining about missing components.

If you have a license for CONOPT, install it before you build ASCEND, otherwise your build will not detect it and will not include it in the list of available solvers. (You can uninstall CONOPT after the build however, and it won't break your installed copy of ASCEND.)

[edit] Ubuntu 6.06 LTS

We earlier had ASCEND running well on Ubuntu 6.06. The above instructions should suffice (let us know if there are corrections; perhaps with package updates things may have changed).

ASCEND was previously running OK with Ubuntu 5.10.

You will probably need a newer version of SCons and possibly of SWIG for these systems. Check the Prerequisites for Linux page.

[edit] Fedora 9

ASCEND builds without any problems on ASCEND. 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.

[edit] Fedora 7

ASCEND builds OK with Fedora 7. SUNDIALS (for the IDA solver) is now available in the Fedora repository, so you may install that first using yum install sundials-devel.

[edit] Fedora Core 6

See instructions for Fedora Core 5.

See also Building an RPM Package for ASCEND.

[edit] Fedora Core 5

On a brand-new Fedora Core 5 box (set up for 'software development' during the install), the following steps were required:

su
yum install python-matplotlib python-numarray
wget http://jaist.dl.sourceforge.net/sourceforge/scons/scons-0.96.92-1.noarch.rpm
rpm -i scons-0.96.92-1.noarch.rpm
^D (logoff root)
cd ~ && mkdir src && cd src

Next check out the source code from the repository. See VersionManagement for the current details. Assuming you checked out to a directory named ascend, the build is then done by:

cd ascend
scons
cd pygtk
export ASC_DEV=1
./ascdev

You might find that need to specify a directory location for libg2c, for example on my FC5 box, I needed:

scons F2C_LIBPATH = '/usr/lib/gcc-lib/i386-redhat-linux/3.2.3/'

To install ASCEND in your home directory (so that the binary is in ~/bin) type:

scons INSTALL_PREFIX=~ install

If you have root privileges, try

scons INSTALL_PREFIX=/usr/local install

Note: if you get an error like "ImportError: /home/john/src/ascend/pygtk/interface/_ascend.so: cannot restore segment prot after reloc: Permission denied" you need to turn modify your SELinux settings, using the 'Security Level' item in the System->Administration menu. Under SELinux, under 'Compatibility' select 'shared libraries with text relocation'.

Image:selinux.png

Note: you can also try to build an RPM for ASCEND on Fedora.

[edit] 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.

The basic autotools install of ascend (tcl/tk + core) works on both 32 and 64 bit SUSE 10.2. This does not provide access to the newer PyGTK interface, however.

[edit] Instructions for Windows

The preferred approach is to use the GCC 3.4.x compiler under MinGW/MSYS. (There has also been partial success with using MSVS: see below).

[edit] MinGW / MSYS

This is the preferred way to build ASCEND on Windows, because it uses a FOSS toolchain and is as similar as possible to the build process on Linux -- you're less likely to have nasty surprises.

MinGW First install the MinGW environment, if you haven't already got it. I used the following. You should be able to use the MinGW installer to download most of these components, in the Current category of the installer, automatically.

  • MinGW-5.0.2.exe
  • gcc-core-3.4.5
  • gcc-g77-3.4.5
  • gcc-g++-3.4.5
  • binutils-2.16.91-20060119
  • mingw-runtime (not sure if required)
  • w32api-3.6 (not sure if required)
  • mingw-utils-0.3 (not required)

Image:mingw-1.png

Note, If the machine you are using is not networked, I think that you can download the following into the same directory as the MinGW installer and that should work fine. Otherwise you must extract each of the archives shown with c:\MinGW as 'root'.

MinGW (as above) offers g77 FORTRAN-77 compiler. Alternatively, gfortran can be downloaded as a separate package. SCons will default to using g77 but will use gfortran if g77 and f77 are not in your PATH.

MSYS. Next you need to install MSYS, which is available as a separate installer from the MinGW site above. Install this after MinGW.

  • MSYS-1.10.10.exe

Note: AFAICT, msysDTK is not required unless you want to add ssh and/or autoconf capability to your MSYS shell.

Flex and Bison. We recommend using the Flex and Bison packages from the GnuWin32 project, because of their easy installers. We had success with the following versions:

This package is not a part of MinGW and so it gets installed in c:/Program Files/GnuWin32/bin. In order to access it from MSYS you have to add this directory to your path, hence:

export PATH=$PATH:/c/Program\ Files/GnuWin32/bin

SWIG. Download the swigwin-1.3.31 package from SWIG and unpacked it in your home directory, eg c:\msys\1.0\home\john.

Image:mingw-6.png

Then add SWIG to you path, which if you extract as described can be done using the following in MSYS:

export PATH=$PATH:~/swigwin-1.3.31

Python. Python is a build-time prerequisite as well as a runtime prerequisite, since we are using some Python callbacks and they need to link to Python. As long as you installed python-2.4.2.msi in the above steps, this should be fine. For python to work from the MSYS commandline you need to add /c/Python24 to your MSYS PATH.

SCons. The SCons software build tool is a replacement for GNU autotools and GNU make. We chose it because it runs well on a large number of platforms and includes support for the Microsoft compilers, which GNU autotools do not offer. The recommended version to install is 0.97. There have been various problems with some versions before 0.96.96.

To run SCons you will need to add /c/Python24/Scripts to your path. (need to check this).

NSIS. It is recommended that you install NSIS so that SCons can prepare a binary installer package for you. This will add ASCEND to your start menu and generally make your efforts more portable.

SUNDIALS. If you want to use the IDA integrator (recommended) then you should download and install SUNDIALS. This deserves a page of its own: see Building SUNDIALS.

NOW START THE BUILD!

Fire up MSYS and try the following

export PATH=/bin:/mingw/bin:~/swigwin-1.3.31:/c/Python24:/c/Python24/Scripts:/c/Program\ Files/GnuWin32/bin
scons

Everything should build and you should end up with a file pygtk/ascend-0.9.???.exe which is your 'setup' program. Run that then find ASCEND in your Start menu.

[edit] MSVC

The following instructions give one possible way of building ASCEND on Windows with Microsoft Visual C++. There are other ways with other tools, of course.

Prerequisites:

  • Visual C++ 2005 edition (no GUI)
  • Microsoft Platform SDK (custom install, deselect everything except the i386 build tools)
  • TextPad 4.7.3
  • SWIG 1.3.31
  • Python 2.4 (installed in C:\Python24)
  • SCons 0.96.92
  • NSIS.

Optional:

Instructions

After installing all of the prerequisites, open TextPad and create the following file, saving it as c:\Python24\scons-msvc.bat

@echo off

set SWIGDIR=c:\msys\1.0\home\john\swigwin-1.3.29

rem ----------------------------
rem VC++ 2003

rem @set VC7=C:\Program Files\Microsoft Visual C++ Toolkit 2003
rem @set PATH=%VC7%\bin;c:\Python24;%SWIGDIR%;c:\Program Files\GnuWin32\bin
rem @set INCLUDE=%VC7%\include
rem @set LIB=%VC7%\lib

rem ----------------------------
rem VC++ 2005

set VC8=C:\Program Files\Microsoft Visual Studio 8
set PATH=%VC8%\VC\bin;%VC8%\Common7\IDE;%VC8%\SDK\v2.0\bin;\Python24;%SWIGDIR%;c:\Program Files\GnuWin32\bin
echo %PATH%

set INCLUDE=%VC8%\VC\include;%VC8%\SDK\v2.0\Include
set LIB=%VC8%\VC\lib;%VC8%\SDK\v2.0\Lib

rem ----------------------------
rem Launch SCons...

@c:\Python24\python c:\Python24\Scripts\scons %*

Create a 'Tool' in TextPad that launches the above file:

Image:textpadtool.png

Then open the ASCEND 'SConstruct' file and hit ctrl-1 (or whatever the tool shortcut for SCons-msvc is, see your Tools menu). You will see a little popup that asks your for extra parameters. Just hit enter, and you should get a default build.

To build a windows installer, you perform the build as before but with the text "installer" entered into the extra parameter box (no quotes). This will bundle up the required files and create a file ascend-setup.exe in the dist subfolder under ascend. You can then install ASCEND into your 'Start' menu using that executable, and you can run (or uninstall) ASCEND from there. Note that before you can use run ASCEND (even if you have managed to install it), you must first install all the items from the list of runtime Prerequisites for Windows.

[edit] 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.

[edit] Instructions for Mac

[edit] Mac OSX

We have been able to build ASCEND on Mac OSX without any serious problems. You should install the necessary dependencies as listed for Linux above, using the fink program. This includes the GNU Compiler Collection (gcc, g++, gfortran) as well as SWIG, SCons, flex, bison, etc. You will need to install the Python development libraries and Tcl/Tk development libraries as well if you want to be able to use the GUIs. You'll need PyGTK as well.

The process once these things are installed is to build using scons, much as for Linux.

Art Westerberg has a Mac computer that has been used to successfully build ASCEND, so direct questions to him if you would like help with this.

Michael Felzien has also previously been interested in ASCEND on Mac and may also be able to help you. Michael wrote: I'm currently building a .pkg file for macosx to make this process much easier. I'm also interested in working with others on creating a native version using objective c++ please contact me if you know people interested in developing ASCEND on macosx at process.engineer@yahoo.com thank you.

[edit] See also

Personal tools