Skip to content

LinkingWithCasaCore

Gijs Molenaar edited this page Feb 13, 2014 · 5 revisions

Instead of AIPS++, you need to build three separate packages: casacore, pyrap and casarest. The former two are hosted on Google Code, the latter can be obtained from our subversion server (see below).

Building casacore

Casacore is available from http://code.google.com/p/casacore/. See especially their build instructions:

  1. Make sure all requisite software is present (see their BuildInstructions for a list). On Debian, this includes the following packages: bison flex gfortran libgfortran1-dev libcfitsio3-dev lapack3-dev refblas3-dev.

    • NB: casacore uses the scons package (http://www.scons.org/) for building. At time of writing (July 2008), Debian was shipping version 0.96, while the latest stable on the scons website was 0.98. Unfortunately, both versions seem to be bug-prone -- I recommend downloading 0.97 from the scons site. 1.0 is expected soon, hopefully they will have all the bugs worked out.
  • NB2: As of Jan 2009, scons-1.1 is required to build casacore, casarest and pyrap.
  1. Download wcslib. http://www.atnf.csiro.au/pub/software/wcslib/wcslib.tar.gz

Configure & install with:

  • {{{ $ ./configure --prefix=/usr/local
    $ make install $ cp wcsconfig.h /usr/local/include/wcslib}}}

(The last step is necessary because make install misses that file for some reason.)

  1. Download casacore. I used the 0.3.0 stable release tarball, but you can also try the svn version (see their Build Instructions page for details.) Unpack the tarball, cd into the casacore directory, and run:
  • on a 32-bit system: * $ ./batchbuild.py enable_hdf5=false prefix=/usr/local wcsroot=/usr/local/ install
  • on a 64-bit system: * $ ./batchbuild.py enable_hdf5=false prefix=/usr/local wcsroot=/usr/local/ extrafflags=-fPIC install This installs casacore under /usr/local. If you want to put it into a different location, change the prefix option (and specify the same location with casacoreroot for the packages below.)

The build went smoothly once I had the required software packages in place. If something is missing, the error messages can be somewhat opaque. I'm collecting possible errors and solutions here: ProblemsBuildingCasaCore.

NB: As of casacore-0.4.0, the enable_hdf5=false option appears to be ignored, and a lot of errors show up from the HDF5 package. Perhaps a newer version of libhdf5 is required to build casacore. Alternatively, remove libhdf5 from your system completely, so scons does not detect it and does not try to build casacore's HDF5 support.

Building pyrap

Download from http://code.google.com/p/pyrap. Make sure boost-python is installed (in Debian, the package is called libboost-python-dev). Build & install with:

  • $ ./batchbuild.py --casacoreroot=/usr/local Note that this requires root privileges, as it installs Python modules into /usr and such. If you want to install locally instead, use the prefix option to install them elsewhere.

  • NB: a major gotcha is that you MUST build pyrap against numpy, not numarray. Pyrap will cheerfully build against either, but since MeqTrees uses numpy, using it with a numarray-built pyrap will cause all sorts of strange failures. Remove numarray from your system if you can (it's obsolete anyway), or if you can't do that, then carefully check your pyrap build messages to make sure that numpy is being used and not numarray.

  • For recent numpy versions (certainly as of 1.2.1), the build may fail with checking for numpy/config.h: no. This is because numpy changed the name of config.h to numpyconfig.h. Until pyrap fixes this, the only way to work around it is to (as root) make a symlink in the numpy include directory from config.h to numpyconfig.h.

  • If your build fails with something like:

       * `OSError: [Errno 2] No such file or directory: 'pyrap_fitting/current'` 
    
  • this can be fixed with: * cd pyrap_fitting && ln -s tags/pyrap_fitting-0.1.0/ current

  • NB: If your compiler of choice is gcc/g++ >=4.0, you need to have gfortran installed. (Debian packages gfortran and libgfortran1-dev.)

Building casarest

The casarest package provides the lwimager (lightweight imager) binary. Source can now be checked out of our subversion server.

  • {{{ $ svn co svn://lofar9.astron.nl/var/svn/repos/trunk/casarest

$ cd casarest $ ./batchbuild.py prefix=/usr/local casacoreroot=/usr/local wcsroot=/usr/local install }}}

This installs lwimager in /usr/local/bin, so make sure your PATH variable includes that directory.

NB: As of 01/2009, you may also need to add the options FORTRAN=gfortran f2clib=gfortran to the batchbuild.py command.

NB: You may be tempted to build shared libraries (by supplying the shared option to batchbuild). Don't: as of 4/6/2008, this doesn't work with casarest.

Installing measures data

The casacore page mentions "measures data" that needs to be installed. This is just a bunch of data files that need to be present in a specific directory. Don't bother to download this, as there's already a copy under casarest/measues_data. You will need to install a .casarc file as follows:

  • $ cp ~/casarest/casarc ~/.casarc ...and then edit the paths in .casarc to point to your actual measures_data location.

Linking MeqTrees against casacore

In your variants file, replace the --with-aipspp option with the options:

--with-casacore=/usr/local --with-wcs=/usr/local

Since wcslib is not bundled with casacore -- as it was with aips++ -- it has to be specified here. Whatever --pefix you used for wcslib installation (e.g. /usr/local), that's the path you should give to --with-wcs. 


## Known problems

CompiledFunklet.cc does not work with casacore. This is deprecated code anyway, and will be removed shortly. 
Clone this wiki locally