How To Install CCA

From CSDMS
Revision as of 16:16, 8 October 2008 by Huttone (talk | contribs) (My Notes on installing CCA tools an OSX and Solaris)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Installing the CCA Tools

To install CCA on your machine you will need GNU make, Bourne shell, python (2.3 or better), a c compiler and Sun's Java Development Kit. In addition, you will need compilers for any other language bindings you want babel to support. For python bindings, you will also need to have Numeric 24.2 installed.

Download

Download the latest version of the CCA installer. This is found at:

http://www.cca-forum.org/download/cca-tools/nightly/cca-tools-contractor.tar.gz

This is just the installer. Once configured, it will download and install all of the components needed for a complete CCA installation. Unpack the installer,

<geshi lang=bash> > tar xvfz cca-tools-contractor.tar.gz </geshi>

This creates the directory `cca-tools-contractor` that contains the necessary installer.


Configure the installer

Move into the `cca-tool-contractor` directory to configure the build system. This is done by running `./contract.py` with the appropriate flags that specify the location of your various compilers and the final installation directory. On my Mac (OS X 10.5),

<geshi lang=bash> > ./contract.py --configure

               prefix=/usr/local/cca
               python=/usr/bin/python
               java=/usr/bin/java 
               cc=/usr/bin/gcc-4.0
               cxx=/usr/bin/g++-4.0 
               f77=/usr/local/gnu/bin/gfortran
               f90=/usr/local/gnu/bin/gfortran

</geshi>

This will setup the build system to use the indicated compilers and install CCA in `/usr/local/cca` (make sure that the `prefix` directory exists and that you can write to it).

For help on the various options, <geshi lang=bash> > ./contract.py --help </geshi>


Build CCA Tools

To build and install the CCA tools, <geshi lang=bash> > ./contract.py </geshi>

This will download, build, and install the required packages. Installed packages include,

If you successfully build CCA on your machine, please add it to the [CCABuildSuccess list of successful build platforms] (if it's not already there). If you are unsuccessful, please submit it as an issue under the issues tab.

For babel to generate python bindings, Numeric must be installed. To double check that you have numeric installed,

<geshi lang=bash> > python -c 'import Numeric' </geshi>

If you don't see an error message, you should be fine.

OS X 10.5 Notes

There is an incompatibility with the ccaffeine (0.8.4) package and OS X 10.5 (Leopard). I've fixed this version of ccaffeine and use it to when compiling the CCA tool chain. To ensure that the build system uses this version, place it in `cca-tools-contractor/urlcache`.

<geshi lang=bash> tar r xvfz cca-tools-contractor.tar.gz \ && cd cca-tools-contractor \ && mkdir -p urlcache \ && cp ../ccaffeine-0.8.4-FIXED.tar.gz ./urlcache/ccaffeine-0.8.4.tar.gz </geshi>

The downloads section contains the fixed version of ccaffeine, and a script to configure, build, and install CCA using the correct ccaffeine file. Alternatively, you could run `contract.py`, let it fail trying to make ccaffeine, and edit the offending file by hand. It's any easy fix. Change line 410 of `build/ccaffeine/cxx/dc/distributed/SocketConnectionManager.cxx` from <geshi lang=c>

       if FD_ISSET(connection->connSocket, &read_fds) {

</geshi> to <geshi lang=c>

       if (FD_ISSET(connection->connSocket, &read_fds)) {

</geshi>

Solaris 5.8 Notes

There is some extra work to install CCA on Solaris. The main problem is that the build system assumes `/bin/sh` is GNU bash > 3.0. If you are able to, the easiest fix is to link `/bin/sh` to the appropriate version of bash. On my machine, <geshi lang=bash> > sudo ln -s /usr/local/gnu/bin/bash /bin/sh </geshi>

Careful with this! After installing CCA, you'll probably want to undo the link and return `/bin/sh` back to its normal self.

Now set the `LIBS` environment variable so that realtime library is linked to <geshi lang=bash> export LIBS="-lrt" </geshi>

This library provides definitions of sem_destroy, sem_wait, sem_post, and sem_init. Without this, the build will fail during the make of ccaffeine.

Unfortunately, even after this the build will not succeed. The build should fail during the ccaffeine make complaining about `fcntl` not being declared. That's because `fcntl.h` is included. You'll need to edit `build/ccaffeine/cxx/dc/distributed/SocketConnectionManager.cxx`. Notice that `#include <fcntl.h>` is wrapped by a couple of `ifdef`s. Either get rid of the `ifdef`s or move the include statement outside of them. Now go back to the top-level build directory and run `contract.py` again. That should do it!


Troubleshooting

From my experience, most CCA build problems arise from the assumption that `/bin/sh` is GNU bash (version 3 or greater). Make sure that this is the case for you by running the following command <geshi lang=bash> /bin/sh --version </geshi> This should print something like, <geshi lang=bash> GNU bash, version 3.2.17(1)-release (i386-apple-darwin9.0) Copyright (C) 2005 Free Software Foundation, Inc. </geshi> If you get an error message, or a version lesser than 3, you'll probably have build problems. The easiest solution is to link `/bin/sh` to an up-to-date version of bash. If this is not possible, you can run a `sed` script to replace all occurrences of `/bin/sh` in the source files with the correct bash version. Although not the most elegant solution, it's worked for me.


Problem: Can't find libpython2.5 during babel make.

Solution: libpython2.5 probably isn't in a usual place. On my machine it is found in `/usr/local/python/lib`. You can tell the compiler where to look by defining the environment variable LDFLAGS, <geshi lang=bash> export LDFLAGS="-L/path/to/python/library:$LDFLAGS" </geshi>


Problem: Can't find `tclsh` during ccaffeine build.

Solution: First, make sure tcl is installed on you machine. If not, install it. If it is, make sure that tclsh is in you path. On my machine it's located in `/usr/local/tcl-tk/bin`, <geshi lang=bash> export PATH=/usr/local/tcl-tk/bin:$PATH </geshi>