Web App Development

Building Chromium 1 August 2016

Building Chromium locally wasn’t quite as bad as I expected it to be. For the most part it was enough to just follow the general guide, although the Mac specific one gives some more info about installing dependencies.

Paul Irish also has some build instructions specific to DevTools. The debug_devtools = true setting sounds very useful.

But assuming your computer is set up correctly these are the only steps required to build Chromium:

chrome fetch
cd src
gclient runhooks
gn gen out/Default
ninja -C out/Default chrome

(Skip chrome fetch if you’ve already checked out the git repo.)

It takes a while, I’m guessing maybe 4 hours on my machine. My laptop went to sleep several times, but when it woke up the build just continued as before.

Still, I managed to run into a few problems.

Don’t try to build from a broken commit

At first I was getting this message when running gn gen out/Default.

ERROR at //BUILD.gn:194:5: Can't load input file.
    "//ui/gfx:gfx_unittests",
    ^-----------------------
Unable to load:
  /Users/mattzeunert/chromium/src/ui/gfx/BUILD.gn
I also checked in the secondary tree for:
  /Users/mattzeunert/chromium/src/build/secondary/ui/gfx/BUILD.gn

Turns out my local version of the source code was broken. The Mac build guide suggests that you check the current build status first, but I didn’t really get what I was supposed to do.

DevTools Build Status website

You want to look for the column for your build environment and make sure it’s green.

If it’s not, find the last commit where it was green and do a git reset. So in the example above the last green Mac commit is 469b0eeb77b2, so you run git reset 469b0eeb77b2.

Make sure you have enough disk space

My build was almost done when this happened.

fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool:
can't write to output file (No space left on device)
ninja: build stopped: subcommand failed.

My out/Default directory is taking up 46GB of disk space. Make sure you have enough free space.

I thought I would have to rerun the whole build, but when I restarted the ninja command it just continued where it left off.

Run Chrome

Once Chrome is done just run out/Default/Chromium.app/Contents/MacOS/Chromium from the src directory.

Chromium