8.0 KiB
title, description, section, badge, order, tags, updated
| title | description | section | badge | order | tags | updated | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Getting Started with VoidBuildSystem | Requirements, bootstrap, first vbs project, build and test workflow, output layout, and the concepts behind the tool | Getting Started | v1.0.0 | 1 |
|
2026-12-06 |
Getting Started with VoidBuildSystem
VoidBuildSystem (vbs) is a native C++26 build system and package manager for Void projects. A project is described in ordinary C++ — build.cpp, optional build.profiles.cpp, helpers under build-support/, and a workspace.cpp for multi-package roots — rather than in a separate build language. vbs compiles that description on the host, evaluates it once per profile, lowers a validated action graph, and executes it directly without generating Ninja, Make, or Visual Studio files.
The same binary also resolves dependencies, maintains vbs.lock, writes compilation databases, runs tests, installs and packages products, publishes to a package registry, and can serve editor and build requests from a daemon. Version 1.0.0 is the first release built and packaged by vbs itself.
:::callout{type="info" title="What 1.0.0 covers"}
- Descriptions: C++26
build.cppwith profiles, targets, usage requirements, modules, shaders and install rules. - Execution: hermetic snapshots, direct action execution, local CAS and action cache, remote action cache.
- Packages: SemVer solver, context-aware lockfile, Git/path/archive/registry sources, native/CMake/Meson/Conan/pkg-config providers.
- Ecosystem: compile databases,
vbs ide, daemon, test runner, registry service,vbs worker, installers and provenance. - Platforms: Linux is the primary host; Windows targets are built with MinGW-w64 and tested under Wine. macOS is not supported. :::
Requirements
| Requirement | Why |
|---|---|
GCC 16+ with -freflection |
The bootstrap and VoidLibrary use C++26 reflection and contracts |
| CMake 4.0+ and Ninja | Only for bootstrapping vbs; user projects do not need CMake |
| Git | Fetching the pinned VoidLibrary during bootstrap and exact Git dependencies |
| C and C++ toolchain for targets | GCC or Clang are discovered and capability-probed at build time |
The Void development environment provides everything through dev cpp-gcc (GCC 16.2, CMake 4.4, Ninja 1.13, Meson 1.12). On another host, make sure g++, cmake, ninja and git are on PATH. Clang 23 is supported as a target compiler when --compiler clang is selected and clang-scan-deps is available for modules.
:::callout{type="warning" title="Bootstrap compiler is not the target compiler"}
The CMake bootstrap must use GCC 16 with reflection because the description SDK and VoidLibrary are compiled on the host. vbs build --compiler clang selects the compiler for the project's targets; it does not change the host compiler used to build vbs.
:::
Bootstrap the tool
dev cpp-gcc -c cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
dev cpp-gcc -c cmake --build build --parallel 4
dev cpp-gcc -c ctest --test-dir build --output-on-failure
The executable is build/bin/vbs. The bootstrap also builds vbs-registry, vbs_describe, vbs_benchmarks, and the test binaries. Expect eight CTest entries: five VOID_TEST executables plus SDK registration, CLI and description contract checks.
If CMake is available directly in your shell, drop the dev cpp-gcc -c prefix.
Self-host with vbs
Once the bootstrap binary exists, the project's own build.cpp builds VoidLibrary through the native provider and declares every VBS target, with no CMake invocation:
build/bin/vbs test --build-dir build/vbs-stage2 --profile release --jobs 8
build/vbs-stage2/profiles/release/out/bin/vbs --version
For local VoidLibrary development, VBS_VOID_SOURCE_DIR=/path/to/VoidLibrary substitutes an existing checkout for the VoidLibrary Git dependency only. It never writes to that checkout, and it is a development override rather than a replacement for the pinned revision.
Create and run a project
build/bin/vbs init --dir hello --name hello
cd hello
../build/bin/vbs build
./build/profiles/debug/out/bin/hello
../build/bin/vbs test
vbs init writes a ready-to-build project: build.cpp, a public header, a library source, an application source, a test source, .gitignore, and optionally vbs.deps.toml. The generated project uses CxxStandard::Cxx26, a static library, an executable, and a project.test(...) target.
A first build logs each phase (Config, Toolchain, Eval, Snapshot, Graph, Build) and then each action. A second build with unchanged inputs reports 0 executed, N cached and finishes in milliseconds. vbs test builds the graph and runs every enabled test target, printing PASSED or FAILED for each.
:::tabs
@@tab[Use a local vbs]
vbs build
vbs test
@@tab[Use the bootstrap binary]
../build/bin/vbs build
../build/bin/vbs test
@@tab[Pick a profile and target]
vbs build --profile release --target hello
vbs test --profile release --target hello_tests
:::
What the build produces
The build directory defaults to <project>/build. Each profile is isolated:
build/
├── .vbs/ # state, CAS, descriptor cache, probes, snapshots
├── compile_commands.json # active editor compilation database
└── profiles/
└── debug/
├── compile_commands.json
├── editor/ # immutable editor generations and status
├── gen/ # generated headers and code
├── obj/ # object files, BMIs, PCHs, per target
├── rsp/ # response files when needed
└── out/
├── libhello_lib.a
└── bin/
├── hello
└── hello_tests
Windows targets use PE names: executables get .exe, shared libraries get .dll, and archives keep the .a convention. A shared library on Linux is written as out/lib<name>.so.
build/.vbs is the local content-addressed state: compiled descriptor executables, toolchain probes, immutable input snapshots, the action database (SQLite when available, durable JSON otherwise), and CAS blobs. vbs clean removes profile outputs while preserving that cache; vbs clean --all removes the entire build root.
Core concepts
:::cards @@card[Build description|href=/build-system/consumer/build-descriptions|badge=model] Targets, profiles and usage requirements are compiled C++26, evaluated out-of-process per profile. @@card[Dependencies|href=/build-system/consumer/dependencies|badge=packages] Declare sources in C++ or TOML; resolve, lock, fetch and import them as typed targets. @@card[Command reference|href=/build-system/consumer/command-reference|badge=CLI] Every command, flag, environment variable and build-tree convention in one place. @@card[Editors|href=/build-system/consumer/editors|badge=IDE] A real compilation database, editor presets, a CMake File API shim and a daemon protocol. :::
When something fails
vbs doctorreports host compilers, optional tools, and which VBS backends were compiled in. Its exit code is non-zero when a required tool is missing.- Description errors are reported with the failing
build.cppcontext; no project package is resolved while compiling the description. - Lock errors say which context and declaration fingerprint changed. Use
vbs deps resolveafter intentional declaration changes, orvbs build --lockedin CI to forbid silent updates. - Cache problems are conservative: corrupted blobs and interrupted staging are recovered by
vbs gc, and a missing or invalid cache entry causes a rebuild rather than stale output.
Next: declare targets and profiles, then add dependencies.