HowTo Install OpenChange From Source

Introduction

Benefits of compiling the source

Several distributions (Debian, Ubuntu, SuSE and Fedora) contain packages for OpenChange. These packages are not maintained by the OpenChange team but by the distributions, and may be out of date. Also, the OpenChange project is moving along quickly and you may want to evaluate or benefit from latest features, changes and bug fixes we may supply in the future.

System Prerequisites

Installing OpenChange and Samba4 from sources requires several dependencies. You may already have installed some (or all of them) as part of previous development. However this guide has been written using fresh installed (and often minimal) Linux distributions. Installing the list of packages described below ensures your environment is compliant with OpenChange requirements.

Ubuntu

  1. Compilation tools
    $ sudo apt-get install build-essential autoconf ccache pkg-config python python-dev git flex bison docbook-xsl xsltproc
    
  2. OpenChange dependencies
    $ sudo apt-get install libpopt-dev libical-dev libsqlite3-dev libmagic-dev libboost-thread-dev zlib1g-dev
    
  3. OpenChange documentation
    $ sudo apt-get install doxygen
    

Fedora

  1. Compilation Tools
    # yum groupinstall "Development Tools" "Legacy Software Development" 
    # yum install ccache python-devel git-all docbook-style-xsl perl-ExtUtils-MakeMaker
    
  2. OpenChange dependencies
    # yum install popt-devel libical-devel sqlite-devel file-devel boost-thread
    
  3. Set environment variable to make boost-thread work
    export BOOST_LIB_SUFFIX="-mt" 
    

Note: You may wish to set the BOOST_LIB_SUFFIX environment variable in your startup scripts (e.g. ~/.bashrc) instead of hand-adding it each time you want to build.

Getting Source Code

OpenChange trunk repository is only available through git. The repository can be found at:
git://git.openchange.org/openchange.git

$ git clone https://github.com/openchange/openchange.git

Build Samba4

OpenChange is configuring and installing Samba4 by default in /usr/local/samba. This non-standard location requires preliminary steps to be performed:
  1. Make dynamic linker aware of samba libraries location (run as root):
    # echo "/usr/local/samba/lib" > /etc/ld.so.conf.d/samba4.conf
    
  2. Update your PKG_CONFIG_PATH and PYTHONPATH variable for root superuser and current user:
    1. For bash:
      # echo 'export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/samba/lib/pkgconfig' >> ~/.bashrc
      # echo 'export PYTHONPATH=$PYTHONPATH:/usr/local/samba/lib/python2.6/site-packages' >> ~/.bashrc
      # source ~/.bashrc
      

We can now download Samba4 sources from git and compile Samba4:

$ cd trunk
$ make samba-git
$ sudo /sbin/ldconfig

If you do not have external git access on the machine you want to build OpenChange on, then "make samba-git" won't work for you.
Instead, you can try something like:
  • Find a machine that can use git, and use git to clone samba from git://git.samba.org/samba.git
  • Create a tarball of the samba source
  • Copy the tarball over to the machine you want to build OpenChange on
  • Untar the samba source into the openchange source directory (so that you have it all in something like trunk/samba/)
  • rename the samba directory (or whatever you called it) to "samba4"
  • cd samba4
  • git reset to the value defined in script/samba4_ver.sh
  • cd ..
  • ./script/installsamba4.sh packages
  • ./script/installsamba4.sh compile
  • ./script/installsamba4.sh install

(this sequence is essentially what "make git" does, by invoking the ./script/installsamba4.sh script)

Your environment is now ready to compile OpenChange source.

Build OpenChange

We first need to run autotools and configure script:

$ ./autogen.sh && ./configure --prefix=/usr/local/samba

You should have an output similar to:

===============================================================
OpenChange Configuration (Please review)

           * OpenChange Libraries:
             - libmapi (C library):     yes
                      Thread support:   yes (pthread)
             - libmapi++ (C++ library): yes
             - libmapiadmin:            yes
             - libocpf:                 yes

           * OpenChange Server:
             - mapiproxy:               yes

           * OpenChange mapistore backends:
             - sqlite3:                 no

           * OpenChange Tools:
             - openchangeclient:        yes
             - mapiprofile:             yes
             - openchangepfadmin:       yes
             - exchange2mbox:           yes
             - exchange2ical:           yes
             - mapitest:                yes
             - openchangemapidump:      yes
             - schemaIDGUID:            yes

           * subunit format (mapitest): no

           * OpenChange Documentation:  yes

           * Coverage Tests:            no

           * OpenChange Bindings:
             - Python:                  no
             - Qt4:                     no

           * Installation prefix:       /usr/local/samba

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

If the output matches output above (at least the "OpenChange MAPI library", "libocpf", and "mapiproxy" lines should indicate "yes"), you can compile OpenChange using:

$ make
$ sudo make install
$ sudo ldconfig

Congratulations! You have successfully installed OpenChange source on your system and you are now ready to try OpenChange tools and server.

Follow our other guides available from the Wiki StartPage for development and additional post-installation guides.

Frequently Asked Questions

I already have Samba installed as part of my Linux distribution

When you install a Samba server on a Linux distributions, it belongs to samba-3.X releases. Samba3 source code and libraries are not compatible with OpenChange and dual Samba3/Samba4 installations generally produce unpredictable behaviors unless they are installed into different locations with environment variables set properly for the user installing OpenChange. If you experience troubles compiling OpenChange, consider removing Samba3 and install the Samba4 version that OpenChange needs instead.

Can I use a previous Samba4 alpha release with OpenChange?

Generally, No.

Each release has specific requirements and OpenChange trunk often requires a specific Samba4 snapshot or alpha release. You are strongly encouraged to install the Samba4 version that matches OpenChange using make samba-git (or make samba when OpenChange is relying on a release).

Why does OpenChange fail to compile with latest Samba4 master-git revision?

Samba4 is a moving target. We generally try to stick to latest revision, but some Samba4 master-git revisions may sometimes introduce breakage, API changes or incompatibility which need to be fixed by the Samba team. When such issue occurs, we stick to a fix git revision we know is working properly with latest OpenChange trunk and wait for the problem to get fixed before updating our requirements. You are strongly encouraged to install the Samba4 version that matches OpenChange using make samba-git (or make samba when OpenChange is relying on a release).

Why is OpenChange installed in /usr/local/samba

Mainly for convenient purposes and to avoid conflict with existing Samba version that may have already been installed on your workstation; such as a Samba3 install that may come with your Linux distribution if you installed a Samba server.