		Installing Qpid/C++
		===================

Table of Contents
=================
1. Introduction
2. How to Build and Install Qpid from a Source Distribution
3. Building a Repository Working Copy
4. Tests

5. Prerequisites
   5.1. What Prerequisite Libraries to Install
   5.2. How to Install Prerequisite Libraries
      5.2.1. Using Package Management Tools
      5.2.2. Building Prerequisites From Source
   5.3. Important Environment Variable Settings


1. Introduction
===============
This document describes how to build the Qpid/C++ broker and client, either
from a checkout of the source or from a source distribution, on Linux/UNIX.

Please see INSTALL-WINDOWS for information on building on Windows.

There are a number of prerequisite libraries that may need to be installed.
If this is the first time that you have built Qpid please check the prerequisites
section 5. below and/or check the output from running cmake for any errors.

As of Qpid 0.22 cmake is the preferred way to build Qpid.

*******************************************************************
*      N.B. The automake build method is NOW DEPRECATED!!         *
*   IT WILL BE DISABLED BY DEFAULT IN 0.24 AND REMOVED IN 0.26    *
*    Please flag any cmake issues with: users@qpid.apache.org     *
*******************************************************************


2. How to Build and Install Qpid from a Source Distribution
===========================================================
In the cpp distribution directory (<qpid>/cpp), build the code with:

 # mkdir bld       # This is just a suggested name for the build directory
 # cd bld
 # cmake ..        # ".." is the path to the distribution directory

 # make all

To run the tests:

 # make test

To install (you may need to be root/sudo to do this):

 # make install

To uninstall (you may need to be root/sudo to do this):

 # make uninstall


The daemon and client API may be built separately if so desired:

 # make qpidbroker

 # make qpidclient

The available make targets can be listed using:

 # make help


You can have multiple builds in the same working copy with different
configuration. For example you can do the following to build twice, once for
debug, the other with optimization:

 # mkdir BLD-dbg BLD-opt
 # (cd BLD-dbg; cmake -DCMAKE_BUILD_TYPE=Debug .. && make )
 # (cd BLD-opt; cmake -DCMAKE_BUILD_TYPE=Release .. && make)

Note that there are 4 different predefined cmake build types:
Debug, Release, MinSizeRel, DebWithRelInfo: They each correspond to a different
set of build flags for respectively debug; release; minimum size release; release
with debug information.

To see and edit all the available cmake options:

 # cmake-gui ..    # ".." is the path to the distribution directory


3. Building a Repository Working Copy
=====================================
To get the source code from the subversion repository (trunk) do:

 # svn checkout http://svn.apache.org/repos/asf/qpid/trunk/qpid/.

To build, cd to <qpid>/cpp subdirectory and then follow the instructions for building
from a Source Distribution in step (2).


4. Tests
========
See <qpid>/cpp/src/tests/README.txt for details.


======================================================================================


5. Prerequisites
================
We prefer to avoid spending time accommodating older versions of these
packages, so please make sure that you have the latest stable versions.
Known version numbers for a succesful build are given in brackets, take
these as a recommended minimum version.


5.1. What Prerequisite Libraries to Install
===========================================
The following libraries and header files must be installed to build
a source distribution:
 * boost      <http://www.boost.org>                    (1.35)(*)
 * libuuid    <http://kernel.org/~kzak/util-linux/>     (2.19)
 * pkgconfig  <http://pkgconfig.freedesktop.org/wiki/>  (0.21)

(*) earlier versions of boost e.g. 1.33 also work and there is a patch
to get 1.32 working in the svn tree though that is only recommended as
a last resort.

Optional support for AMQP 1.0 requires (see AMQP_1.0 for details):
* Qpid proton-c <http://qpid.apache.org/proton>         (0.5)
Note: pkg-config is used to locate this, so set PKG_CONFIG_PATH if you
are using a non-standard location

Optional XML exchange requires:
 * xqilla  <http://xqilla.sourceforge.net/HomePage>     (2.0.0)
 * xerces-c <http://xerces.apache.org/xerces-c/>        (2.7.0)

