Bring Your Own Linux

pcraster_open_source_code In a recent post we outlined that we will no longer distribute compiled versions of PCRaster for Linux systems but modellers need to build their own versions. We now completed most of the work on our build infrastructure and included the components from previous release packages that were yet missing (such as documentation) in the source tree. A few things still need to be solved on our side, e.g. further reducing the number of  external libraries we build ourselves instead of using system libraries only; and fixing some unit test failures as well. Still, the current setup should result in a complete PCRaster package, and therefore we think that we can now provide instructions to the users to compile and install their own PCRaster version. However, we recommend to not use the current development branch to generate a package and use it in production mode, please consider it still as beta for the upcoming PCRaster release. Please note that building your own PCRaster package does not require software development experience on your side, but requires some system administration steps (and endurance). Also, trying to build your own PCRaster might be adventurous at the moment. There is a myriad of Linux distributions out there, each with different versions (and combinations thereof) of external libraries. Your build might therefore fail in the first attempt. However, we very much appreciate your feedback with respect to your builds. Please share your experiences on our mailing list. And we will use your feedback to streamline the build and installation process.

Building prerequisites

We assume that you use a recent 64-bit Linux distribution (such as Ubuntu 16.04 x86_64), and we will outline the required steps by means of the apt package manager. In case you use another distribution and package manager you need to adapt the steps accordingly. First, you will need to install a compiler and a set of libraries and applications required to build PCRaster. Perform the following three steps: sudo apt update sudo apt upgrade sudo apt install cmake gcc g++ git libboost-all-dev libgdal-dev libpython2.7-dev libncurses5-dev libgeos++-dev imagemagick libxslt1-dev xsltproc qt4-dev-tools qt4-qmake libqwt-dev xsdcxx libxml2 libxml2-utils python-numpy

Building PCRaster

We provide a script that performs the necessary steps to build PCRaster, you need to download that one first. We assume that you are going to build the package in the folder 'pcraster_4_2_beta' in your home directory (you can choose another location and directory name if you prefer). Execute the following three steps: cd $HOME wget http://pcraster.geo.uu.nl/download/build_pcraster.py python build_pcraster.py pcraster_4_2_beta --build-gdal That's all, but it will take a while to complete. You will see something like this: ~$ python build_pcraster.py pcraster_4_2_beta Initialising directories Obtaining source code Building utility libraries Building PCRaster (this can take about one hour...) Installing PCRaster Testing pcrcalc May 26 2016 (linux/x86_64) USAGE: pcrcalc [options] "expression" or pcrcalc [options] -f scriptFile ( or #!: pcrcalc -F [options]+) other flags: s # : set seed (integer > 0) for random generator default is based on current time b f : overrule script bindings 1 : update timeseries files at end of each timestep r f : set run directory d f : debug mode, check MV creation on assignment comparing against clone or areamap boolean mask c : strict Case significant filename check (Unix portability) p : print profile information m : optimize with areamap MV compression l : use less memory but more temporary disk storage t : test argument substitution Great, you just built your own PCRaster version! To use is type: source $HOME/bash_pcraster_4_2_beta.sh You can now use your own version it for first experiments, e.g. import the PCRaster Python module, run a few models and compare the output with the previous releases; or fix some bugs and send patches to us... Anyhow, let us know whether you were successful. And 'it just works' is feedback we appreciate as well ;-) In case of a build failure check the pcraster_install.log if you can fix some obvious problems, otherwise the logfile could provide us with valuable information. Meanwhile we will continue working towards the PCRaster 4.2 release. Most likely we will make the build script more configurable as well such that e.g. you can specify if you want to build the documentation or not. More in our next post!