Obtaining a working development tree from scratch
The Apsim source is stored in a version control system called subversion
. You can find a quick tutorial on its use here
The current APSIM repository URL is
, pre 7.0 versions of apsim use
You will need to install the CollabNet Subversion Command-Line Client v1.6.23 (for Windows)
. The APSIM development team also recommend TortoiseSVN
. Once installed, create a directory on your hard disk to contain the development tree (e.g. c:\Apsim), right click on it and select SVN Checkout. Enter http://apsrunet.apsim.info/svn/apsim/trunk as the URL of repository and click OK.
Updating a development tree to the latest revision
To update a development tree to the most recent revision, right click on it and select SVN Update
. This will bring down all changes made by the APSIM development team to your development tree. Where you've made changes, SVN will try and merge your changes into what it brings down from the repository. If you don't want to keep your changes, then right click on the development tree and select Tortoise SVN|Revert
following an update.
Once you have done an update and optionally a revert, you need to either build the entire tree, or download the appropriate binaries from the APSIM Build System.
Obtaining binaries from the APSIM Build System
Determine the Revision Number
of your development tree by right clicking on it and selection TortoiseSVN|Show log
. The entry in bold (at the top if you've just done a checkout) will tell you your revision number.
Once you know your revision number, you can obtain all binaries for your development tree by going to the APSIM Build System
and clicking the binaries link for your revision. This will download a binaries zip file which you can unzip to your Model (e.g. c:\Apsim\Model) directory.
Obtaining third party tools and support libraries
You will need to install a range of open source build libraries (117Mb)
(boost, libxml2, and iconv precompiled win32 binaries). Unzip this file ( www.7-zip.org
the apsim source tree, not underneath (e.g. c:\BuildLibraries).
Microsoft Visual Studio 2010 is required for the infrastructure, .NET and C++ modules.
gfortran version 4.7.2 is required to build the fortran modules. Note it must be this exact version. You will also need to add the bin folder to your path.
NUnit is required to build the unit tests.
To build the GUI, you will need:
You'll also need a good text editor. The APSIM development team recommend NotePad++
. You can then configure the text editor to compile the module by following the instructions Using Notepad++ to compile and run APSIM
If you want to build everything
After you've installed compilers and support libraries, a set of batch files (or shell scripts on unix systems) build part or all of apsim. They are in
CleanAll.bat deletes all binary files in the source tree.
BuildAll.bat cleans and builds everything from scratch. The compiler output from each module is in
RunAll.bat runs every simulation in the example and test directories. This can take some time.
These scripts can be run by double clicking them in Windows Explorer, or running them within the Visual Studio Command Prompt DOS window.
The build and run system operates in parallel - an xml description of individual tasks describes their order. It will use all available processors, and your system may become unresponsive for a few minutes.
Individual apsim modules (eg SoilWat.dll) can be built with the script
Model/Build/RunMake.bat. A description of its use with a text editor is here. The output of the compilation appears on stdout.
By default, apsim is built in "Release Mode" with no debugging information. The switch to build a debuggable version is in
If you want to compile a FORTRAN module on Windows
To compile an APSIM FORTRAN module, you'll need to have gfortran installed. Open the module's source file in your text editor, and use
to build the module (details here
If you want to compile a C++ or .NET module on Windows
Building C++ or .NET modules requires Microsoft Visual Studio 2010. You can use a text editor
to edit and compile the source file, or open the projects solution file in the VS2010 IDE.
If you want to compile the APSIM user interface
The APSIM user interface uses many third party components that will need to be purchased. If you're interested in doing this then post a message to the APSIM Forum
Compiling under LINUX
The linux build process is identical to the windows build; though the build scripts have
extensions. The instructions given here pertain specifically to the Ubuntu 12.04 distribution, but should be readily adaptable to other distributions.
You will need the following packages installed:
You can obtain these packages by issuing the following command:
sudo apt-get install g++ gfortran mono-devel mono-vbnc libboost-all-dev libxml2-dev tcl8.5-dev r-recommended
You also need to obtain the
. To do so, open the
interpreter as root (e.g., via the command
), and issue the command:
install.packages(c("Rcpp", "RInside", "inline"))
Although the GUI components can be built and run under Linux, they are not fully operational, and are not supported by the APSIM development team. If you wish to experiment with the GUI, you may need to make a few changes to enable Mono on Linux to emulate the Windows registry. This can be done with the following commands:
sudo mkdir /etc/mono/registry
sudo mkdir /etc/mono/registry/ClassesRoot
sudo chmod 777 /etc/mono/registry -R
Running under LINUX
Apsim is a mix of native and .NET applications, each runtime has a few peculiarities that must be addressed.
The native applications are linked against several shared libraries (eg
) which are not installed in a standard shared library path, forcing the use of the LD_LIBRARY_PATH environment variable. If you are working in a login session (eg a console on your desktop) you can add this to your
- see Launchpad bug#366728
). Alternatively, follow the logic in
to convert .apsim/.con files and run apsim.
For cluster installations, there are several self extracting linux executables available:
Execute nodes expected to run .NET components will require the above mono registry hack.