Daily Archives: January 9, 2011

TrafficServer on ARM

I’ve returned to my slightly unusual hacking activity to build Apache TrafficServer on the Maemo (ARM linux) platform.

It’s a slow process, partly because of the slow platform (NFS-mounted disc for everything, just the processor from the phone) and the very large C++ code (which g++ builds slowly on any platform), but also crucially because of the number of fixes that only become apparent when the build trips up.  The worst cases have been where a header file has to be fixed: there are no explicit dependencies in the Makefiles, so it implies a huge amount of largely-unnecessary recompilation.

When I started on this, zwoop told me it was never going to be much of a performer on ARM, because it relies on 64-bit Intel-only atomics that have to be emulated at a heavy cost on ARM.  I found the atomics were not emulated, and their absence caused a link error.  Emulation code appears to be written, but evidently the build scripts incorrectly detected maemo as having the Intel atomics.  Oops!

Other fixes that have proved necessary:

  1. char on ARM appears to be unsigned, so I had to substitute bitwise tests for sign tests, and typecast values like EOF in comparisons.
  2. The build scripts failed to fix up my library path when I used –with-foo configure options.  Specifically a –with-tcl option, as maemo’s  Tcl package is missing tclconfig (required by trafficserver) so I had had to build a separate Tcl from source.

Not too much really: the atomics are the most complex hack.  But I fear this exercise is of purely academic interest, if the atomics prove to be a show-stopper for decent performance on ARM.

Bug me if I drop the ball on documenting this exercise in three bug reports!