How To Install CCA

From CSDMS
Revision as of 13:34, 19 October 2008 by Huttone (talk | contribs) (Update Ubuntu CCA install directions)

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!

Ubuntu

I have successfully installed the CCA tools on Ubuntu 7.10. The largest problem was that /bin/sh was not bash. To fix this, I copied /bin/bash to /bin/sh. Note that setting the BASH environment variable to /bin/bash helped solve some problems but still was not enough for a successful build as some scripts use /bin/sh rather than $BASH.

My Ubuntu distribution didn't come with the java compiler so I installed a full java distribution and added it to my path. I probably could have defined the environment variables JAVA, JAVAC, etc. to point to the new programs rather than changing my path.

I needed to add the bin directory of the CCA install path to my PATH as well. Because I used an internal installation of libxml2, xml2-config, which is needed by the babel configuration, could not be found.

Finally, I had to edit the python files, packages/libxml2.py and packages/ccafe_gui.py to indicate different versions of these packages. libxml2 version 2.6.28, and ccafe_gui version 0.5.7 are no longer available for download. In libxml2.py: <geshi lang=python> libxml2_version = "2.6.32" </geshi> In ccafe_gui.py: <geshi lang=python> ccafe_gui_default_version = "0.5.6" </geshi>

With these changes, I used the following script to build and install the CCA tools.

<geshi lang=bash>

  1. !/bin/sh

PREFIX=/usr/local/cca PYTHON=/usr/bin/python JAVA=java CC=/usr/bin/gcc CXX=/usr/bin/g++ F77=/usr/bin/gfortran F90=/usr/bin/gfortran

export PATH=$PREFIX/bin:/usr/local/jdk1.6.0_04/bin:$PATH

./contract.py --configure \

             prefix=$PREFIX \
             python=$PYTHON \
             java=$JAVA \
             cc=$CC \
             cxx=$CXX \
             f77=$F77 \
             f90=$F90

./contract.py

</geshi>

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>

Successful CCA Builds

CCA Tools Contractor Build version 0.2.2

Operating System Compiler (version)
c c++ Python Java Fortran 77 Fortran 90
OS X 10.5.x gcc (4.0.1) g++ (4.0.1) python (2.5.1) java (1.5) gfortran (4.1.2) gfortran (4.1.2)
OS X 10.5.x gcc (4.0.1) g++ (4.0.1) python (2.5.1) java (1.5) gfortran (4.2.1) gfortran (4.2.1)
Fedora 8 gcc (4.1.2) g++ (4.1.2) python (2.5.1) java (1.6) gfortran (4.2.2) gfortran (4.2.2)
Ubuntu 7.10 gcc (4.1.3) g++ (4.1.3) python (2.5.1) java (1.6) gfortran (4.1.3) gfortran (4.1.3)
Solaris 5.8 gcc (4.1.2) g++ (4.1.2) python (2.5) java (1.6) gfortran (4.1.2) gfortran (4.1.2)