Compiling Boot 2 Gecko on OSx10.8
« Tuesday, April 23, 2013 »

b2g

Compiling b2g wasn't an easy task the first time I tried. I recently changed computer and wanted to try again. You have to go to the following url to get most of the informations you need.

Building and installing Firefox OS

Cloning the repo :

1
git clone git://github.com/mozilla-b2g/B2G.git

When done:

1
2
cd B2G
./config.sh emulator

After executing ./config.sh emulator for the first time, you can do something else while it's downloading everything. It might take around half an hour to a couple of hours depending on your internet speed. If you're on OSx, I wouldn't go that far from the computer or make sure it cannot fall asleep. I'm not sure if it's a git bug or something else. OSx fell asleep even tought it was actually downloading a lot of files. When it wakes up, it doesn't even try to restart the download. If you write Ctrl + C in the terminal, it might start again or it will just fail. In the case of failure, git seems to forget everything it downloaded and if you configure again, it will download everything once again.

For that reason, it might be a good idea to install Caffein or use this command line to prevent the computer from sleeping.

1
pmset noidle

Since you have still a lot of time on your hands now, you can keep reading to prepare yourself mentally for what's going to follow. As you should know, the process of configuration is actually loading all submodules and it's going to download around 2 or 3 gb. If you want to build for a different target, you can change emulator for a different supported target. I'll try to cover how to port Firefox OS for a different phone later, but for now I'll stop myself at making it build on OSx 10.8.

When you see this, you're good to go and build but first, run the bootstrap that is supposed to solve some problems already, don't install XCode for 10.6, we'll try to build with 10.8. Install anything that is required from homebrew and we can keep going from there.

1
2
curl -fsSL https://raw.github.com/mozilla-b2g/B2G/master/scripts/bootstrap-mac.sh | bash
./build.sh -j1 

Since we know it won't work the for the first time, lets build it with only one job at a time. You could run build.sh without -j1 to get to the error faster. You should at least see this message:

1
2
3
build/core/combo/HOST_darwin-x86.mk:42: ***********************************************************
build/core/combo/HOST_darwin-x86.mk:43: * No 10.6 or 10.5 SDK found, do you have Xcode installed? *
build/core/combo/HOST_darwin-x86.mk:44: ***********************************************************

Now open this file: build/core/combo/HOST_darwin-x86.mk and change this block:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
sdk_root := $(sdks_root)/MacOSX10.6.sdk
ifeq ($(wildcard $(sdk_root)),)
  sdk_root := $(sdks_root_old)/MacOSX10.6.sdk
  ifeq ($(wildcard $(sdk_root)),)
    sdk_root := $(sdks_root_old)/MacOSX10.5.sdk
    ifeq ($(wildcard $(sdk_root)),)
      $(warning ***********************************************************)
      $(warning * No 10.6 or 10.5 SDK found, do you have Xcode installed? *)
      $(warning ***********************************************************)
      sdk_root :=
    endif
  endif
endif

for this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
sdk_root := $(sdks_root)/MacOSX10.8.sdk
ifeq ($(wildcard $(sdk_root)),)
  sdk_root := $(sdks_root)/MacOSX10.7.sdk
  ifeq ($(wildcard $(sdk_root)),)
    sdk_root := $(sdks_root)/MacOSX10.6.sdk
    ifeq ($(wildcard $(sdk_root)),)
      sdk_root := $(sdks_root_old)/MacOSX10.6.sdk
      ifeq ($(wildcard $(sdk_root)),)
        sdk_root := $(sdks_root_old)/MacOSX10.5.sdk
        ifeq ($(wildcard $(sdk_root)),)
          $(warning ***********************************************************)
          $(warning * No 10.6 or 10.5 SDK found, do you have Xcode installed? *)
          $(warning ***********************************************************)
          sdk_root :=
        endif
      endif
    endif
  endif
endif

And then you shouldn't see any error message or warning. But this error or something similar. I can't tell exactly why but after digging the sources, it appears that the maccomon folder is a deprecated thing for OSx10.8. Instead of using Quartz, it should use the X11 port. As far as I can tell, the sdl from brew doesn't even compile using the maccomon files. In the end, I got the emulator to build but it won't work. (It's not the end tough. You can get FirefoxOS running)

1
host C: emulator-libui <= external/qemu/distrib/sdl-1.2.12/src/video/maccommon/SDL_macevents.c

In order to fix this error, you should apply the following patch. That will actually fix some defines and make sure you're not actually building as darwin but with x11 video driver. It really does sounds like a hack but it seems that there is no other way around it yet. Building against 10.6 might work but my guess is that in the end there will be an error with sdl anyway.

1
patch here to be done

Now, you should be able to build with ./build.sh

incomplete

comments powered by Disqus

Copyright © 2015 Loïc Faure-Lacroix