Some people on Telegram expressed interest in how I am able to build B2G OS from Arch Linux without resorting to a VM, or anything like that. Arch Linux is tricky because software is constantly being updated. As such, any problems that can arise trying to build with the latest build tools will probably trip up Arch Linux users.
Unfortunately I didn’t document my steps when I first worked through this, so I may not be completely exhaustive concerning the packages that need to be installed. If I’ve missed something or the situation changes again, hopefully someone can correct/update below
The existing instructions for building on Arch Linux are here. I followed these as a starting point. So I install the following:
sudo pacman -S --needed \ alsa-lib autoconf2.13 bison ccache curl firefox flex \ gcc-multilib git gperf libnotify libxt libx11 mesa \ multilib-devel wget wireless_tools yasm zip \ lib32-mesa lib32-mesa-libgl lib32-ncurses \ lib32-readline lib32-zlib lzop
The only difference to MDN with the above is that the
libxml2-utils package doesn’t exist anymore.
I also installed and set up a python virtual env, as described in MDN, so that executing
python --version gives “Python 2.7.12”.
What isn’t mentioned on MDN is that Archlinux only packages GNU Make version 4, but you need either 3.81 or 3.82 to use the Android build system (maybe just for KitKat and earlier?). The solution for this that I have found is to install the make3 package from AUR.
This package replaces GNU make 4, which might be a problem if you need version 4 for another project. @lissyx (below) recommends against replacing your system make, so you may want to look for an alternative to installing this on your system. One possibility is that you can build
makepkg, as described below, but then skip over the
pacman -U step and instead prepend
<place where you cloned to>/make3/pkg/usr/bin to your
PATH in your
.userconfig, as @lissyx describes below.
I had to edit the package to comment out the
make check line. For whatever reason, one test failed for me. So the process by which I installed
make3 looks like this:
git clone https://aur.archlinux.org/make3.git cd make3 makepkg # if this fails, comment out "make check" in PKGBUILD and retry sudo pacman -U make3-3.82-1-x86_64.pkg.tar.xz
Ncurses 5 Compat
The Android NDK (see below) needs ncurses 5, but Arch has ncurses 6. Fortunately this can be fixed in a non-invasive way by compiling and installing the ncurses5-compat-libs package from AUR. I also installed the lib32-ncurses5-compat-libs package, so I’m fairly sure this is needed too if your host machine is 64-bit. These two packages install straightforwardly so I haven’t listed the
Additionally, building B2G now needs a copy of the Android NDK. You don’t have to install this from AUR, but it helps to keep track of the dependencies (i.e. ncurses compat). As issues have been reported with version 12 of the NDK, we need to get version 11. This means going back in the recipe’s git history using
git checkout, as described below.
git clone https://aur.archlinux.org/android-ndk.git cd android-ndk git checkout 49f09c2eaebff46af27b04d0e8c29289e5cbcd93 makepkg sudo pacman -U <whatever the package file is>
Build system config
Aside from the standard instructions, I made the following changes.
Use github copy of gaia kanikani branch; so in
.repo/manifests/base.xml, I have
<project name="gaia" path="gaia" remote="b2g" revision="kanikani" />for Gaia (the “remote” part is different). Also either do a
repo syncafter this or
git reset --hard b2g/kanikani. This is not Arch-specific, but still needs to be done.
Put the following into my
.userconfigso that the build system knows where to find the NDK.
I believe that that’s the extent of the Arch Linux specific stuff.