This guide provide instructions on how to set up and build Fuchsia.
The steps are:
Before you start, complete the Download the Fuchsia source code guide to download the Fuchsia source code and set up the Fuchsia development environment on your machine.
Fuchsia can only be built on a machine with one of the following CPU architecture and operating system combinations:
- x86-64 Linux (Debian-based distributions only)
- x86-64 macOS
Windows and ARM64 Linux are not supported.
ARM64 macOS is not officially supported, but a build may still succeed if commands are run in a terminal started with:
arch -x86_64 /bin/zsh
2. Set your build configuration
Fuchsia's build configuration informs the build system which product to build and which architecture to build for.
To set your Fuchsia build configuration, run the following
fx set command:
fx set PRODUCT.BOARD
Replace the following:
PRODUCT: The Fuchsia product that you want to build; for example,
BOARD: The architecture of the product; for example,
The example command below sets a build configuration that builds the
product for the Fuchsia emulator (FEMU):
fx set core.qemu-x64
In this example:
coreis a product with the minimum feature set of Fuchsia, including common network capabilities.
qemu-x64is a board that refers to the x64 architecture on FEMU, which is based on the open source emulator QEMU.
Additionally, the example command below sets your build configuration to build
workstation product for an
x64 architecture machine or device:
fx set workstation.x64
For more information on the build configuration, see Configure a build.
3. Speed up the build (Optional)
To speed up the Fuchsia build, you can use one of the following services:
Goma is a distributed compiler service for open source projects such as Chrome, Android and Fuchsia.
If you have access to Goma, enable a Goma client on your machine:
If you do not have access to Goma, but want to accelerate the Fuchsia build
ccache to cache
artifacts from previous builds.
ccache on Linux, install the following package:
sudo apt-get install ccache
For macOS, see Using CCache on Mac for installation instructions.
ccache is enabled automatically if your
CCACHE_DIR environment variable
refers to an existing directory.
To override this default behavior, specify the following flags to
Force the use of
ccacheeven when other accelerators are available:
fx set PRODUCT.BOARD --ccache
Disable the use of
fx set PRODUCT.BOARD --no-ccache
4. Build Fuchsia
fx build command executes the build to transform
source code into packages and other build artifacts.
To build Fuchsia, run the following command:
When you modify source code, run the
fx build command again to perform an
incremental build, or run the
fx -i build command to start a watcher, which
automatically builds whenever you update the source code.
For more information on building Fuchsia, see Execute a build.
To launch the Fuchsia emulator (FEMU) on your machine, see Start the Fuchsia emulator.
However, if you want to run Fuchsia on a hardware device, see Install Fuchsia on a device instead.