Compiling, Building and Installing PrIME on 10.10

Ikram Ullah PhD Student Stockholm Bio-informatics Center, KTH

December 9, 2010 Contents

Upgrade to Ubuntu 10.10 2

Installation of required libraries 2 Install Essential Libraries ...... 2 Install CMake ...... 2 Install Fortran compiler ...... 2 Install Gengetopt ...... 2 Install Blas ...... 3 Install Lapack ...... 3 Install Bison ...... 3 Install Flex ...... 3 Install XML libraries for C/C++ (Xerces-C++) ...... 3 Install OpenMPI ...... 3 Install LibXML2 ...... 4 Install XSD library for C++ ...... 4 Install Libplot ...... 4 Install Boost 1.40 pack ...... 4 Install Subversion (SVN) ...... 4

Checkout PrIME source 4

Build PrIME using CMake 4

Possible Errors and their solutions 5

1 This short manual describes the steps necessary to compile, build and install PrIME on Ubuntu 10.10. Although this tutorial has been written for Ubuntu users, almost similar syntax can be used for installing the required libraries on Fedora, OpenSuse, and other flavors of Unix.

Upgrade to Ubuntu 10.10

First of all, upgrade to Ubuntu 10.10 if working with any lower version. During the build process, we noticed that PrIME has build issue on Ubuntu 10.04 due to some unmet MPI dependencies. They have been addressed in 10.10.

Installation of required libraries

In this section, we would list the required libraries for PrIME, along with termi- nal installation commands. It is possible that some of libraries may be already present in your Ubuntu installation in which case you may get the following output. Reading package lists... Done Building dependency tree Reading state information... Done cmake is already the newest version Alternatively some of the libraries may need installation of additional libraries. Please install any additional libraries if required.

Install Essential Libraries Download the essential libraries, if missing, like C/C++ etc using the following command. sudo apt-get install build-essential

Install CMake CMake is a unified, cross-platform, open-source build system that allows de- velopers to build, test and package by specifying build parameters in simple, portable text files. It is meta-build tool whereby it generates the Make- file script, including all the dependencies, for building c/c++ files. sudo apt-get install cmake

Install Fortran compiler Fortran is general purpose procedural language suited to scientific computing. It is used for running Lapack routines (discussed below). It can be installed using following command. sudo apt-get install gfortran

Install Gengetopt Gengetopt is a tool to write command line option parsing code for C programs (argc and argv). It takes care of processing command line arguments which,

2 though easy, takes valuable programmer time. It can be installed using following command. sudo apt-get install gengetopt

Install Blas BLAS stands for Basic Linear Algebra Subprograms and provides standard building blocks for performing linear algebra operations like vector/matrix mul- tiplication, inverse, transpose, eigen value computations etc. It can be installed using following command. sudo apt-get install libblas-dev

Install Lapack LAPACK provides routines for solving systems of simultaneous linear equations, least-squares solutions of linear systems of equations, eigenvalue problems, and singular value problems. It has been written in Fortran90 (thus needing fortran compiler to be present on system). It can be installed using following command. sudo apt-get install liblapack-dev

Install Bison Bison is a parser generator tool from GNU. It converts a context free grammer (CFG) to a parser for that grammer. It can be installed using following com- mand. sudo apt-get install bison

Install Flex Flex is used in conjunction with Bison for creating parsers. It can be installed using following command. sudo apt-get install flex

Install XML libraries for C/C++ (Xerces-C++) Xerces-C++ is an XML parser by Apache written in C++. Xerces-C++ makes it easy to give a C/C++ application the ability to read and write XML data. It supports both DOM and SAX formats. It can be installed using following command. sudo apt-get install libxerces-c2-dev

Install OpenMPI The Open MPI Project is an open source implementation of Message Passing In- terface (MPI) enabling us to write parallel code using multiple threads/processes in C/C++ and Fortran. It can be installed using following command. sudo apt-get install libopenmpi-dev

3 Install LibXML2 Libxml2 is a multi-plateform XML C parser and toolkit developed for the Gnome project. In addition to C, it can be used in other languages using different types of binding. It can be installed using following command. sudo apt-get install libxml2-dev

Install XSD library for C++ For XML schema definition support, we need to install XSD libraries for C++. It can be installed using following command. sudo apt-get install xsdcxx

Install Libplot GNU libplot is a free function library for drawing two-dimensional vector graph- ics. It can also produce jitter-free doubl-buffered animations (although we won’t be using that in PrIME for now). It can be installed using following command. sudo apt-get install libplot-dev

Install Boost 1.40 pack Boost is an open source, cross platform repository for free peer-reviewed portable C++ source libraries for various purposes like filesystem, datetime, persistence etc. Although currently version 1.45.0 is the latest boost release, please note that boost 1.40 has been tested to work with PrIME. Newer/older versions sometimes have weird dependency issues (either with PrIME or with the version of Ubuntu), so it is advised to first test PrIME with version 1.40.0 and then upgrade and test if necessary. Boost libraries can be installed using following command. sudo apt-get install libboost1.40-all-dev

Install Subversion (SVN) Subversion or SVN is a and a revision control system like CVS/Mercurial. It can be installed using following command. sudo apt-get install subversion

Checkout PrIME source

The required libraries for PrIME are almost complete now. We can proceed to check out the source using following command. svn checkout https://svn.sbc.su.se/repos/PrIME/trunk

Build PrIME using CMake

After this initial installation process, follow the following steps.

4 1. Create a folder named ”Prime” in home directory and copy the checked out folder (named trunk) there.

2. Rename the folder named ”trunk” to ”PrIME”. The path to PrIME would be /home//svn/PrIME/ where is the name of ubuntu ac- count like root etc. 3. Make a folder named ”primeinstall” in home directory ( /home//primeinstall )

4. Run the following command to compile and build PrIME. rm -rf /tmp/primebuild && mkdir /tmp/primebuild && cd /tmp/primebuild && cmake -DCMAKE INSTALL PREFIX= /primeinstall -DCMAKE PREFIX PATH=/afs/pdc.kth.se/home/e/esjolund/Public/software/libxml2/2.7.6/install/system/ -DEXCLUDE PRIMETV=on -DEXCLUDE PRIMECT=on -DEXCLUDE LSDCOMBINE=on -DEXCLUDE PRIMEGSRORTHO=on -DEXCLUDE PRIMEBDT=ON /svn/PrIME/ && make -j 8 && make install

In above command,

(a) /tmp/primebuild is the directory containing the build files. (b) /primeinstall contains the final executables. (c) /svn/PrIME contains the source files. When you download the trunk directory and place it in /home/user abc/ directory then change the appropriate location from /svn/PrIME to /home/user abc.

Possible Errors and their solutions

In addition to libraries discussed above, sometimes you may get errors due to absence of one or more libraries. While I was building PrIME on fresh ubuntu install (after installation of above stated libraries), I got the following missing library errors and corrected them by installing corresponding packages as shown below.

1. Could NOT find PNG The error says (missing:PNG LIBRARY PNG PNG INCLUDE DIR). Solution: Install PNG library using following command. sudo apt-get install libpng12-dev 2. Could NOT find X11 Solution: Install KDE libraries using command: sudo apt-get install kdelibs4-dev (This is sort of huge library - around 130 MB - but this is currently the solution, I have found, to remove X11 error. I know some smaller library may fill the gap but haven’t succeeded in spotting that out yet.

5