Custom building Coot from source code

From CCP4 wiki
Revision as of 14:01, 4 July 2008 by Kevin Cowtan (talk | contribs)
Jump to navigation Jump to search

This is an advanced task. Don't attempt it unless you are a Unix expert. The normal method installing Coot is to download a binary, or to use the autobuild scripts: Coot.

First, Install CCP4 on Linux.

I let ccp4 build its own fftw. Be sure to build the clipper libraries. After you complete the default installation, go back to $CLIB/clipper/clipper/mmdbold and build some more libraries, i.e.,

cd  $CLIB/clipper/clipper/mmdbold
make
make install

to get the additional mmdbold libraries installed in their canonical location. This should take care of the ccp4-type dependencies, as well as ensuring that you have fftw libs that play well with the clipper libraries.

Second, install a newer version of Clipper

Get the latest clipper from

wget http://www.ysbl.york.ac.uk/~cowtan/clipper/clipper.latest.tar.gz

I installed the latest clipper into /usr/local/xtal It was a PITA to compile:

CPPFLAGS="-I$CLIB/src/mmdb" ./configure --prefix=/usr/local/xtal --with-fftw=$CCP4 \
--with-ccp4=$CCP4 --with-mmdb=$CLIB --enable-cns --enable-ccp4 --enable-mmdb \
--enable-mmdbold --enable-cif --enable-minimol

Third, make sure the other needed dependencies are installed

These include at least the following dependencies:

Ubuntu packages

A list of coot dependencies that is probably only a subset

Others that you have to make yourself:

goosh (I had to compile this myself)

guile-gui (I had to compile this myself)

guile-gtk-2.0 (I had to compile this myself)

net-htttp (I had to compile this myself)



To do so, I used

configure --prefix=/usr
make
sudo make install


Fourth, configure and build coot like this:

Use sudo zsh (or whatever shell) to open a root shell, and issue the commands


CPPFLAGS="-I$CLIB/src -I$CLIB/src/mmdb" ./configure --with-mmdb-prefix=$CCP4 --with-clipper-prefix=/usr/local/xtal \
--with-fftw=$CCP4 --with-glut-prefix=/usr --with-gl-prefix=/usr/X11R6 --with-gtk2 --with-gnomecanvas-prefix=/usr \
--with-ssmlib-prefix=$CCP4 --with-imlib-prefix=/usr --with-gtkgl-prefix=/usr --with-glib-prefix=/usr --with-guile-gtk \
--with-guile-gtk-prefix=/usr   --with-gsl-prefix=/usr --with-guile --with-python --prefix=$PWD

Remake the src/coot_wrap_python.cc and src/coot_wrap_guile.cc files

/bin/rm -f **/coot_wrap_**.cc
cd src
touch c-interface-database.hh
make coot_wrap_guile.cc
make coot_wrap_python.cc
cp coot_wrap_guile_pre.cc coot_wrap_guile.cc
cd ..

Now compile it:

make 
make -i install
cp src/coot.py python/.
cp src/coot.py share/coot/python/.

Now add the reference structures:

cd share/coot
wget http://www.ysbl.york.ac.uk/~emsley/software/coot-reference-structures.tar.gz
tar xvfz coot-reference-structures.tar.gz ; rm coot-reference-structures.tar.gz

Now add the refmac dictionaries (eg using coot-0.4.1 and refmac 5.4; change as required):

cd /tmp
wget  wget http://www.ysbl.york.ac.uk/refmac/data/refmac5.4_dictionary.tar.gz
tar xvfz refmac5.4_dictionary.tar.gz
mkdir -p  /usr/local/xtal/coot-0.4.1/lib/data
cp -r dic /usr/local/xtal/coot-0.4.1/lib/data/monomers

Export the COOT_REFMAC_LIB_DIR variable (you can edit bin/coot):

 export COOT_REFMAC_LIB_DIR=$COOT_PREFIX/lib

The configure command is all one line; I've escaped the return. Using --prefix=$PWD simply keeps everything self-contained. You can use any install prefix you want to (it defaults to /usr/local; another sensible choice is /usr/local/xtal. Avoid /usr as a prefix, as it can mess with your system).

The make -i install is needed if you choose --prefix=$PWD because it tries to install some files where they are presently situated.


If you want to make it portable

You don't need to do this to run coot; this is only handy if you need to redistribute it (or make say a debian package).

You can see what dynamic libraries coot needs to load by issuing the command


ldd coot-real 

or, if you just want to see the full path to the libraries, issue

ldd coot-real | awk '{print $3}' | grep -v fff | sort -u

You can use additional grep filters to select the ccp4 libs, clipper libs, eliminate coot's own libaries (that are already in the lib directory) and so forth.


(The ldd command is equivalent to otool -L on Mac OS X.) Then you can copy these into coot's lib directory. I used the following commands in zsh to copy in the needed directories (this is overkill, but wtf).

 cd /usr/local/xtal/coot-0.1.2/bin
 foreach dylib in $(ldd coot-real | awk '{print $3}' | grep -v fff | grep -v "usr/local/xtal/coot" | sort -u )
      print copying $dylib 
      sudo cp -i $dylib /usr/local/xtal/coot-0.1.2/lib/.
 end

In addition, the guile modules can all be put in one centralized location:

cp -R /usr/share/guile* /usr/local/xtal/coot-0.1.2/share/.

Finally, you can give coot its own copy of the refmac monomers library:

mkdir -p /usr/local/xtal/coot-0.1.2/share/coot/lib/data
cp -R /usr/local/xtal/ccp4-6.0/lib/data/monomers /usr/local/xtal/coot-0.1.0-pre-3/share/coot/lib/data/.

Then edit /usr/local/xtal/coot-0.1.2/bin/coot and un-comment the appropriate environment variable lines (there are 2).