NativeLink
Getting StartedOther build systems

BuildStream

Configure BuildStream to use NativeLink for artifact storage and remote execution.

BuildStream can use a Remote Execution API backend for artifact storage, Action Cache, CAS, and remote execution. NativeLink can serve those endpoints from the same localhost:50051 listener used by the other local examples.

The repo includes a runnable BuildStream integration test at integration_tests/buildstream/. It starts NativeLink with a local worker, runs bst build hello.bst, and checks for SUCCESS Build.

Use a config that exposes CAS, Action Cache, execution, capabilities, ByteStream, fetch, and push services on localhost:50051.

The integration test uses integration_tests/buildstream/buildstream_cas.json5. It also starts a private worker API on localhost:50061 for the local worker.

nativelink -- integration_tests/buildstream/buildstream_cas.json5

Configure BuildStream

Add a BuildStream config file that points artifact storage and remote execution services at NativeLink:

cachedir: /tmp/buildstream

artifacts:
  servers:
  - url: http://localhost:50051
    push: true

remote-execution:
  execution-service:
    url: http://localhost:50051
  action-cache-service:
    url: http://localhost:50051
  storage-service:
    url: http://localhost:50051

The checked-in integration test uses the same settings in integration_tests/buildstream/buildstream.conf.

Configure a project

A minimal BuildStream project needs a project name, a supported BuildStream version, and an element directory:

name: first-project
min-version: 2.4
element-path: elements

aliases:
  alpine: https://bst-integration-test-images.ams3.cdn.digitaloceanspaces.com/

The integration test uses this shape in integration_tests/buildstream/project.conf.

Add an element

This small element stages local source files and runs a build command:

kind: manual
description: |
  Building manually

depends:
- base.bst

sources:
  - kind: local
    path: files/src

config:
  build-commands:
  - echo hello.c

See integration_tests/buildstream/elements/hello.bst for the complete test element.

Run a build

Run BuildStream with the config file:

bst -c buildstream.conf build hello.bst

The integration test checks for SUCCESS Build in the BuildStream output and checks that NativeLink did not log an error.

Troubleshooting

  • BuildStream cannot connect. Match the http://localhost:50051 endpoint in buildstream.conf to the NativeLink listener. The local test uses an insecure HTTP URL.
  • Uploads are missing. Set push: true under artifacts.servers so BuildStream can write artifacts back to NativeLink.
  • Remote actions do not match a worker. Compare the platform properties BuildStream requests with the properties your NativeLink worker advertises. The integration test worker advertises ISA: x86-64.

On this page