Skip to content

Simplify scripts for static executables

Romain requested to merge nomadic-labs/tezos:romain-static-executables into master

(this MR is based on !6803 (merged))

Context

Static executables are currently built with dune build --profile static $packages followed by dune install $packages, where $packages is the contents of script-inputs/static-binaries. This has some drawbacks:

  • script-inputs/static-binaries is redundant with script-inputs/binaries-for-release
  • if a package of script-inputs/static-binaries contains unreleased executables, they will be published
  • it's redundant with PROFILE=static make

This MR simplifies the scripts that build static executables. It:

  • removes script-inputs/static-binaries
  • introduces make static, equivalent to PROFILE=static make
  • uses make static to build executables (this calls dune build --profile static on executables directly instead of packages, and there is no need to run dune install, as far as I know)

This solves the aforementioned drawbacks.

However, one issue is that script-inputs/binaries-for-releases does not contain experimental executables, and we do want to build static versions of experimental executables for master pipelines and for merge request pipelines. So this MR also:

  • renames script-inputs/binaries-for-release into script-inputs/released-executables
  • adds script-inputs/experimental-executables
  • tweaks the CI to specify which set of executables to use depending on the pipeline

Manually testing the MR

Check the CI. You can download static executables in the static build job artefacts and check that they are statically linked, and that they run.

To check a release pipeline, you can push a version tag to nomadic-labs/tezos. See for instance https://gitlab.com/nomadic-labs/tezos/-/pipelines/702277031 (the last job failed because a release for this version number already exists so that's expected).

You can also try to run the build_static_binaries.sh script yourself, but if you use Debian or Ubuntu you probably do not have the right system dependencies. Instead, you can use Docker:

# run this from the tezos repository root
source scripts/version.sh
docker run --entrypoint /bin/sh -it \
  --mount type=bind,source=$PWD,destination=/home/tezos/host
  registry.gitlab.com/tezos/opam-repository:runtime-build-test-dependencies--$opam_repository_tag

# run this inside Docker
cd host
ARCH=x86_64 EXECUTABLE_FILES='script-inputs/released-executables script-inputs/experimental-executables' scripts/ci/build_static_binaries.sh

This should produce files in octez-binaries/x86_64.

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Romain

Merge request reports