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.

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

General instructions

Building with SCons (as of Apr 09, 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.

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://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

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 9.04

Ongoing development of ASCEND is primarily done on this 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.10

As of Apr 09, ASCEND is building and running fine on Ubuntu 8.10. Make sure you have the necessary prereqs, as for Ubuntu 8.04.

Ubuntu 8.04 LTS

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, 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.

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.

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).

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 1.2.0.

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.

MSVC

We don't actively use MSVS to build ASCEND any more; whether it still works or not is unknown (but unlikely).

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.

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 OSX

ASCEND builds with Mac OS X without any serious problems. See Porting to Mac.

There has been no testing of the Tcl/Tk GUI on Mac at this stage.

The problem with the OS X platform is that the GUI uses PyGTK, which is still problematic on Mac. There has been major progress recently on a native Mac port of GTK+, but there are currently no packages for native PyGTK. Once this becomes available we don't expect major problems.

The other problem with OS X is that the package management tools are difficult and not nearly as well-coordinated as on the Linux platform. This makes setting up a development environment a more involved process (though perhaps not as bad as for Windows).

See also

Personal tools