Fix Subversion with Apache on OS X Yosemite Server

I have a server, running on an old Mac Mini, which hosts some basics stuff, like an Apache server to test my website, a Redmine service, and a Subversion repository accessible through Apache.
But I recently updated my server on OS X Yosemite, with Server 4.0, and as usual with a major update of OS X Server, a lot of stuff are broken. So here I am going to explain how to fix Subversion with Apache when you are in the same situation, after an update of OS X.

Basically, when I try to start Apache, there is an error when it tries to load the 2 modules needed for SVN (mod_dav_svn.so and mod_authz_svn.so). So we need to update these 2 modules for the version of Subversion which is installed on the server.

First of all, here is my configuration file for Apache, for Subversion; this is just a quick reminder, my aim here is not to explain how to install and configure SVN and Apache on a server.

#vLockDB var/DavLock
LoadModule dav_svn_module /somewhere/subversion/mod_dav_svn.so
LoadModule authz_svn_module /somewhere/subversion/mod_authz_svn.so

<Location /svn>
  DAV svn
  SVNParentPath /Library/Server/Web/Data/Svn
  AuthName "SVN Repository"
  Require valid-user
  AuthType Basic
  SVNIndexXSLT "/Svn/svnindex.xsl"
  AuthzSVNAccessFile /Library/Server/Web/Data/Svn/authz
</Location>

So, we first have to know which version of Subversion is installed; this command will give it to you :

svnadmin --version

For me, on Yosemite with Server 4.0, it is version 1.8.8.
We now have to download Subversion sources and compile it; but, very important, we won’t install it, we will just copy the 2 files we need. Be sure to modify the following commands with your version of svn, and the correct paths on your server.

curl 'http://archive.apache.org/dist/subversion/subversion-1.8.8.tar.bz2' > /somewhere/subversion/subversion-1.8.8.tar.bz2
bunzip2 subversion-1.8.8.tar.bz2
tar -xf subversion-1.8.8.tar.bz2

cd /somewhere/subversion/subversion-1.8.8
./configure
make

Now, Subversion is build, we can get our files and copy them in the appropriate folder, the one indicated in your apache configuration file (see above)

cp subversion/mod_dav_svn/.libs/mod_dav_svn.so /somewhere/subversion/
cp subversion/mod_authz_svn/.libs/mod_authz_svn.so /somewhere/subversion/

And that’s all, we just have to restart our Apache server !

sudo serveradmin start web

Building cross compiler tools for RaspberryPi on Mac OSX

[EDIT 2014/12/07] I rebuild a more recent version of the cross-compiler, and I got more trouble this time, so I updated this post with new information.


I have deciding to start developing for Raspberry Pi. As I use Mac OSX, I needed to build my own C cross compiler, because those provided on the RaspberryPi GitHub project only work for Linux.

At first, I wanted to build it from scratch, but after 2 days of failure, I decided to use crosstool-ng; apparently other people had succeeded building a cross compiler for RaspPi with it. But once again, it wasn’t so easy, I went to some troubles. But I finally succeeded to. So here is a full explanation on how I did.

First of all, you need HomeBrew, to install some needed package, and to install crosstool-ng itself. You can find it here : http://brew.sh.

Then from brew, install crosstool-ng, it will install all (or almost all) needed packages :

brew install crosstool-ng

Then install grep from brew :

brew tap homebrew/dupes
brew install homebrew/dupes/grep

We will also need gettext, for glibc build.

brew install gettext
brew link --force gettext

Also, you will need XCode command line tools :

xcode-select --install

You then have to tell crosstool-ng to use this grep instead of Apple’s one. For this you have to edit paths.sh file, it should be located somewhere like /usr/local/Cellar/crosstool-ng/1.20.0/lib/ct-ng.1.20.0/paths.sh. Edit the file and replace the line export

grep="/usr/bin/grep"

by

export grep="/usr/local/bin/ggrep"

This should do the trick. Now you are ready to use crosstoll-ng, or maybe, not exactly. crosstool-ng needs a case sensitive filesystem, and by default, Mac OSX  partitions are not; so you have to create one. Don’t worry, you don’t really have to create and new partition and mess up your hard drive. Open Disk Utility, and choose File > New > Blank Disk Image. You have to repeat the operation twice; because you have two create to images, one to build the cross compiler, and one to store the cross compiler. The one to build must be almost 5 GB (4,7GB for me), the other one only few hundreds of MB (about 200MB). Choose Mac OS Extended (Case-sensitive, journalized) for file format.

Go on the 1st image created, the bigger one, it will be used for the build. Start configuring your cross compiler :

ct-ng menuconfig

This will open a menu to edit the configuration, choose the following options :

  • Paths and misc options
    • enable ‘Try features marked as EXPERIMENTAL’
    • Prefix directory : /Volumes/BuildTools/x-tools/${CT_Target}) , where you want to install the cross tools once build. This must be on the 2nd image you created, because it must also be a case sensitive filesystem.
    • Extra host compiler flags : -fbracket-depth=1024
  • Target options
    • Target architecture : arm
    • Enable ‘Use the MMU’
    • Endianness : Little Endian
    • Bitness : 32 bits
    • Architecture level : armv6zk
    • Emit assembly for CPU : arm1176jzf-s
    • Tune for CPU : arm1176jzf-s
    • Use specific FPU : vfp
    • Floating point : hardware FPU
  • Toolchain options
    • Tuple’s vendor string : rpi or whatever you want, it will be added in the name of the binaries created
  • Operating system
    • Target OS : linux
    • Linux kernel version : 3.12.24 (this must be the version you have on your Raspberry Pi, or close to)
  • Binary utilities
    • binutils version : 2.24
  • C compiler
    • Enable ‘Show Linaro versions’
    • gcc version : 4.9.1 (you can try an other one, this one worked for me)
    • Enable ‘C++’
  • C library
    • C library : glibc
    • glibc version : 2.19
  • Companion libraries
    • change GMP version to 5.0.2, there is a problem with version > 5.1 and PPL library
  • Debug facilities
    • Enable gdb (if you want to cross debug)

You can now exit the menu, it will save the configuration file under .config.

Open now the .config file with a text editor, and find the line ‘CT_CC_STATIC_LIBSTDCXX=y’, change it to ‘CT_CC_STATIC_LIBSTDCXX=n’.

One last thing to do before starting : the build opens a lot of files in parallel, and on my machine it was more that what was allowed, so you have to change this :

ulimit -n 1024

Now launch the build a first time:

ct-ng build

You must have an error at step “Installing C library headers”, saying

Undefined symbols for architecture x86_64: 
"_libintl_setlocale", referenced from:
_main in cross-rpc_main.o.

We have to patch a makefile for this; so edit the file “.build/src/glibc-2.19/sunrpc/Makefile” and add a line

BUILD_LDFLAGS += -L/usr/local/lib -lintl

Start the build again, and this should work. It will take quite a long time, about 30 minutes for me, so you can have a coffee now !