Building GEOtop on OS X

THIS GUIDE IS WORK IN PROGRESS! Every type of feedback will be appreciate and will be very useful for me.

In order to build GEOtop on OS X, it’s necessary to install a package manager. Several package managers are available:

  • MacPorts;
  • Fink;
  • Homebrew.

The last one is the newest and most popular of the trio. So, because I’m working on Yosemite 10.10.5, I followed this guide to install it. In the next few days I will be able to write a my own guide on this page, so we will have the complete guide here.

To download and install Homebrew run the install script on the command line as below

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

That’s all, now we are ready to build and install GEOtop and its dependencies.

 

1. Installing and building the dependencies

  1. PROJ4 and BOOST
    In case of dynamic linking, the precompiled packages of the libraries PROJ.4 and BOOST may be installed through the package manager
    $ brew search proj
    $ brew install proj
    
    # to create symlink in /usr/local/lib to the PROJ4
    # shared and static libraries which have to be found
    # from CMake and linked at run-time
    $ brew link --overwrite proj
    $ brew search boost
    $ brew install boost boost-build

  2. MeteoIO 2.4.2 (http://models.slf.ch/p/meteoio/)
    The MeteoIO library has to be built.

    • REMINDER 1: GEOtop can be built only against MeteoIO 2.4.2
    • REMINDER 2: Download the source code of MeteoIO, not the precompiled version

    You can get the source code downloading it from the Official MeteoIO website, or through the wget command.

    # install wget, it's not installed by default in OS X
    $ brew install wget
    
    $ mkdir ~/source_codes
    $ cd ~/source_codes
    
    # download the source code in the preferred directory
    $ wget http://models.slf.ch/p/meteoio/downloads/get/MeteoIO-2.4.2-src.tar.gz
    
    # extract source code from tar file
    $ tar -xzvf MeteoIO-2.4.2-src.tar.gz
    
    # cd into the MeteoIO main directory
    $ cd MeteoIO-2.4.2/

    The next step is building the source code. First of all you have to install the building system: CMake

    $ brew search cmake
    $ brew install cmake

    The following steps are strictly related to the building part of the MeteoIO source code.

    $ ccmake .

    1pic

    The press c to configure

    2pic

    Go to the last of one line and enable PROJ4 flag: OFF => ON

    3pic

    Press c to configure

    7pic

    Press again c to configure and then g to generate. After pressing g you might get a warning message but this depends on your cmake version and it’s not a problem at the moment. If you get the warning, just press e to exit.

    8pic

    Now you have to build the source code. It may take some minutes, if everything goes to the end without errors you have to install the built libraries.

    $ make
    $ make install

    If you get some kind of error, please write at the GEOtop users mailing lists [email protected]

 

2. Building GEOtop master branch

You can get the source code cloning it from the Official GitHub repository.

You might need to install git version control system.

$ brew search git
$ brew install git

$ cd ~/source_codes
$ git clone https://github.com/geotopmodel/geotop.git
$ cd geotop

Then, build the source code. It’s quite similar to building MeteoIO.

$ ccmake .

1picGT

Press c to configure. The linking library mode is shown (in this specific case SHARED). Press e to exit

2picGT

Now you have to choose if using the MeteoIO interpolators or GEOtop internal routines. To do that:

  • ENABLE_INTERNAL_METEODISTR = OFF
    it enables the MeteoIO space interpolators (DEFAULT);
  • ENABLE_INTERNAL_METEODISTR = ON
    it enables the GEOtop internal routines.

4picGT
3picGT

Then press c to configure, e to exit from the linking mode screen and g to generate. You might get a warning. Don’t worry, press e to exit and go on.

5picGT

Now build and install the source code.

$ make
$ make install

You can now test the installation changing directory and running GEOtop without creating symlinks!

$ cd tests/test_sample_run/small_example
$ geotop .

About Francesco Serafin

I am a PhD student at the Department of Civil, Environmental and Mechanical Engineering at the University of Trento. My two greatest loves: Computer Science and Water (take three with my Lenovo!:D). As a result, the aim of my life is to make both passions coexist. My gpg public key available at https://pgp.mit.edu

Leave a Reply

Your email address will not be published.

*