Build Chromium
Once you have a
checkout of
the chromium
repository, you're now ready to build the Chromium binary.
Install the build dependencies
Building Chromium requires many dependencies to be installed on the workstation, including development libraries and tools. Thankfully, getting these dependencies set up and configured is simplified with a script in the Chromium source:
chromium/src$ build/install-build-deps.sh
Set the SDK_BOARD
variable
You'll need to find the board name for your test device on Goldeneye (Googlers only). A number of commands use this board name, so you may wish to store it in an environment variable. For example, if your device is an eve (a Pixelbook):
export SDK_BOARD=eve
Make sure that the corresponding board is listed in the cros_boards
section of
your chromium/.gclient
file and subsequently gclient sync
has been run;
otherwise, the import statement below will fail with a file not found exception.
See the ChromiumOS-specific GN args mapping README.md for more information and examples.
Create a build configuration
Create a build configuration for your board. The following example specifies a few important build arguments to set:
chromium/src$ gn gen out_${SDK_BOARD}/Release --args="
import(\"//build/args/chromeos/${SDK_BOARD}.gni\")
is_chrome_branded = true
is_official_build = false
optimize_webui = false
target_os = \"chromeos\"
use_remoteexec = true"
This command creates the file out_${SDK_BOARD}/Release/args.gn
containing the
contents passed in the --args
command above. Future invocations of gn gen
will use the cached values in args.gn
so passing the --args
parameter is no
longer necessary. You can edit the cached arguments by editing
out_${SDK_BOARD}/Release/args.gn
or running the following command:
chromium/src$ gn args out_${SDK_BOARD}/Release
More information regarding build configurations can be found here.
Building Chrome
You are now ready to build the chrome target:
autoninja -C out_${SDK_BOARD}/Release chrome
autoninja
is a tool which passes the best parameters to the build command,
ninja
, to handle build parallelization based on whether remote execution
(e.g., Reclient) is enabled and available. ninja is a build system specializing in a fast edit-build
cycle and is the tool used to build Chromium.
Common build errors
ninja: error: loading 'build.ninja': No such file or directory
This error cocurs if the build.ninja
cache file is not present and updated in
the out_${SDK_BOARD}/Release
directory. This may happen if gn gen
has not
been run yet or if that command was interrupted before completing. To fix this
error, run gn gen
again:
chromium/src$ gn gen out_${SDK_BOARD}/Release
Up next
Once the chrome
target successfully builds, you are ready to
deploy the
Chromium binary to the test device.