Building
Building with go build
SCION can be built with go build without any other system prerequisites.
Please be aware that go build is not the recommended setup for development on SCION. Not all tests and checks can be run in this setup. We use Bazel to orchestrate all of this. Without running all checks locally, it is likely that there will be frustrating cycles with the CI system rejecting your changes. See Setting up the Development Environment for instructions on how to set up Bazel and the full development environment.
Prerequisites
Clone the SCION repository into your workspace.
git clone https://github.com/scionproto/scion cd scion
Determine the go version used in the Bazel setup; the
MODULE.bazelfile specifies this version in thego_sdk.downloadclause.go_sdk.download(version = "1.26.0")Building with newer go versions usually works.
Install go. Either follow the official instructions or check the Ubuntu specific installation options on the golang wiki.
Build
Build only “distributables”, without development and testing tools
CGO_ENABLED=0 go build -o bin/ ./{router,control,dispatcher,daemon,scion,scion-pki,gateway}/cmd/...
Build all
go build -o bin/ ./...
Building with Bazel
Please be aware that the following instructions only result in a minimal build environment. Not all tests and checks can be run in this setup. See Setting up the Development Environment for instructions on how to set up Bazel and the full development environment.
Prerequisites
Clone the SCION repository into your workspace.
git clone https://github.com/scionproto/scion cd scion
Install Bazel: either follow the official instructions at https://bazel.build/install, or run our helper script:
tools/install_bazel
Remove remote cache options from
.bazelrc; the default setup is useful to limit Bazel’s cache size when contributing to SCION, but requires a running docker container acting as the “remote” cache servicesed -e '/--remote_cache=/d' -i .bazelrc
Alternatively, if you have docker installed, you can run
./scion.sh bazel-remoteto start the cache service.
Build
Build only “distributables”, without development and testing tools
make build # or, ... bazel build //:scion # or, ... bazel build //control/cmd/control //router/cmd/router <...>
Build all
make build-dev # or, ... make # or, ... bazel build //:scion //:scion-ci
Build packages for debian (all target architectures)
make dist-deb # or, ... bazel build //dist:deb_all
Build packages for openwrt (x86_64 only, currently)
make dist-openwrt # or, ... bazel build //dist:openwrt_all
Options
Bundling the management API documentation with the binaries.
bazel build --//:mgmtapi_bundle_doc=true //:scion
glibc dependency
SCION currently relies on mattn/go-sqlite3, a CGO-based wrapper around SQLite. It is well established, but the CGO dependency complicates the build of static binaries. In typical glibc-based Linux builds, the resulting executable is often dynamically linked and may depend on a minimum glibc version. Fully static binaries are still possible, but require extra tooling.
See also