I’ve just restarted working on Compressed Pristines feature for Subversion (a separate post on that later). I thought it’d be interesting to first have a quick summary of getting Subversion built from the sources in as little effort as possible.
Prerequisites
Ubuntu doesn’t come preinstalled with all the necessary development tools. So first we need to install all the tools necessary to build Subversion. One easy trick is to ask apt-get to do all the hard work for us. But first, let’s make sure we have an up-to-date system:
sudo apt-get update
sudo apt-get upgrade
Now, let’s get all the relevant dependencies:
sudo apt-get build-dep subversion
On a clean install of Ubuntu 12.10 64-bit the above installs 158 new packages. These include build-essential, autoconf and autotools-dev. The majority of the remaining are libraries, languages and frameworks that Subversion depends on one way or another. Apache, for example, is necessary to build the server modules. Similarly, Python and Ruby bindings depend on their respective systems.
After downloading, unpacking and installing a few 100 MBs, we’re finally ready.
Getting the Code
Since we need Subversion to checkout Subversion sources, we will download the source archive instead. The project download page lists recommended release download links. From there, we get the tar.gz or tar.bz2 of our choice. This time around, it’s 1.7.7 for me.
wget http://apache.mirror.nexicom.net/subversion/subversion-1.7.7.tar.bz2
tar -xjvf subversion-1.7.7.tar.bz2
cd subversion-1.7.7
It’s best to do this in /usr/local/src
as that’s the “default” folder where user-generated sources should go. For convenience, we can ln -s -t $HOME/ /usr/local/src
to create a symbolic link in our home directory called src
that really points to /usr/local/src
. One inconvenience about /usr/local/src
is that we must be superuser to write to it.
Configuring the Source
Once we have the source code extracted, we need to prepare it. Since Subversion is part of the Apache Software Foundation, it naturally uses the APR library (Apache Portable Runtime) which has been the cornerstone of Apache server and many other high-availability projects. To get all core libraries that Subversion depends on to build, there is a very convenient shell script in the root of the sources aptly named get-deps.sh
. Once the APR and Surf and other libs are downloaded and extracted, we need prep them for configuration. The following will do all that with much simplicity.
./get-deps.sh
cd apr/; ./buildconf; cd ..
cd apr-util/; ./buildconf; cd ..
cd apr-util/xml/expat/; ./buildconf.sh; cd ../../..
./autogen.sh
Now we can finally configure.
./configure
All went as planned, except I got this harmless warning:
configure: WARNING: we have configured without BDB filesystem support You don't seem to have Berkeley DB version 4.0.14 or newer installed and linked to APR-UTIL. We have created Makefile which will build Subversion without support for the Berkeley DB back-end. You can find the latest version of Berkeley DB here: http://www.oracle.com/technology/software/products/berkeley-db/index.html
Build and Install
And finally:
make && make check
And if all goes well, the last line should read:
SUMMARY: All tests successful.
Now, let’s install it our shiny Subversion build:
Alternative/Minimalistic Configure
If we don’t want or need all those dependencies, and would rather settle for a fast build of a client-only, without Apache and whatnot, here is a trimmed-down config, make and check that gives a minimalistic working client.
./configure --disable-mod-activation --without-gssapi --without-apxs --without-berkeley-db --without-serf --without-swig --without-ctypesgen --without-kwallet --without-gnome-keyring --disable-javahl --disable-keychain -C make mkdir-init external-all fsmod-lib ramod-lib lib bin make check TESTS="`echo subversion/tests/cmdline/{basic_tests.py,merge_tests.py}`"
sudo make install
$ svn --version svn, version 1.7.7 (r1393599) compiled Nov 3 2012, 13:53:08 Copyright (C) 2012 The Apache Software Foundation. This software consists of contributions made by many people; see the NOTICE file for more information. Subversion is open source software, see http://subversion.apache.org/ The following repository access (RA) modules are available: * ra_neon : Module for accessing a repository via WebDAV protocol using Neon. - handles 'http' scheme - handles 'https' scheme * ra_svn : Module for accessing a repository using the svn network protocol. - with Cyrus SASL authentication - handles 'svn' scheme * ra_local : Module for accessing a repository on local disk. - handles 'file' scheme * ra_serf : Module for accessing a repository via WebDAV protocol using serf. - handles 'http' scheme - handles 'https' scheme
Summary
Building Subversion can be a real pain, with all the dependencies and configuration options. However, with the right steps, it’s actually a breeze. To summarize, here the full script of commands as we executed them in one chunk:
sudo apt-get update sudo apt-get upgrade sudo apt-get build-dep subversion wget http://apache.mirror.nexicom.net/subversion/subversion-1.7.7.tar.bz2 tar -xjvf subversion-1.7.7.tar.bz2 cd subversion-1.7.7 ./get-deps.sh cd apr/; ./buildconf; cd .. cd apr-util/; ./buildconf; cd .. cd apr-util/xml/expat/; ./buildconf.sh; cd ../../.. ./autogen.sh ./configure make && make check sudo make install
3 Responses to “Building Subversion on Ubuntu 12.10”