How To Install CCA

From CSDMS
Revision as of 23:22, 26 October 2008 by Huttone (talk | contribs) (Reorganize the CCA install page (a lot more to do still))

Installing the CCA Tools

This page describes how to install the collection of Common Component Architecture tools. If you haven't downloaded the installer, you can use the link below to get started. After doing so, please read the rest of the document to learn how to build, and install the complete CCA tools package.


System and Software Requirements

Supported Operating Systems:

  • OS X v10.5.x
  • Fedora 8 and 9
  • Ubuntu 7 and 8
  • Solaris 5.8

These operating systems aren't exactly supported, but the CCA has been successfully installed on each of them.

Required software:

  • gcc
  • g++
  • gfortran
  • java
  • python

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 either Numeric 24.2 or numpy installed.

To check this, at the command line type: <geshi lang=bash> > python -c "import numpy" </geshi> If no error messages are printed, you are good to go.


Configure

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, called contractor.

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. To configure, something like the following command should work. <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> I say 'something like the following' for a reason. This may not work exactly as presented for your particular machine. Please refer to the specific OS notes that follow.

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 of contractor type, <geshi lang=bash> > ./contract.py --help </geshi>


Build/Install

If everything has been configured properly, the build should be easy (just a little time consuming). 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,

After the installation process is complete, it's a good idea to double-check that babel has been compiled to generate the bindings you want it to. Sometimes the babel configure process will silently disable certain bindings. Use the babel-config command to check this: <geshi lang=bash> > babel-config --with-bindings c c++ f77 f90 java python </geshi> This prints a list of all supported language bindings. If you don't see all of the languages you expect, please have a look at the troubleshooting section.

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 to me.

Specific OS Notes

OS X v10.5.x

Some extra steps must be taken to install on Mac OS X:

  • Ensure the correct Java version is being used. You can accomplish this be setting the environment variable JAVA_HOME to the location of the correct version of Java, and adding its bin directory to your path.
  • Configure with babel version 1.2.1, and use the nightly builds.

The following script gives an example of how this is done. <geshi lang=bash>

  1. !/bin/sh

PREFIX=/usr/local/cca

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

export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home export PATH=$JAVA_HOME/bin:$PATH

./contract.py --configure \

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

./contract.py </geshi>

Solaris 5.8

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 8

The biggest problem with installing the CCA tool chain on Ubuntu is 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.

<geshi lang=bash> ( cd /bin && tar cvf ~/sh.tar sh ) && sudo cp /bin/bash /bin/sh </geshi>

To undo, <geshi lang=bash> sudo rm /bin/sh && ( cd /bin && sudo tar xvf ~/sh.tar ) </geshi>

The GNU java compiler doesn't seem to work with the CCA tools, so I installed the full sun version. You can find this with the package manager as sun-java6-jdk. You may also need to uninstall the GNU version (gij).

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
  1. Do this to make /bin/sh be bash
  2. ( cd /bin && tar cvf ~/sh.tar sh ) && sudo cp /bin/bash /bin/sh
  1. Install the CCA tools here

PREFIX=$HOME/cca

  1. Use these compilers

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

  1. Put the installation directory in your PATH so that
  2. libxml2-config can be found

export PATH=$PREFIX/bin:$PATH

  1. Configure the installation

./contract.py --configure \

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

./contract.py

  1. Do this to return /bin/sh back to how it was
  2. sudo rm /bin/sh && ( cd /bin && sudo tar xvf ~/sh.tar )

</geshi>

Fedora 8

Unlike installing on Fedora 9, the CCA tools install process is fairly painless on Fedora 8. Before starting, make sure that you have the following programs installed on you machine,

gcc 4.1.2
g++ 4.1.2
python 2.5.1
java 1.7.0
gfortran 4.1.2

In addition, you should have a version of tclsh in your path.

Fedora 9

Fedora 9 comes with gcc 4.3 which causes problems with the CCA build. In particular with the packages: spec_neo, spec_babel, and ccaffeine. With version 4.3, the GNU folks cleaned-up many of the include files, by removing unnecessary includes. For instance cstring is no longer included within string. This generates errors that look something like, <geshi lang=bash> error: 'strcmp' was not declared in this scope </geshi> There are two fixes:

  1. Use an older (but not too old) version of gcc. 4.1 is a good choice, but 3.4 is too old (the babel build uses options that are apparently not available in 3.4).
  2. Add the appropriate include directives to the offending files. Note that there is a long list of offending files. I will provide a fixed version of the packages, and an updated contractor that knows to download these packages.

For this build I used the following:

gcc 4.3.0
g++ 4.3.0
python 2.5.1
java 1.6.0
gfortran 4.3.0

If you don't have tclsh (I didn't), install it now. Finally, after unpacking the cca-tools-contractor.tar.gz, you will need to edit two files: packages/libxml2.py, and packages/ccafe_gui.py. The versions of these packages need to be updated, as neither of the indicated versions are available. The libxml2 version should be, <geshi lang=python> libxml2_version = "2.6.31" </geshi> If you already have libxml2 installed on your system, don't bother updating this as contractor should realize this and so won't try to build it. The ccafe_gui version should be set as: <geshi lang=python> ccafe_gui_default_version = "0.5.6" </geshi>

Below is my install script for the Fedora build. This should be run from within the cca-tools-contractor at the same level as contract.py. <geshi lang=bash>

  1. !/bin/sh
  1. Location to put the CCA tools

PREFIX=$HOME/cca

  1. Define the compilers

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

  1. Configure contractor to build the CCA tools

./contract.py --configure \

             prefix=$PREFIX \
             cc=$CC \
             cxx=$CXX \
             java=$JAVA \
             f77=$F77 \
             f90=$F90
  1. Build the CCA toolchain

./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)