Building APSIM from source
All Apsim sources are available from the github repository.
Microsoft Visual Studio (2017 or 2019) is used to build both Apsim Classic and Next Generation. The (free on registration) Community Edition will suffice.
Git: you will need at least a command line git client installed on your system, and you may feel comfortable using a GUI such as TortoiseGit to examine changes to the source tree. There are several described here.
Compiling Apsim Next Generation
Please follow the latest instructions in the nextgen online help.
1. Clone the repository:
git clone https://github.com/APSIMInitiative/APSIMClassic
7z x BuildLibraries.7z
The unit tests require NUnit 2.x.
The cotton module will not build unless the password is obtained from the module owner.
To build the R component, you will need R installed, and the extensions RCpp, RInside.
4. Open the Visual Studio 2017/9 Developer command prompt, and change to …/APSIMClassic/Model/Build. Run the command “BuildAll.bat” in that directory.
The linux build of ApsimClassic uses the mono runtime for .NET components. Unfortunately, recent (5,6.x) versions of the runtime have proved unstable, so an older version (4.8.1) is recommended. On debian systems, this involves adding keys and repositories (as root):
gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-key E084DAB9 gpg -a --export E084DAB9 | apt-key add - gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-key A6A19B38D3D831EF gpg -a --export A6A19B38D3D831EF | apt-key add - echo "deb http://download.mono-project.com/repo/debian wheezy/snapshots/4.8.1 main" > /etc/apt/sources.list.d/mono.list echo "deb http://mirror.aarnet.edu.au/pub/CRAN/bin/linux/ubuntu bionic-cran35/" > /etc/apt/sources.list.d/cran.list apt-get update && apt-get -y install \ g++ gfortran libgfortran3 \ libxml2 libxml2-dev tcl8.5 tcllib curl \ mono-devel mono-vbnc mono-runtime \ r-base r-base-dev r-recommended Rscript -e "install.packages(c(\"Rcpp\",\"RInside\"))"
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