Difference between revisions of "Installation"

From Bio++ Wiki
Jump to: navigation, search
(Development version (final) + minor changes)
Line 36: Line 36:
  
 
Compiling from source is necessary when superuser rights are not available or to install Bio++ to a non-standard location (useful when several Bio++ versions coexist on a system).
 
Compiling from source is necessary when superuser rights are not available or to install Bio++ to a non-standard location (useful when several Bio++ versions coexist on a system).
 
Remark: [http://wikipedia.org/wiki/CMake CMake] is needed to compile the sources (<tt>cmake</tt> package in Ubuntu/Debian repositories).
 
  
 
===== Compiling from source : the automatic way =====
 
===== Compiling from source : the automatic way =====
  
The easiest way to compile from source is to download the [http://biopp.univ-montp2.fr/Download/bpp-setup.sh|Bio++ 2.0 automatic installer], edit the script header to match your system, and run it.
+
The easiest way to compile from source is to download the [http://biopp.univ-montp2.fr/Download/bpp-setup.sh Bio++ 2.0 automatic installer], edit the script header to match your system, and run it.
  
For instance, to download the sources in <tt>$HOME/local/bpp2.0</tt> and install the libraries in <tt>$HOME/local/lib</tt> and <tt>$HOME/local/include</tt>, one would enter :
+
For instance, to download the sources in <tt>$HOME/local/bpp/2.0</tt> and install the libraries in <tt>$HOME/local/bpp/2.0/lib</tt> and <tt>$HOME/local/bpp/2.0/include</tt>, one would enter :
 
<source lang="bash">
 
<source lang="bash">
mkdir $HOME/local $HOME/local/bpp2.0
+
bpp_dir=$HOME/local/bpp/2.0
cd $HOME/local/bpp2.0
+
mkdir -p $bpp_dir/sources
 +
cd $bpp_dir/sources
 
wget http://biopp.univ-montp2.fr/Download/bpp-setup.sh
 
wget http://biopp.univ-montp2.fr/Download/bpp-setup.sh
 
chmod +x bpp-setup.sh
 
chmod +x bpp-setup.sh
gedit bpp-setup.sh # set PATH_INSTALL to $HOME/local/, on line 16
+
gedit bpp-setup.sh # set PATH_INSTALL to $bpp_dir, on line 16
 
./bpp-setup.sh
 
./bpp-setup.sh
 
</source>
 
</source>
Line 59: Line 58:
 
== Development version ==
 
== Development version ==
  
Remark: [http://wikipedia.org/wiki/git git] and [http://wikipedia.org/wiki/CMake CMake] are needed to download and compile the source files (<tt>git</tt> and <tt>cmake</tt> package in Ubuntu/Debian repositories).
+
[http://wikipedia.org/wiki/git git] and [http://wikipedia.org/wiki/CMake CMake] are needed to retrieve and compile the source files. They can be installed through the <tt>git</tt> and <tt>cmake</tt> packages in Ubuntu/Debian repositories, and should be present on most servers. You can check whether they are installed on your system simply by typing :
 
+
<source lang="bash">
Remark: Installing Bio++ in a custom location greatly helps in compiling and running programs depending on different Bio++ versions. This section demonstrates how to download the sources in <tt>$HOME/local/bpp/dev/sources</tt> and install the libraries in <tt>$HOME/local/bpp/dev/lib</tt> and <tt>$HOME/local/bpp/dev/include</tt>. For more information on how to compile/run Bio++ dependent programs, see the [[:Category:Usage|Usage]] pages.
+
git
 +
cmake
 +
</source>
  
  
Line 90: Line 91:
 
<source lang="bash">
 
<source lang="bash">
 
cd bpp-core
 
cd bpp-core
cmake -D CMAKE_INSTALL_PREFIX=$bpp_dir -D CMAKE_LIBRARY_PATH=$bpp_dir/lib -D CMAKE_INCLUDE_PATH=$bpp_dir/include . # prepare compilation
+
cmake -D CMAKE_INSTALL_PREFIX=$bpp_dir -D CMAKE_LIBRARY_PATH=$bpp_dir/lib -D CMAKE_INCLUDE_PATH=$bpp_dir/include ./ # prepare compilation
 
make # compile
 
make # compile
 
make install # move files to the installation directory
 
make install # move files to the installation directory
Line 97: Line 98:
 
That's it !
 
That's it !
  
Explanation : Variables can be given to CMake using the <tt>-D</tt> option. The install directory is specified by the CMake <tt>CMAKE_INSTALL_PREFIX</tt> variable. Because the install directories are non-standard (eg. not <tt>/usr/local/lib</tt>), the CMake <tt>CMAKE_LIBRARY_PATH</tt> and <tt>CMAKE_INCLUDE_PATH</tt> variables must also be provided (this is dispensable for <tt>bpp-core</tt> since it does not depend on the other components).
+
Explanation : CMake can be given internal variables using the <tt>-D</tt> option. The install directory is specified by the CMake <tt>CMAKE_INSTALL_PREFIX</tt> variable. Because the install directories are non-standard (eg. not <tt>/usr/local/lib</tt>), the CMake <tt>CMAKE_LIBRARY_PATH</tt> and <tt>CMAKE_INCLUDE_PATH</tt> variables must also be provided (this is actually dispensable for <tt>bpp-core</tt> since it does not depend on the other components).
 +
 
 +
 
 +
Remark: If Bio++ libraries are already present on your system, CMake will issue a warning because this interferes with the compilation of the testing executables (but not with that of the libraries). Remove the <tt>CMakeCache.txt</tt> file and specify <tt>-D BUILD_TESTING=FALSE</tt> to tell CMake to skip the compilation of those executables.
 +
 
 +
Remark: Installing Bio++ in a custom location greatly helps in compiling and running programs depending on different Bio++ versions. This section demonstrates how to download the sources in <tt>$HOME/local/bpp/dev/sources</tt> and install the libraries in <tt>$HOME/local/bpp/dev/lib</tt> and <tt>$HOME/local/bpp/dev/include</tt>. For more information on how to compile/run Bio++ dependent programs, see the [[:Category:Usage|Usage]] pages.
 +
 
 +
===== Staying up-to-date =====
 +
 
 +
To update the libraries the basic procedure is :
 +
<source lang="bash">
 +
cd bpp-core
 +
git pull # retrieve changes
 +
cmake ./ # update files list
 +
make
 +
make install
 +
</source>
 +
 
  
Remark: If Bio++ libraries are already present on your system, CMake will issue a warning because this interferes with the compilation of the testing executables (but not with that of the libraries). Remove the <tt>CMakeCache.txt</tt> file and specify <tt>-D BUILD_TESTING=FALSE</tt> on the <tt>cmake</tt> command to tell CMake to skip the compilation of those executables.
+
Alternatively, the following script can be used :
 +
<source lang="bash">
 +
#!/bin/bash
 +
 
 +
cd $HOME/local/bpp/dev/sources
 +
for d in bpp-core bpp-seq bpp-phyl bpp-popgen bpp-raa bpp-qt; do
 +
  if [[ ! -e $d ]]; then
 +
    echo -e "Skip $d (does not exist).\n"
 +
    continue
 +
  fi
 +
 
 +
  echo "Updating $d..."
 +
  cd $d/
 +
  git pull
 +
  cmake .
 +
  if make; then
 +
    echo "Installing..."
 +
    make install >/dev/null
 +
  else
 +
    echo "Compilation error in '$d/'. Abort"
 +
    cd ..
 +
    break
 +
  fi
 +
  cd ..
 +
done
 +
</source>
  
 
== Older versions ==
 
== Older versions ==
  
 
See [[Bio++ Versions]].
 
See [[Bio++ Versions]].

Revision as of 14:20, 1 July 2012

How to install Bio++. See also Installation (old page).

Lastest version : Bio++ 2.0

Ubuntu/Debian packages

Bio++ 2.0 packages (libbpp-core, libbpp-seq, etc.) are available in the Ubuntu and Debian standard repositories. They can be installed using your usual package/program manager.

Warning: as of June 30, 2012, there is an issue with the Ubuntu popgen package. If you want to use this part of the library, please use the package from the custom repository instead, or compile from source, or switch to the development version.

Ubuntu/Debian packages (custom repository)

A local repository is available for architectures i386 and amd64, containing additional programs built against the libraries.

Use your favorite apt manager to add the following line to your sources.list :

deb http://biopp.univ-montp2.fr/repos/apt/debian Squeeze main

You will also need to add the key that was used to sign the packages : <source lang="bash"> wget http://biopp.univ-montp2.fr/repos/apt/conf/biopp.gpg.key sudo apt-key add biopp.gpg.key </source>

Reload the packages list and then look for "Bio++" packages. That's all!

RPM packages

RPM packages are available at http://download.opensuse.org/repositories/home:/jdutheil:/Bio++/.

MacOS X

DMG packages are available at http://biopp.univ-montp2.fr/repos/dmg/ (compiled with a MacIntel computer).

Compiling from source

Compiling from source is necessary when superuser rights are not available or to install Bio++ to a non-standard location (useful when several Bio++ versions coexist on a system).

Compiling from source : the automatic way

The easiest way to compile from source is to download the Bio++ 2.0 automatic installer, edit the script header to match your system, and run it.

For instance, to download the sources in $HOME/local/bpp/2.0 and install the libraries in $HOME/local/bpp/2.0/lib and $HOME/local/bpp/2.0/include, one would enter : <source lang="bash"> bpp_dir=$HOME/local/bpp/2.0 mkdir -p $bpp_dir/sources cd $bpp_dir/sources wget http://biopp.univ-montp2.fr/Download/bpp-setup.sh chmod +x bpp-setup.sh gedit bpp-setup.sh # set PATH_INSTALL to $bpp_dir, on line 16 ./bpp-setup.sh </source>

Compiling from source : the manual way

Download the source archives individually (see Bio++ Versions). The compilation procedure is then the same as for compiling the development version.

Development version

git and CMake are needed to retrieve and compile the source files. They can be installed through the git and cmake packages in Ubuntu/Debian repositories, and should be present on most servers. You can check whether they are installed on your system simply by typing : <source lang="bash"> git cmake </source>


We start by creating the directory : <source lang="bash"> bpp_dir=$HOME/local/bpp/dev/ mkdir -p $bpp_dir/sources </source>

Getting the source files

This is done with git.

You need to download only the components of the library that you want to use. The bpp-core and bpp-seq components are required by all others, which are otherwise independent. (Example is given for bpp-popgen.)

<source lang="bash"> cd $bpp_dir/sources git clone http://biopp.univ-montp2.fr/git/bpp-core git clone http://biopp.univ-montp2.fr/git/bpp-seq git clone http://biopp.univ-montp2.fr/git/bpp-popgen </source>

At this point the sources directory should contain four subdirectories.

Compiling and installing

All desired components must be compiled and installed successively, starting with bpp-core and bpp-seq. Repeat the following steps (example given for bpp-core) : <source lang="bash"> cd bpp-core cmake -D CMAKE_INSTALL_PREFIX=$bpp_dir -D CMAKE_LIBRARY_PATH=$bpp_dir/lib -D CMAKE_INCLUDE_PATH=$bpp_dir/include ./ # prepare compilation make # compile make install # move files to the installation directory </source>

That's it !

Explanation : CMake can be given internal variables using the -D option. The install directory is specified by the CMake CMAKE_INSTALL_PREFIX variable. Because the install directories are non-standard (eg. not /usr/local/lib), the CMake CMAKE_LIBRARY_PATH and CMAKE_INCLUDE_PATH variables must also be provided (this is actually dispensable for bpp-core since it does not depend on the other components).


Remark: If Bio++ libraries are already present on your system, CMake will issue a warning because this interferes with the compilation of the testing executables (but not with that of the libraries). Remove the CMakeCache.txt file and specify -D BUILD_TESTING=FALSE to tell CMake to skip the compilation of those executables.

Remark: Installing Bio++ in a custom location greatly helps in compiling and running programs depending on different Bio++ versions. This section demonstrates how to download the sources in $HOME/local/bpp/dev/sources and install the libraries in $HOME/local/bpp/dev/lib and $HOME/local/bpp/dev/include. For more information on how to compile/run Bio++ dependent programs, see the Usage pages.

Staying up-to-date

To update the libraries the basic procedure is : <source lang="bash"> cd bpp-core git pull # retrieve changes cmake ./ # update files list make make install </source>


Alternatively, the following script can be used : <source lang="bash">

  1. !/bin/bash

cd $HOME/local/bpp/dev/sources for d in bpp-core bpp-seq bpp-phyl bpp-popgen bpp-raa bpp-qt; do

 if  ! -e $d ; then
   echo -e "Skip $d (does not exist).\n"
   continue
 fi
 
 echo "Updating $d..."
 cd $d/
 git pull
 cmake .
 if make; then
   echo "Installing..."
   make install >/dev/null
 else
   echo "Compilation error in '$d/'. Abort"
   cd ..
   break
 fi
 cd ..

done </source>

Older versions

See Bio++ Versions.