Tuesday, June 21, 2016

Installing IRAM GILDAS on Ubuntu (2016/06)


What is IRAM GILDAS? See here : http://www.iram.fr/IRAMFR/GILDAS/

NOTE: Updated for Ubuntu 16.04 Xenial Xerus.
Nowadays the readme file on the IRAM webpage gives pretty good instructions for Linux as well: http://www.iram.fr/~gildas/dist/gildas.README

First download the source code from
http://www.iram.fr/~gildas/dist/index.html

named "gildas-src-mmmyya.tar.gz" where "mmm" is month e.g. Oct, and "yy" is year e.g. 16 and "a" is some letter which signifies the release number, starting with a.

Unpack and enter the directory (it will be installed in the same directory as the unpacked directory, but with "exe" instead of "src" in the name):
tar -xvzf gildas-src-mmmyya.tar
cd gildas-src-mmmyya
For the new GNOME3 framework, we still need to download libgtk2.0. Hence the dependencies are (including optional dependencies):
sudo apt install gfortran g++ libgtk2.0-dev python-dev python-numpy libblas-dev liblapack-dev libfftw3-dev libcfitsio3-dev

export GAG_SEARCH_PATH="/usr/lib:/usr/lib/x86_64-linux-gnu"
export gagexedir=/home/magnusp/applications/gildas-current

Then configure environment variables and similar with the bash script:

source admin/gildas-env.sh -s /usr/lib:/usr/lib/x86_64-linux-gnu

Note: the -s flag with "/usr/lib:/usr/lib/x86_64-linux-gnu" is to add more search paths so that it find CFITSIO and PNG libraries

Here you probably get one warning, something related to some ALMA holography thing, no worries you wont need it. If you do get some other warnings, resolve those dependencies first. After this just run 
make

this takes a couple of minutes. Then run
make install

to finally install GILDAS. This will install it in another directory, with "exe" instead. You can move this directory some place else if you want.

Now, to set the environment variables you get a message when the "make install" script finishes, you get a message of what to add, e.g.,:
export GAG_ROOT_DIR=/path-to-gildas/gildas-exe-MMMYYa
export GAG_EXEC_SYSTEM=x86_64-ubuntu13.10-gfortran
source $GAG_ROOT_DIR/etc/bash_profile
NB: The part that says "x86_64-ubuntuXX.YY-gfortran" will be specific for your system, e.g. for the latest Ubuntu this should be "x86_64-ubuntu16.04-gfortran".
Just add the statement printed out last in in make install to the end of your .bashrc or .bashrc_profile file (e.g., "nano ~/.bashrc" or "nano ~/.bash_profile").

To remove the start-up message i.e. the one that says something like this,
Selecting GILDAS version: mmYYa (21jun16 09:46 cest), executable tree, x86_64-ubuntu16.04-gfortran

every time you start a terminal you have to comment out the following lines in the file /path-to-gildas/gildas-exe-MMMYYa/etc/bash_profile :
if [ -n "$PS1" ]; then
    echo
    echo "Selecting GILDAS version: mmYYa (21jun16 09:46 cest), executable tree, ${GAG_EXEC_SYSTEM}"
    echo
fi

that is, put hash-tags (#) in front of all the lines. 
Done! Now to run a GILDAS program just fire up the terminal and run whatever GILDAS program you want: mapping, class, astro, clic.

8 comments:

  1. This is great, works on my 64-bit 13.04! Thanks a bunch, the last time I've tried it, I ended up in a dependency hell I couldn't resolve.
    Also, you probably need to replace
    "comment out the following lines in the file /home/username/apps/gildas-exe-MMMYYa/etc/bash_profile"
    with something more generic like:
    "path-to-gildas/gildas-exe-MMMYYa/etc/bash_profile"

    Cheers!

    ReplyDelete
    Replies
    1. @Vlas Sokolov : Good to hear that others benefit from this. I changed the example path to your suggestion. Thanks!

      Delete
  2. Hi! Thanks for the post and hints. I've tried to install GILDAS under /usr/local/bin so that several users from my institute could run it from a server. Unfortunately, the make command issues an error message saying it cannot create a directory under /usr/local/bin. I've tried to run it as superuser, but it still cannot create the directory during the installation. Have you seen this problem before? Regards!

    ReplyDelete
    Replies
    1. Hi Helio Jaques Rocha. I don't think that installing GILDAS directly under /usr/local/bin is a good idea. Just install it in a common directory (say '/common/gildas-current'), make that directory readable by all users (chmod +r /common/gildas-current), and then make sure all users have the export and source lines in their .bashrc/.bash_profile file. i.e.

      export GAG_ROOT_DIR=/common/gildas-current
      export GAG_EXEC_SYSTEM=pc-debianwheezy-gfortran <-- IF this is your system!
      source $GAG_ROOT_DIR/etc/bash_profile

      Then all users that log on to the server should be able to run the program (and use the GUI given that they have X11 forwarding activated).

      Hope it works out!
      Magnus

      Delete
  3. Hi!
    Thanks for this guide, the full dependencies fixed a problem I had at the make stage with gtk.

    However the make now fails when trying to link to the libraris libgio and libgobject, many errors such as:

    /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to `g_variant_dict_end'

    Do you possibly have any suggestions here?

    Many thanks!

    ReplyDelete
    Replies
    1. Hi,
      great to hear that you find it useful. To be honest I have no idea what it can be.

      However, did you check that you have "libglib" installed, it contains the "libgio" library (http://packages.ubuntu.com/trusty/amd64/libglib2.0-0/filelist)?

      Cheers,
      Magnus

      Delete
    2. Yep! It appears to be installed using both apt-get and ldconfig, and is in the directory make thinks it is (as in, /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 is real, present and version 2.40.2).

      Thank you anyway :-).

      Delete
  4. Thank u so much!!!

    Excelent post

    ReplyDelete