Firefox OS build on Mac OS X Mountain Lion

I’m trying to get Firefox OS built on Mac OS X Mountain Lion. It’s not going too well!

I checked out the code and ran ./ emulator, then I ran ./ and waited. After a while, I got:

 25 52.4M   25 13.2M    0     0  1203k      0  0:00:44  0:00:11  0:00:33 1435kdyld: Library not loaded: /usr/local/lib/libmpfr.4.dylib

This seems to be a follow-on from the previous b2g problems. Indeed after investigating, it seems mpfr did not appear to be installed properly.

ls -l /usr/local/lib/libmpfr.4.dylib
lrwxr-xr-x 1 me admin 43 22 Sep 16:34 /usr/local/lib/libmpfr.4.dylib -> ../Cellar/mpfr/3.1.1-p2/lib/libmpfr.4.dylib
[me@anti B2G]$ ls /usr/local/Cellar/
autoconf automake erlang git gnupg libtool watch yasm
autoconf213 ccache gcc-4.6 gmp libmpc rabbitmq wget

Note the missing mpfr in the homebrew install directory. This was fixed by reinstalling mpfr using homebrew (with the –use-gcc flag).

Later, I got the following:

In file included from external/qemu/hw/hw.h:5:0,
from external/qemu/audio/audio.c:25:
external/qemu/qemu-common.h:25:20: fatal error: stdlib.h: No such file or directory
compilation terminated.
make: *** [out/host/darwin-x86/obj/EXECUTABLES/emulator-arm_intermediates/audio/audio.o] Error 1

For some reason the build wasn’t finding the standard headers. A search of the google group came up with a thread on B2G in Mac OS X which contained a fix done by copying Xcode to /Developer/SDKs. This seemed like a kludge. The problem was also presumably due to the error at the start of the build, where I kept seeing the following warning:

build/core/combo/ ***********************************************************
build/core/combo/ * No 10.6 or 10.5 SDK found, do you have Xcode installed? *
build/core/combo/ ***********************************************************

This can be fixed with this hack to the build file; however it’s worth noting the upstream Android version is more sophisticated in the check.

Finally, I got to the point of having this error:

make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/emulator-libui_intermediates/distrib/sdl-1.2.12/src/video/maccommon/SDL_macevents.o] Error 1
In file included from external/qemu/distrib/sdl-1.2.12/src/video/maccommon/../macrom/SDL_romvideo.h:27:0,
from external/qemu/distrib/sdl-1.2.12/src/video/maccommon/SDL_macwm_c.h:24,
from external/qemu/distrib/sdl-1.2.12/src/video/maccommon/SDL_macwm.c:43:
external/qemu/distrib/sdl-1.2.12/src/video/maccommon/../macrom/../maccommon/SDL_lowvideo.h:59:2: error: unknown type name ‘PaletteHandle’
external/qemu/distrib/sdl-1.2.12/src/video/maccommon/SDL_macwm.c: In function ‘Mac_SetCaption’:
external/qemu/distrib/sdl-1.2.12/src/video/maccommon/SDL_macwm.c:52:3: warning: ‘SetWTitle’ is deprecated (declared at /Applications/ [-Wdeprecated-declarations]
make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/emulator-libui_intermediates/distrib/sdl-1.2.12/src/video/maccommon/SDL_macwm.o] Error 1

Looking into PaletteHandle, it seems like Palettes.h was removed in OS X Lion. Digging in to mozilla’s upstream (android) shows that although SDL is now at 1.2.15, this particular file is the same. libsdl itself is also at 1.2.15.

Trying to build a copy of SDL 1.2.15 out of curiosity, it turns out I need X11 headers; X11 is now under the auspices of the xquartz project, so install XQuartz and then (via stackoverflow xlib.h not found) create a symlink to the headers:  ln -s /opt/X11/include/X11 /usr/local/include/X11

Interestingly, SDL 1.2.15 built fine; so is it something to do with the android/mozilla build?

Grab a copy of SDL 1.2.12; try ./configure && make and it fails, but not where I expected:

make: *** [build/SDL_RLEaccel.lo] Error 1

Stackoverflow again: Compiling SDL from source on a Mac running OS X 10.7 Lion suggests I use ./configure –disable-assembly ; trying it results in:

In file included from ./src/video/quartz/SDL_QuartzEvents.m:24:
./src/video/quartz/SDL_QuartzVideo.h:96: error: expected specifier-qualifier-list before ‘NSQuickDrawView’

Ok, baffled by this. sdl is in homebrew; let’s see how they build it: sdl.rb is for 1.2.15, the oldest homebrew version is for 1.2.13; 

I tried ./ && ./configure –disable-assembly && make and got:

make: *** [build/SDL_QuartzEvents.lo] Error 1

Googling and reading further led me to Bug 581 – Quickdraw is a deprecated API, much of which makes me think SDL 1.2.12 won’t work on more recent versions of OS X. But if that’s the case, how does the desktop build of Firefox OS work?

I think I need to do more reading …

This entry was posted in Computing, Mobile Tech, Planet, Research and tagged , , , , , , , . Bookmark the permalink.

2 Responses to Firefox OS build on Mac OS X Mountain Lion