This guide provide instructions on how to configure and build Fuchsia on a host machine.
The steps are:
This guide requires the following prerequisite items:
Complete the Download the Fuchsia source code guide. This guide helps you download the Fuchsia source code and set up the Fuchsia development environment on your host machine.
You can build Fuchsia on a host machine with one of the following architectures:
Windows is not supported.
Fuchsia's build configuration informs the build system which product to build and which architecture to use.
To set your Fuchsia build configuration, run the following fx set
command:
fx set {{ '<var>' }}PRODUCT{{ '</var>' }}.{{ '<var>' }}BOARD{{ '</var>' }}
Replace the following:
PRODUCT
: The Fuchsia product that you want to build; for example, core
and workbench_eng
.BOARD
: The architecture of the product; for example, x64
.The example command below sets the build configuration to core.x64
:
fx set core.x64
core
is a product with the minimum feature set of Fuchsia, which includes network capabilities.x64
is a board that can run on a wide range of x64 devices, including the Fuchsia emulator (FEMU).On the other hand, the example below sets the build configuration to workbench_eng.x64
:
fx set workbench_eng.x64
The lists of possible boards and products are aggregated from the root of the Fuchsia source repository. For more information, see Configure a build.
Note: This step is not required for building Fuchsia.
To accelerate the Fuchsia build locally, use ccache
{:.external} to cache C and C++ artifacts from previous builds.
{Linux}
To use ccache
on Linux, install the following package:
sudo apt install ccache
{macOS}
For macOS, see Using CCache on Mac{:.external} 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 fx set
:
Force the use of ccache
even when other accelerators are available:
Disable the use of ccache
:
The fx build
command executes the build to transform source code into packages and other build artifacts.
To build Fuchsia, run the following command:
fx build
Note: Building Fuchsia can take up to 90 minutes.
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.