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!

Posted on January 9, 2011, in apache, ARM. Bookmark the permalink. 4 Comments.

  1. Somehow I thought that Theo’s porting to armv5tejl was.. general enough for all ARM architectures (TS-533/TS-135).. maybe TS-618 broke it again?

    Ad 2.: Maybe AMC’s commit today fixed that TS-583..

  2. Igor, I caught Theo on IRC yesterday – after I’d written this. He hadn’t encountered my problem with the atomics.

    Bear in mind “ARM” isn’t such a homogenous platform as x86 – lots of chip producers each with its own custom variants on ARM’s core designs. What my Nokia has may be rather smaller and simpler than what Theo worked on.

    This actually looks like a possible gcc bug. Release notes for gcc-4.3 tell us these atomics have been fixed. But then, TFM for these atomics suggests they’re platform-specific to 64-bit Intel.

    Since this is purely for interest, I may drop it for the time being and just hack up emulation for the missing functions. I’m not going to submit such stubs ‘cos I’d have no idea how to determine whether to configure them – bearing in mind Theo didn’t need them.

  3. niq,

    I was just wondering what was the outcome of this little experiment? I ask because I too am trying to cross-compile TrafficServer for the ARM platform. It’s part of a project I’m trying to put together for one of my classes. Shoot me an email at and let me know if you managed to hack your way though it. I’d love to collaborate with you on it.

    -Devin Madden

  4. Sorry, haven’t revisited this one since my original blog entry. If I do it’ll be to RTFM on ARM atomics, to put something decent in place of the Intel stuff. Or because someone’s paying for the work.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: