Solving Astronomy Software-Rot

22 Apr 2014 · by bathompso · in  Research 

There is a problem in astronomy (probably in other sciences too, but I see it mainly in my field), which I will term "software-rot," after the better known term link-rot. There are several key packages of software that many astronomers rely on to do basic data reduction that are either no longer being developed, or the developer is working on such an old configuration it may as well not be.

The main offender is most likely IRAF, which every astronomer will tell you they hate, but still install and use it anyway. IRAF is old and clunky, with installation documentation which looks like it is from another decade. The problem was supposed to be fixed with PyRAF, but it seems like more of a rewrite of bad code in a new language (python) than an actual solution.

While I do not work on spectroscopy, a vast majority of the TCU lab focuses on it. One of the main reduction programs in astronomical spectroscopy is Chris Sneden's MOOG. This program, one of the most used single software packages in astronomy, is written in FORTRAN-77 which, at 27 years old, is barely supported by the most recent gfortran compiler. A program that is so widely used by astronomy graduate students shouldn't be older than the students themselves.

With IT pushing old machines off the network, the TCU lab is in the process of upgrading every computer from Snow Leopard to Mavericks to future-proof the lab for several years. With this upgrade comes the task of re-compiling all the source code we use on a daily basis. MOOG is one of these programs. Even without the migration, MOOG has been almost impossible to install, and even more trouble comes with the removal of all 32-bit libraries in OS X versions 10.7+.

Luckily, I found an awesome 1-click installer for MOOG, packaged as a Python program. Unfortunately, this program does not compile on Mavericks. So before we upgraded any of our machines, we needed to figure out a way to get MOOG running on 10.9. Fortunately, I discovered how. While the installer for MOOG does not work on Mavericks, it does work on Snow Leopard. And I've found that the pre-built binary from a Snow Leopard installation will work and run on a Mavericks computer.

To get this working on your machines, follow the steps below.

  1. First, you'll need access to a OS X 10.6 Snow Leopard machine. This can be in the form of an actual Snow Leopard computer (which we still have around the lab), or a Virtual Machine running Snow Leopard. More recent version of OS X (10.7+) allow for virtualization of Snow Leopard Server (not the client version). If you have an install disk for 10.6 Server, hold onto it, as you can make a Virtual Machine in Virtualbox or some other virtualization software.

  2. On your Snow Leopard machine, install XCode. This can be done by either running the XCode installer from the install DVD, or downloading an XCode installer from developer.apple.com/downloads, logging in with your AppleID, and searching for Snow Leopard XCode downloads.

  3. Next you'll need to download g77, a GNU FORTRAN-77 compiler, which you can find at hpc.sourceforge.net. Make sure to download the intel version, which will extract to g77-intel-bin.tar. Install the binaries by running sudo tar -xvf g77-intel-bin.tar -C /

  4. Next, you'll need to download and install scisoft. While scisoft itself is definitely a "software-rot" offender, it's also the only way to get a (free) version of SuperMongo installed, which is required for MOOG. It's a monster of a package, and will install a ton of things, but if you're astronomer you'll probably want them installed anyway (IRAF and scientific Python installations are also included).

  5. Lastly, you'll need to download the MOOG 1-click installer from github.

  6. Now you just need to install MOOG. Within the newly-downloaded moog-master, run sudo python setup.py install. The build should run with no errors. The newly-built MOOG and MOOGSILENT binares will be located in /usr/local/bin/.

The MOOG and MOOGSILENT binaries will work on a Mavericks installation. I believe there is a problem with the install on Mavericks because g77 and the other associated libraries contain only 32bit binaries, which Mavericks does not allow. However, Mavericks has no trouble running 32bit binaries once they are compiled, and therefore the Snow Leopard-built executables will function properly.

Before you can run this executable on your Mavericks computer, you'll have to install a few things. On the new computer you wish to install MOOG on, you'll have to run a few more steps.

  1. Again, download and install scisoft (using a Mavericks version this time). MOOG depends on SuperMongo, and therefore these libraries must exist.

  2. Make sure X11 is installed. Because Apple no longer maintains their X11 application, you'll have to download and install XQuartz instead.

  3. When MOOG starts, it writes some data files to a specific directory. In the current install, this directory is located at /.moog. You will have to create this directory manually and make sure that all users can read and write to it.

  4. Lastly, you'll have to download a modified version of the 1-click installer from my github, which contains an additional library, libg2c.0.dylib. Copy this library to /usr/local/lib.

  5. After all the prerequisites are satisfied, copy over the compiled binaries to somewhere within your path. I chose /usr/local/bin, as that's where they were installed on the original Snow Leopard machine.

Now you should be able to run a fully-working MOOG program on your less-than-5-years-old OS. On the first run, it may take a long time for MOOG to initiate X11 (since I run everything through Terminal), or sometimes fail to intitate it at all. It helps to open X11 before initiating the program, as then it will pop up immediately.

I strongly suggest backing up these executables once you confirm they're working correctly. This method relies on programs which may no longer exist several years from now, and it's better to have an archive of the compiled binaries than a walkthrough which sources links that no longer exist.



Connect With Me
Recent Twitter Status