commit | fb09f7751fd8e4147441687abf63f114ca8cd009 | [log] [tgz] |
---|---|---|
author | third-party-roller <third-party-roller@fuchsia-infra.iam.gserviceaccount.com> | Fri Mar 10 11:49:03 2023 +0000 |
committer | CQ Bot <fuchsia-internal-scoped@luci-project-accounts.iam.gserviceaccount.com> | Fri Mar 10 11:49:03 2023 +0000 |
tree | 2fb9d6ead6b944db1ae0ebd791426ed26bb97cd8 | |
parent | ff4fcac682e6b4ea3724c1f48b48eb9aff3ff8fd [diff] |
Run "scripts/update-fuchsia-sdk.sh" Roller-URL: https://ci.chromium.org/b/8787014500072430961 CQ-Do-Not-Cancel-Tryjobs: true Change-Id: I8badb1567f8965f8b4c276e31ebf8bd799c8ce2a Reviewed-on: https://fuchsia-review.googlesource.com/c/samples/+/817315 Commit-Queue: third_party Roller <third-party-roller@fuchsia-infra.iam.gserviceaccount.com>
A collection of samples demonstrating how to build, run, and test Fuchsia components outside the Fuchsia source code tree.
Caution: These samples might be changed in backward-incompatible ways and are not recommended for production use. This repository is not subject to any SLA or deprecation policy.
Install required dependencies for building:
sudo apt-get install curl unzip clang python3 build-essential
Clone this repo and submodules:
git clone https://fuchsia.googlesource.com/samples --recursive --depth 1
If you have already cloned this repo without the --recursive
flag you can run git submodule init && git submodule update --recursive
to download the submodules. The git history is quite large, and you can download only the newest commit with --depth 1
. Remove this flag if you want the entire history.
Change directory to the root of the repo and setup and run the tests:
cd samples ./scripts/setup-and-test.sh
This script downloads all required dependencies (this may take 5-30min), builds the samples, and runs the tests. If the script completes without errors all tests have passed.
The C++ samples in this repo only support Linux hosts and the GN build system.
To get started see the SDK documentation.
Example application using Scenic to render animated graphics.
To get started, see the README.
FIDL protocol server and client implementing a calculator interface.
To get started, see the README.
Basic component that prints a Hello World greeting.
To get started, see the README.
FIDL protocol server and client implementing a simple ROT13 encoding interface.
To get started, see the README.
Integration test component using the Realm Builder library.
To get started, see the README.
The build
directory contains the build configuration for the sample including the toolchain, targets and tests.
The buildtools
directory contains scripts to help with the build process like downloading needed tools (e.g. gn, ninja).
The src
directory contains the source code for the C++ samples.
GN samples has two third_party dependencies: the Fuchsia GN SDK and googletest (googletest is only required for testing):
Fuchsia x64 system images can be started with the included emulator scripts and run on x64 hosts. Native Vulkan support on the host is required for graphics support.
Install dependencies for Vulkan support:
sudo apt-get install libvulkan1 mesa-vulkan-drivers
Download tool dependencies:
./scripts/download-build-tools.sh
Generate Ninja files x64 targets:
./buildtools/linux64/gn gen out/x64 --args='target_os="fuchsia" target_cpu="x64"'
List the available product bundles, and download the workstation_eng.qemu-x64 bundle:
./third_party/fuchsia-sdk/tools/x64/ffx product-bundle list
./third_party/fuchsia-sdk/tools/x64/ffx product-bundle get workstation_eng.qemu-x64
Start the emulator:
./third_party/fuchsia-sdk/tools/x64/ffx emu start workstation_eng.qemu-x64
Start the package server:
./third_party/fuchsia-sdk/tools/x64/fserve --image qemu-x64
SSH to the emulator:
./third_party/fuchsia-sdk/tools/x64/fssh
Fuchsia arm64 system images can be emulated on x64 hosts with the included emulator scripts, although the performance is much slower since each instruction needs to be emulated. Graphics output is also not supported at this time, access is only via serial console or SSH.
Download tool dependencies:
./scripts/download-build-tools.sh
Generate Ninja files for arm64 targets:
./buildtools/linux64/gn gen out/arm64 --args='target_os="fuchsia" target_cpu="arm64"'
List the available product bundles, and download the terminal.qemu-arm64 bundle:
./third_party/fuchsia-sdk/tools/x64/ffx product-bundle list
./third_party/fuchsia-sdk/tools/x64/ffx product-bundle get terminal.qemu-arm64
Start the emulator headless. Use the QEMU engine and smaller terminal.qemu-arm64 for much better performance. Use a longer timeout since arm64 on x64 emulation is slower:
./third_party/fuchsia-sdk/tools/x64/ffx emu start --engine qemu --headless --startup-timeout 360 terminal.qemu-arm64
Start the package server:
./third_party/fuchsia-sdk/tools/x64/fserve --image qemu-arm64
SSH to the emulator:
./third_party/fuchsia-sdk/tools/x64/fssh