## Friday, August 24, 2012

### Getting started with Phaistos // installation

I got an e-mail from a student named Alex at Boston University, asking if I could help him getting started with Phaistos. First barrier for new users (in this case a student), is to download and install Phaistos on a Linux machine.

First, you have to download the latest and greatest revision of Phaistos from sourceforge. This is done via the following command:
svn checkout https://phaistos.svn.sourceforge.net/svnroot/phaistos/trunk phaistos
This creates a directory named "phaistos" and downloads the source code to taht directory. Now enter the "phaistos" directory, create a directory named "build" and then cd into that dir:
cd phaistos
mkdir build
cd build
cmake ..
cmake prepares the compilation step and finds out where your libraries etc. are located. Note that Phaistos requires Boost installed, version 1.41 or newer.

If you have Boost installed in a non-standard location and cmake doesn't find the Boost libraries, things are slightly more complicated. On my laptop (running CentOS 6.3), I cannot get cmake to consistently find my Boost via the "-DBOOST_ROOT" option as mentioned in the Phaistos manual. Usually using these cmake command flags should work. Note that in the example, I have boost installed in "/opt/boost_1_41_0".

cmake -DBoost_DIR=/opt/boost_1_41_0 -DBoost_INCLUDE_DIR=/opt/boost_1_41_0/include

In this case, I explicitly tell cmake where all Boost libraries are located via these two lines (the second line is "a bit" long, make sure you get everything when you copy/paste!):
export BOOST_ROOT_DIR=/opt/boost_1_41_0 #(i.e. where Boost is installed)
cmake -DBoost_INCLUDE_DIR=$BOOST_ROOT_DIR/include -DBoost_LIBRARY_DIRS=$BOOST_ROOT_DIR/lib -DBoost_PROGRAM_OPTIONS_LIBRARY=$BOOST_ROOT_DIR/lib/libboost_program_options.a -DBoost_SERIALIZATION_LIBRARY=$BOOST_ROOT_DIR/lib/libboost_serialization.a -DBoost_THREAD_LIBRARY=$BOOST_ROOT_DIR/lib/libboost_thread.a -DBoost_INCLUDE_DIR_DEBUG=/home/kasper/boost_build/include -DBoost_LIBRARY_DIRS_DEBUG=$BOOST_ROOT_DIR/lib -DBoost_PROGRAM_OPTIONS_LIBRARY_DEBUG=$BOOST_ROOT_DIR/lib/libboost_program_options.a -DBoost_SERIALIZATION_LIBRARY_DEBUG=$BOOST_ROOT_DIR/lib/libboost_serialization.a -DBoost_THREAD_LIBRARY_DEBUG=$BOOST_ROOT_DIR/lib/libboost_thread.a -DBoost_INCLUDE_DIR_RELEASE=/home/kasper/boost_build/include -DBoost_LIBRARY_DIRS_RELEASE=$BOOST_ROOT_DIR/lib -DBoost_PROGRAM_OPTIONS_LIBRARY_RELEASE=$BOOST_ROOT_DIR/lib/libboost_program_options.a -DBoost_SERIALIZATION_LIBRARY_RELEASE=$BOOST_ROOT_DIR/lib/libboost_serialization.a -DBoost_THREAD_LIBRARY_RELEASE=$BOOST_ROOT_DIR/lib/libboost_thread.a -DBoost_THREAD_LIBRARY=$BOOST_ROOT_DIR/lib/libboost_thread.a -DBoost_REGEX_LIBRARY=$BOOST_ROOT_DIR/lib/libboost_regex.a -DBoost_THREAD_LIBRARY_DEBUG=$BOOST_ROOT_DIR/lib/libboost_thread.a -DBoost_REGEX_LIBRARY_DEBUG=$BOOST_ROOT_DIR/lib/libboost_regex.a -DBoost_THREAD_LIBRARY_RELEASE=$BOOST_ROOT_DIR/lib/libboost_thread.a -DBoost_REGEX_LIBRARY_RELEASE=$BOOST_ROOT_DIR/lib/libboost_regex.a -DBoost_UNIT_TEST_FRAMEWORK_LIBRARY=$BOOST_ROOT_DIR/lib/libboost_unit_test_framework.a -DBoost_UNIT_TEST_FRAMEWORK_LIBRARY_DEBUG=$BOOST_ROOT_DIR/lib/libboost_unit_test_framework.a -DBoost_UNIT_TEST_FRAMEWORK_LIBRARY_RELEASE=$BOOST_ROOT_DIR/lib/libboost_unit_test_framework.a -DBoost_FILESYSTEM_LIBRARY=$BOOST_ROOT_DIR/lib/libboost_filesystem.a -DBoost_FILESYSTEM_LIBRARY_DEBUG=$BOOST_ROOT_DIR/lib/libboost_filesystem.a -DBoost_FILESYSTEM_LIBRARY_RELEASE=$BOOST_ROOT_DIR/lib/libboost_filesystem.a -DBoost_SYSTEM_LIBRARY=$BOOST_ROOT_DIR/lib/libboost_system.a -DBoost_SYSTEM_LIBRARY_DEBUG=$BOOST_ROOT_DIR/lib/libboost_system.a -DBoost_SYSTEM_LIBRARY_RELEASE=$BOOST_ROOT_DIR/lib/libboost_system.a ..

