Building Google Chrome for Linux from Source
Currently, there is no native version of Google Chrome available for Mac and Linux users. That’s the bad news. And although it appears it will take some time for this availability gap to be addressed, the really good news is that the Mac and Linux ports of Google Chrome are being created out in the open - i.e., via an Open Source project known as Chromium.
Thus, rather than run the Windows port of Google Chrome on Linux via some emulation or virtualization mechanism, the approach taken here is to engage directly with the state-of-the-art development snapshot.
Caution: This is not for the feint of heart. To follow along, you will need to have some basic package-management and source-code-compilation skills.
Why Build from Source?
Before delving into the details, it’s always wise to ask “Why?” - as in “Why bother to engage at this point?”
There are a number of good reasons:
You can contribute! Chromium is an Open Source effort. If you’re a developer, you may be able to make contributions at the source-code level - e.g., original source code, bug fixes, coding suggestions/recommendations, code reviews, etc.. Even if you’re not a developer, you can contribute by finding bugs and filing bug reports.
You have pre-release access! Chrome for Linux doesn’t exist - at least not as an end-user application. Engaging in the manner described here allows you access to Chrome as a work-in-progress. Of course, if you seek to leverage and/or extend Chrome, this is an ideal opportunity to get engaged in a productive way.
You can acquire a a deeper understanding! You can only glean so much from marketing content. Engaging with Chrome deeply will transform gleaned superficial knowledge into progressively internalized and therefore highly actionable knowledge. A pre-requisite for developers, such a deeper understanding will allow the more casually inclined to contribute and better engage in the various discussions on Chrome.
How To Build Google Chrome from Source on Linux
If you’re still reading, then something above must have resonated with you personally, so let’s get our hands dirty!
There is a four-step process detailed at the Chromium project’s developer wiki:
Prereqs. A reasonably modern Linux distro and about 3 GB of disk space comprise the table stakes. Because Chrome relies on various software components, you’ll need to ensure these dependencies are addressed. All dependent software is Open Source and readily available. It’s best to install this software on your Linux system using the appropriate package managers. (Additionally, there is one component, TLS Lite, that is a Python module that you’ll need to acquire, build and install.) Although the list includes a number of the usual suspects, it is heartening to see the Netscape Portable Runtime Library being used. WebKit and V8 are not identified here as they are bundled with the Chrome tarball (see below). Before you can build Chrome from source, you will also need a package of scripts known as “depot_tools”. “depot_tools” are used by the project to manage code checkouts and reviews. (Installation of “depot_tools” is straightforward, involving downloading and unpacking a tarball and optionally placing the scripts on your executables search path.)
Build Chrome! All you need to do to initiate the build process is move into Chrome’s source directory via “cd $CHROMIUM_ROOT/src/chrome”, and then type “hammer”! (That would be hammer without the exclamation point. I exercised a little poetic license there as I particularly like that choice of command name.) At this point, I suggest you seek refreshment and nourishment, as the build process will take quite some time. By default, “hammer” will direct feedback to standard out - i.e., your terminal screen. Should you prefer to direct output of the build process to a file, type “hammer >& chrome_build_log.txt &”. While Chrome is being built, you can view the output being written to “chrome_build_log.txt” via a pager - e.g., “less chrome_build_log.txt”. (Once in the “less” pager mode, type “F” to see the build feedback scroll past in real time.) The arduous build process will end rather unceremoniously, with various executables being written to the “$CHROMIUM_ROOT/src/chrome/Hammer” directory.
Testing Chrome. You can’t! However, you can run a number of unit tests that were produced during the build process. And although I’ll defer that to a separate article, to whet your appetite, the image below is one of the test results.
This post is part of the series: Google Chrome for Linux
Google Chrome is shaking up the status quo for Web browsers. This series explores and expounds Chrome as it evolves for the Linux platform.
- Google Chrome for Linux: Building from Source
- Google Chrome for Linux: Testing and Contributing
- Google Chrome for Linux: The WebKit Web Browser Engine
- Google Chrome for Linux: Android Availability