| 1 | /* | 
|---|
| 2 | * Project: MoleCuilder | 
|---|
| 3 | * Description: creates and alters molecular systems | 
|---|
| 4 | * Copyright (C)  2010 University of Bonn. All rights reserved. | 
|---|
| 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | /** | 
|---|
| 9 | * \file install.dox | 
|---|
| 10 | * | 
|---|
| 11 | * Created on: Oct 28, 2011 | 
|---|
| 12 | *    Author: heber | 
|---|
| 13 | */ | 
|---|
| 14 |  | 
|---|
| 15 | /** | 
|---|
| 16 | *  \page install Installation | 
|---|
| 17 | * | 
|---|
| 18 | * \section install-prerequisites Prerequisites | 
|---|
| 19 | * | 
|---|
| 20 | * Several packages are required or advised for compilation of the code. | 
|---|
| 21 | * The code has been developed under ubuntu 10.04 and 12.04, so in the | 
|---|
| 22 | * following we concentrate on these systems. | 
|---|
| 23 | * | 
|---|
| 24 | * A specific section will be added when (cross-)compilation for Windows | 
|---|
| 25 | * has succeeded. Note that compiling without Qt under GNU/Cygwin is | 
|---|
| 26 | * relatively straight-forward along the lines of the required packages | 
|---|
| 27 | * for Ubuntu. | 
|---|
| 28 | * | 
|---|
| 29 | * \subsection install-prerequisites-ubuntu ... for Ubuntu | 
|---|
| 30 | * | 
|---|
| 31 | *  Under Ubuntu 12.04 the following packages are required: | 
|---|
| 32 | *  -# C++ compiler: e.g. g++ | 
|---|
| 33 | *  -# LAPACK: liblapack-dev | 
|---|
| 34 | *  -# GSL: libgsl0-dev | 
|---|
| 35 | *  -# BLAS: e.g. libopenblas-dev or libatlas-base-dev | 
|---|
| 36 | *  -# Many Boost Libraries: libboost1.48-all-dev | 
|---|
| 37 | *  -# gawk: gawk | 
|---|
| 38 | *  -# pkg-config: pkg-config | 
|---|
| 39 | *  -# CodePatterns: see below for instructions | 
|---|
| 40 | * | 
|---|
| 41 | *  The following packages are optional. Note however that certain features | 
|---|
| 42 | *  are not available when these packages are missing: | 
|---|
| 43 | *  -# MoleCuilder scripting and start scripts | 
|---|
| 44 | *    -# Python:  python, python-dev | 
|---|
| 45 | *  -# Documentation generated from source code: | 
|---|
| 46 | *    -# doxygen: doxygen | 
|---|
| 47 | *    -# GraphViz: dot | 
|---|
| 48 | *  -# Unit tests | 
|---|
| 49 | *    -# CppUnit: libcppunit-dev | 
|---|
| 50 | *  -# Graphical User Interface | 
|---|
| 51 | *    -# Qt: qt4-dev-tools libqt4-core qt4-qmake | 
|---|
| 52 | *    -# Qt3D: see below for instructions | 
|---|
| 53 | *  -# BOSSANOVA scheme | 
|---|
| 54 | *    -# JobMarket: see below for instructions | 
|---|
| 55 | *    -# MPQC: see below for instructions | 
|---|
| 56 | *    -# ScaFaCoS: see below for instructions | 
|---|
| 57 | * | 
|---|
| 58 | *  If you are programming with or for MoleCuilder, the following packages are | 
|---|
| 59 | *  advised to use: | 
|---|
| 60 | *  -# ccache: ccache | 
|---|
| 61 | *  -# git: git | 
|---|
| 62 | *  -# autotools: autoconf automake autoheader autoconf libtool | 
|---|
| 63 | * | 
|---|
| 64 | * \subsection install-prerequisites-other Other packages | 
|---|
| 65 | * | 
|---|
| 66 | *  Here, we want to give some advice on how we managed to compile packages that | 
|---|
| 67 | *  don't come as a Debian/Ubuntu package: | 
|---|
| 68 | * | 
|---|
| 69 | *  \subsubsection install-prerequisites-other-codepatterns CodePatterns | 
|---|
| 70 | * | 
|---|
| 71 | *   CodePatterns are some general object oriented patterns implemented in C++ | 
|---|
| 72 | *   which are a sort of novice attempt to what some of the boost libraries can | 
|---|
| 73 | *   do. E.g. a thread-safe singleton pattern. | 
|---|
| 74 | * | 
|---|
| 75 | *   Refer to the project's webpage for further instructions. | 
|---|
| 76 | * | 
|---|
| 77 | *  \subsubsection install-prerequisites-other-qt3d Qt3D | 
|---|
| 78 | * | 
|---|
| 79 | *   The graphical user interface heavily relies on Qt3D to display atoms and | 
|---|
| 80 | *   their bonds and to allow for selections. As the GUI has been developed with | 
|---|
| 81 | *   Qt4.8 where Qt3D is not yet implemented - this has been done with Qt5 -- | 
|---|
| 82 | *   Qt3D has to be compiled and installed manually. Required for compilation | 
|---|
| 83 | *   are the complete dev-tools of Qt4. Then, obtain the code from the repository | 
|---|
| 84 | *   as described here: http://doc-snapshot.qt-project.org/qt3d-1.0/qt3d-building.html | 
|---|
| 85 | *   Make sure that the branch \b qt4 is checked out. | 
|---|
| 86 | *   Afterwards, create the Makefiles (check that qt4's qmake is used!), compile, and | 
|---|
| 87 | *   install via | 
|---|
| 88 | *   \code | 
|---|
| 89 | *   qmake-qt4 quick3d.pro | 
|---|
| 90 | *   sudo make | 
|---|
| 91 | *   sudo make install | 
|---|
| 92 | *   \endcode | 
|---|
| 93 | *   Note that I had to manually create \b /usr/include/qt4/Qt3D to pass | 
|---|
| 94 | *   compilation and installation with error. | 
|---|
| 95 | * | 
|---|
| 96 | *   Furthermore, we require a Qt3D pkg-config file, which is sadly not created. | 
|---|
| 97 | *   This can be easily created by copying e.g. QtOpenGl.pc and search&replacing | 
|---|
| 98 | *   OpenGl to Qt3D (check for double QtQt appearances). | 
|---|
| 99 | * | 
|---|
| 100 | *  \subsubsection install-prerequisites-other-jobmarket JobMarket | 
|---|
| 101 | * | 
|---|
| 102 | *   JobMarket is a package for allowing a server to give wrapped-up jobs to | 
|---|
| 103 | *   clients which work on the given job and return some wrapped-up results. | 
|---|
| 104 | *   This has been implemented with boost::asio. | 
|---|
| 105 | * | 
|---|
| 106 | *   The package is private property of Frederik Heber. Contact the author for | 
|---|
| 107 | *   further information on how to obtain the code and installation instructions. | 
|---|
| 108 | * | 
|---|
| 109 | *  \subsubsection install-prerequisites-other-scafacos ScaFaCoS | 
|---|
| 110 | * | 
|---|
| 111 | *  ScaFaCoS is a library of fast Coulomb solvers, created by the same-named BMBF | 
|---|
| 112 | *  funded project. The library contains Versatile MultiGrid (vmg) as one of its | 
|---|
| 113 | *  solvers which is used in the BOSSANOVA scheme for the calculation of | 
|---|
| 114 | *  long-range forces. | 
|---|
| 115 | * | 
|---|
| 116 | *  ScaFaCoS requires the following packages to compile: | 
|---|
| 117 | *  -# MPI: mpi-default-dev libopenmpi-dev | 
|---|
| 118 | *  -# F2C: libf2c2-dev | 
|---|
| 119 | *  -# Fortran compiler: gfortan | 
|---|
| 120 | *  Compilation additionally required use of | 
|---|
| 121 | *  \code CPPFLAGS="-fPIC" \endcode | 
|---|
| 122 | *  to generate position-independent code. This is because ScaFaCoS so far does | 
|---|
| 123 | *  not use libtool which would otherwise take care of this and created shared | 
|---|
| 124 | *  libraries. Note that VMG is the only required solver, others are not used, e.g. | 
|---|
| 125 | *  for a debug compile you might want to use: | 
|---|
| 126 | *  \code | 
|---|
| 127 | *  ../configure -C --prefix=<path> --enable-shared BSPLINE_DEG=3 MPICC=mpicc.openmpi | 
|---|
| 128 | *  MPICXX=mpicxx.openmpi MPIEXEC=mpirun.openmpi CPPFLAGS="-Wall -g3 -O0 -ggdb -fPIC" | 
|---|
| 129 | *  --enable-mpi --with-boost-libdir=/usr/lib --with-boost=/usr --enable-fcs-solvers=vmg | 
|---|
| 130 | *  \endcode | 
|---|
| 131 | * | 
|---|
| 132 | *  \subsubsection install-prerequisites-other-mpqc MPQC | 
|---|
| 133 | * | 
|---|
| 134 | *  Massively Parallel Quantum Chemistry (http://www.mpqc.org/) is a Hartree-Fock | 
|---|
| 135 | *  solver with emphasis on concurrency. We, however, require only the solver part. | 
|---|
| 136 | *  The code base has been adapted a bit to allow use within JobMarket. | 
|---|
| 137 | *  Also, it uses the ScaFaCoS package to calculate long-range forces. | 
|---|
| 138 | * | 
|---|
| 139 | * \section install-compiling Compiling the Code | 
|---|
| 140 | * | 
|---|
| 141 | * After you obtained the code, you do the following: | 
|---|
| 142 | * | 
|---|
| 143 | * \code | 
|---|
| 144 | * ./bootstrap | 
|---|
| 145 | * \endcode | 
|---|
| 146 | * | 
|---|
| 147 | * This creates the necessary autoconf and automake files. | 
|---|
| 148 | * | 
|---|
| 149 | * After this, | 
|---|
| 150 | * | 
|---|
| 151 | * \code | 
|---|
| 152 | * mkdir build | 
|---|
| 153 | * cd build | 
|---|
| 154 | * ../configure --prefix=`pwd` | 
|---|
| 155 | * \endcode | 
|---|
| 156 | * | 
|---|
| 157 | * which will run the configure script that checks whether you meet all the | 
|---|
| 158 | * requirements. Note that you may supply system-specific paths as follows: | 
|---|
| 159 | * -# GNU Scientific Library (specify via LDFLAGS, ...) | 
|---|
| 160 | * -# Qt4 framework (--with-Qt=<dir> or --with-Qt-include-dir, --with-Qt-bin-dir, | 
|---|
| 161 | *  --with-Qt-lib-dir and --with-Qt-lib) | 
|---|
| 162 | * -# Boost library 1.40 or newer with program_options and threads (--with-boost=<dir>, | 
|---|
| 163 | * --with-boost-lib=<path>) | 
|---|
| 164 | * -# CPPUnit framework (--with-cppunit-prefix=<dir>) | 
|---|
| 165 | * -# CodePatterns (--with-codepatterns=<dir>) | 
|---|
| 166 | * | 
|---|
| 167 | * The following packages are optional (code parts/features are disabled if not | 
|---|
| 168 | * found): | 
|---|
| 169 | * -# JobMarket (--enable-jobmarket --with-jobmarket=<dir> | 
|---|
| 170 | * -# VMG library of ScaFaCoS (--enable-vmg --with-vmg-mpi MPICXX=mpicxx PKGCONFIG=<path to ScaFaCoS pkdir>) | 
|---|
| 171 | * -# levmar (--with-levmar=<dir>) | 
|---|
| 172 | * | 
|---|
| 173 | * \a --prefix is the argument to tell configure where all program code should go | 
|---|
| 174 | * to (pwd is the unix command for the current working directory). There are | 
|---|
| 175 | * others, see | 
|---|
| 176 | * | 
|---|
| 177 | * \code | 
|---|
| 178 | * ../configure --help | 
|---|
| 179 | * \endcode | 
|---|
| 180 | * | 
|---|
| 181 | * and some enable/disable switches you should check out: | 
|---|
| 182 | * | 
|---|
| 183 | * - \a --enable-ecut - says that the TestRunner, comprising all unit tests in one | 
|---|
| 184 | *  exectuable, shall make use of the Eclipse CppUnitTest (ECUT). If this is | 
|---|
| 185 | *  started within eclipse with this plugin installed, a shiny interface will tell | 
|---|
| 186 | *  you what failed and what not. | 
|---|
| 187 | * - \a --enable-debug - activates many internal asserts, memory debugger and more | 
|---|
| 188 | *  (makes code a lot slower but gives information in case something fails) | 
|---|
| 189 | * - \a --enable-python - activates python scripting. For one you can control | 
|---|
| 190 | *  molecuilder within your python code by simply calling its actions. For another | 
|---|
| 191 | *  it automatically executes a script \b molecuilder.py in the current folder | 
|---|
| 192 | *  prior to launching the respective UI. | 
|---|
| 193 | *  - \a --disable-cache - disables caching of certain variables (see CodePatterns). | 
|---|
| 194 | *  - \a --enable-valgrind - each test of the testsuite is launched by wrapping | 
|---|
| 195 | *  the call through valgrind checking on correct handling of memory. | 
|---|
| 196 | * | 
|---|
| 197 | * | 
|---|
| 198 | * \note A note about configure: If one library is found only under some specific path, you | 
|---|
| 199 | * can add CFLAGS, CPPFLAGS, LDFLAGS, ... to the configure call, like this | 
|---|
| 200 | * \code | 
|---|
| 201 | * ../configure --prefix=`pwd` --enable-hydrogen CFLAGS="-Wall -g3" CXXFLAGS="-Wall -g3" | 
|---|
| 202 | * \endcode | 
|---|
| 203 | * which enables all compiler warnings and full debugging of the code without any | 
|---|
| 204 | * optimization. configure saves these variables, too, such that when it is called | 
|---|
| 205 | * to re-configure it will still make use of them from its cache file. | 
|---|
| 206 | * | 
|---|
| 207 | * There are several flags that change the way molecuilder is compiled and probably | 
|---|
| 208 | * make it run faster, more unsafe, ... | 
|---|
| 209 | * -# \a -DLOG_OBSERVER,  What the Observers do is logged, the log is printed on exit | 
|---|
| 210 | * -# \a -DNO_MEMDEBUG,   MemDebug (memory debugger) is disabled | 
|---|
| 211 | * -# \a -DNO_CACHING,  Cachable are short-wired, i.e. always recalculate, this slows | 
|---|
| 212 | *  down the code a lot | 
|---|
| 213 | * -# \a -DNDEBUG,  include NO_MEMDEBUG, also ASSERTs are not checked, this speeds up | 
|---|
| 214 | *  the code by a factor of 5 | 
|---|
| 215 | * | 
|---|
| 216 | * \subsection install-difficulties  Difficulties | 
|---|
| 217 | * | 
|---|
| 218 | *  You might encounter some problems along the way, which we list up here: | 
|---|
| 219 | *  -# Switching from Lucid Lynx to Precise Pangolin, libtool has been patched to | 
|---|
| 220 | *  \b link_all_deplibs=no which causes linking to fail. A temporary way around it | 
|---|
| 221 | *  is to seek&replace all instances in your build directory (replace no with | 
|---|
| 222 | *  unknown). The more general way is to replace packaged and patched libtool | 
|---|
| 223 | *  with an unpatched version you have to compile yourself. | 
|---|
| 224 | * | 
|---|
| 225 | * \section install-install Installing | 
|---|
| 226 | * | 
|---|
| 227 | * Now, we are ready to compile and install. | 
|---|
| 228 | * | 
|---|
| 229 | * \code | 
|---|
| 230 | * make | 
|---|
| 231 | * make install | 
|---|
| 232 | * \endcode | 
|---|
| 233 | * | 
|---|
| 234 | * \attention If you have a multi-core system, it is highly recommended to use the | 
|---|
| 235 | * \a -j option of make to allow for multiple threads to work on compiling or | 
|---|
| 236 | * checking the codfe simultaneously. | 
|---|
| 237 | * | 
|---|
| 238 | * And if everything went well, you should launch the unit tests and the testsuite | 
|---|
| 239 | * by (see section \ref tests on how to launch the tests individually) | 
|---|
| 240 | * | 
|---|
| 241 | * \code | 
|---|
| 242 | * make check | 
|---|
| 243 | * \endcode | 
|---|
| 244 | * | 
|---|
| 245 | * If everything is OK, you have a working version of MoleCuilder in form of the | 
|---|
| 246 | * executables \b bin/molecuilder and \b bin/molecuildergui. | 
|---|
| 247 | * | 
|---|
| 248 | * If you have to delete all compiled stuff, enter | 
|---|
| 249 | * | 
|---|
| 250 | * \code | 
|---|
| 251 | * make clean | 
|---|
| 252 | * \endcode | 
|---|
| 253 | * | 
|---|
| 254 | * or | 
|---|
| 255 | * | 
|---|
| 256 | * \code | 
|---|
| 257 | * make distclean | 
|---|
| 258 | * \endcode | 
|---|
| 259 | * | 
|---|
| 260 | * which will also delete all autoconf stuff for configure. | 
|---|
| 261 | * | 
|---|
| 262 | * distclean is at times necessary when stuff does not compile and there's | 
|---|
| 263 | * seemingly no logic behind it, i.e. especially when paths of modules have | 
|---|
| 264 | * changed. To recover your configure options, either look at \b config.log in | 
|---|
| 265 | * the build directory or enter | 
|---|
| 266 | * | 
|---|
| 267 | * \code | 
|---|
| 268 | * ./config.status --version | 
|---|
| 269 | * \endcode | 
|---|
| 270 | * | 
|---|
| 271 | *  Further useful commands are | 
|---|
| 272 | *  -# make clean uninstall: deletes .o-files and removes executable from the given | 
|---|
| 273 | *    binary directory | 
|---|
| 274 | *  -# make doc: Creates these html pages out of the documented source | 
|---|
| 275 | *  -# make distcheck: Checks whether the code compiles and all tests runs without | 
|---|
| 276 | *  from a distributed archive. This is checked for each release version. | 
|---|
| 277 | * | 
|---|
| 278 | * \date 2012-12-20 | 
|---|
| 279 | */ | 
|---|