Building Fennec for Android from OSX

I had some free time yesterday so I thought I’d try to dabble in building Fennec with some debugging to figure out why it looks like ass on my phone. I’ve played with building Fennec a few times before and like everytime before the first thing I needed to do was fix the problems in the build system that breaks building for Android from OSX. Everyone else uses a Linux host it seems. This time there were only two bugs to be found and on the off chance anyone else is trying to do this I thought I’d link to them.

The first problem is that the library search path is a little broken in one place. On Linux it works because when make looks for it finds it in the linux libraries, on OSX it doesn’t (only libz.dylib exists). I came up with a hacky solution but it turns out Patrick has what looks to be a much better fix in bug 639568.

The second problem is in libvpx. I guess some of the asm code needs to know the offsets of certain structures in the object files generated from the C code. There is a little tool built which looks into the object files and outputs the offsets. Since it is a build for ARM the object files are in elf format, but when this tool is built on an OSX host it is built to look in MachO object files. The fix in bug 641267 is quite hacky but does the job at least. It just forces the tool to build for elf support and has to include an elf.h since OSX does not come with one. I probably need to figure out how to file this upstream to get a better solution but for now I can build which is all I need.

Of course you can’t even start building without an NDK for OSX. Fennec builds with a customised version of the NDK based on the CrystaX NDK but with the queue.h header added. Mozilla have a version for Linux on the ftp site but I had to put together my own for OSX. It’s available to download if you need it, I’ll see if we can just get it added to the ftp site too.

Hopefully this is useful to others, sadly by the time I had figured out how to get my build working I had run out of spare time to actually work on my problem 🙁

Update: It seems that even these fixes aren’t quite enough. Although this gets the build to complete it crashes on startup on my phone. Then again my attempts to build on Linux also crash shortly after startup on my phone so maybe I have other problems.