Now you are ready to compile:
make -j4
After a while you'll get a message saying:
Linking CXX executable ../../../bin/phaistos
[100%] Built target phaistos
From the build directory, you can test if Phaistos is working by typing
bin/phaistos --help
(A very long list of options should appear).

To compile the manual, cd into the "phaistos/build" dir ands
make manual_pdf
This compiles the manual and puts it in the "phaistos/build/doc" dir. You can also download the latest manual from sourceforge here.

1. Hi. Can you tell me something more detail about how to install the boost library? Thank you.

2. Hi, sure I can ... Which Linux distribution are you using? And also I need to know, if you have root access on your computer.

/Anders

I am using Ubuntu 12.04 with the root access.

4. Hi Min Xu

There is a bug in Boost versions <1.51 and the GCC 4.6 compilers which are standard on Ubuntu 12.04 LTS, so you have to compile and install Boost 1.51 from source. Try the following steps:

wget http://sourceforge.net/projects/boost/files/boost/1.51.0/boost_1_51_0.tar.bz2
tar xjf boost_1_51_0.tar.bz2
cd boost_1_51_0/
./bootstrap.sh
./b2 # Takes a while .. this compiles boost
sudo ./b2 install

Let me know if you have any luck!

5. Thank you. I have installed successfully as you told. But I still got errors like

undefined reference to `boost::system::generic_category()'

when I compile phaistos.

6. Hey

That is definitely a linking error. Can you install "ccmake" by doing:

sudo apt-get install cmake-curses-gui

Then cd into the phaistos/build directory and type:

ccmake ..

This gives you a GUI where you cen see all the libraries which cmake has found. On the first page there are option like:

BIBTEX_COMPILER
BIBTEX_COMPILER_FLAGS
BLAS_LIBRARY
Boost_DIR
Boost_FILESYSTEM_LIBRARY_DEBUG
Boost_FILESYSTEM_LIBRARY_RELEA
Boost_PROGRAM_OPTIONS_LIBRARY_
Boost_PROGRAM_OPTIONS_LIBRARY_
Boost_REGEX_LIBRARY_DEBUG
Boost_REGEX_LIBRARY_RELEASE
Boost_SERIALIZATION_LIBRARY_DE
Boost_SERIALIZATION_LIBRARY_RE
Boost_SYSTEM_LIBRARY_DEBUG
Boost_SYSTEM_LIBRARY_RELEASE
Boost_UNIT_TEST_FRAMEWORK_LIBR
Boost_UNIT_TEST_FRAMEWORK_LIBR

Can you see if the correct libraries have been found?

7. Boost_DIR:Boost_DIR-NOTFOUND. How to fix this? I have tried /usr/local/lib but it doesn't work.

8. Boost_DIR:Boost_DIR-NOTFOUND is okay, if all the Boost libraries below that line are found (except debug libraries which are not necessary).

Maybe you have another version of Boost installed from Ubuntu? What happens if you do:

sudo apt-get remove libboost-*

//Anders

9. I have removed the other version like you said but the error is still the same.