Optional SSL support requires:
* nss <http://www.mozilla.org/projects/security/pki/nss/>
* nspr <http://www.mozilla.org/projects/nspr/>

Optional binding support for ruby requires:
* ruby and ruby devel <http://www.ruby-lang.org/en/>
* swig <http://www.swig.org/>

Qpid has been built using the GNU C++ compiler:
 * gcc     <http://gcc.gnu.org/>            		    (3.4.6)

If you want to build directly from the SVN repository you will need
all of the above plus:

 * Cmake      <http://www.cmake.org/>                   (2.6.4)
 * GNU make   <http://www.gnu.org/software/make/>      	(3.8.0)
 * help2man   <http://www.gnu.org/software/help2man/>  	(1.36.4)
 * doxygen    <ftp://ftp.stack.nl/pub/users/dimitri/>  	(1.5.1)
 * graphviz   <http://www.graphviz.org/>               	(2.12)
 * ruby 1.8   <http://www.ruby-lang.org>               	(1.8.4)
 * python 2.x <http://www.python.org>                   (2.4.3)

NOTE: make sure to install the related '-devel' packages also!!!!

NOTE: Python 3.x is known to NOT work - please use 2.7 or earlier.

To build the QMF (Qpid Management Framework) bindings for Ruby and Python,
the following must also be installed:

 * ruby-devel
 * python-devel
 * swig       <http://www.swig.org>                     (1.3.35)

UUID problems:

In some earlier Linux releases (such as Fedora 11), the uuid/uuid.h
file is located in the e2fsprogs-devel package instead of
libuuid-devel. If you are using an older Linux release and run into a
problem during configure in which uuid.h cannot be found, install the
e2fsprogs-devel package.

5.2. How to Install Prerequisite Libraries
==========================================

5.2.1. Using Package Management Tools
=====================================
On linux most packages can be installed using your distribution's
package management tool. For example on Fedora:

 # yum install cmake boost-devel libuuid-devel pkgconfig gcc-c++ make ruby help2man doxygen graphviz

For SASL and SSL, include
 # yum install cyrus-sasl-devel nss-devel nspr-devel

For the XML Exchange, include:

 # yum install xqilla-devel xerces-c-devel

Optional ruby binding support include:
 # yum install ruby ruby-devel swig

Optional legacystore store module.
# yum install libdb-cxx-devel libaio-devel

Follow the manual installation instruction below for any packages not
available through your distributions packaging tool.

5.2.2. Building Prerequisites From Source
=========================================
Required dependencies can be installed and built from source distributions.
It is recommended that you create a directory to install them to, for example,
~/qpid-tools.

 To build and install the dependency packages:

 1. Unzip and untar them and cd to the untared directory.
 2. do:
  # ./configure --prefix=~/qpid-tools
  # make install

The exception is boost.

boost
=====
 1. Unpack boost-jam.
 2. Add bjam in the unpacked directory to your path.
 3. Unpack boost and cd to the boost untarred directory.
 4. do:

  # bjam toolset=gcc variant=release threading=single link=shared \
    --layout=system --prefix=~/qpid-tools install


5.3. Important Environment Variable Settings
============================================
Note that the following is generally not necessary if dependency packages have been
installed using Package Management Tools such as yum or apt.

Ensure that all the build tools are available on your path, when they are
manually installed to non-standard locations. For example:

 # export PATH=~/qpid-tools/bin:$PATH

Ensure that pkg-config is set up correctly. This is especially important
if you have built the dependencies from source, as they may not be installed
in the default system location. For example:

 # export PKG_CONFIG_PATH=~/qpid-tools/lib/pkgconfig:/usr/local/lib/pkgconfig
 # export PKG_CONFIG=~/qpid-tools/bin/pkg-config

Ensure that the boost libraries are made available on the gcc library path.
For example:

 # export CXXFLAGS=-I~/qpid-tools/include/boost-1_33_1

