Skip to content

Building from source

David Reed edited this page Nov 20, 2026 · 3 revisions

holyWisp is C11 with no dependencies beyond libc and pthreads. CMake compiles it; the Makefile drives CMake so that each workflow is one command. This page covers the toolchain, the build types, the tests, the lint targets, the zig cross builds and the packages.

Requirements

Tool Version For
CMake 3.20 or newer every build
GCC or Clang GCC 12 or newer; Clang every build. GCC 11 cannot build it: the ChaCha20 and Poly1305 kernels in src/common/aead.c use __builtin_shufflevector, which GCC has from 12
crypt(3) headers libcrypt-dev (Debian, Ubuntu), libxcrypt-devel (Fedora, RHEL) Linux builds: password hashes, linked into the server alone (src/common/sys_linux_crypt.c), so holywisp-client does not need libcrypt to run. forkpty(3) for Twisp comes from glibc's libutil
Ninja any optional. The Makefile uses it when it is on the PATH, Unix Makefiles otherwise; the CMake presets require it
clang-format, clang-tidy 22.1.8, the version CI pins make format, make check-format, make tidy
zig 0.17.1, the version CI pins make npm, make test-windows
Wine any recent make test-windows
Node.js and npm Node 20 or newer make npm, make npm-test
dpkg-deb, fakeroot; rpmbuild, systemd-rpm-macros make deb, make rpm

On Debian or Ubuntu:

sudo apt install build-essential gcc-12 cmake ninja-build libcrypt-dev

Ubuntu 22.04's default gcc is 11; build there with make release CC=gcc-12, as the release workflow does.

On Fedora:

sudo dnf install gcc cmake ninja-build libxcrypt-devel

On macOS, the Xcode command line tools and CMake are enough; crypt(3) and forkpty(3) are part of the system library.

The pinned clang-format, clang-tidy and zig come from PyPI, which is how CI installs them:

pipx install clang-format==22.1.8
pipx install clang-tidy==22.1.8
pipx install ziglang==0.17.1      # installs the command as python-zig

Build

git clone https://github.com/Fracital/holyWisp.git
cd holyWisp
make            # Debug with ASan and UBSan  -> build/debug
make release    # optimised                  -> build/release

Each build directory holds holywisp, holywisp-client, the static libraries (libholywisp.a, libholywisp-client.a, libholywisp-server.a and the WebTransport stack's libhw_*.a) and the test binaries. On the 32-core machine these pages were checked on, make release from a clean tree took 3 seconds.

make (build/debug) make release (build/release)
CMAKE_BUILD_TYPE Debug Release, -O2
Sanitizers AddressSanitizer and UndefinedBehaviorSanitizer none
Exploit mitigations (HW_HARDEN) off on Linux: -fstack-protector-strong, _FORTIFY_SOURCE=2 (unless the compiler or the distribution flags already set it), PIE, -z relro -z now; on macOS the stack protector only
Use it for development and the tests running, benchmarking, packaging

Do not benchmark or deploy a Debug build. In a 256 MiB loopback echo through each, the Debug server relayed 1049 MiB/s and the Release server 2000 MiB/s, and the sanitizers also cost memory.

The build type and the compiler are fixed when a build directory is first configured. To switch compilers, delete the directory first:

rm -rf build/debug
make CC=clang

make clean removes every build tree (build/, node/bin, node/dist).

To install the two binaries under a prefix:

sudo cmake --install build/release --prefix /usr/local
-- Install configuration: "Release"
-- Installing: /usr/local/bin/holywisp-client
-- Installing: /usr/local/bin/holywisp

That installs the binaries only. For the config, the wisp user and the systemd unit, build the packages (below) or follow Install and run.

Makefile targets

make help lists them:

Target What it does
build (the default) Debug build with ASan and UBSan into build/debug
release optimised build into build/release
test build, then every test with ctest
test-release release, then the same tests against it
run build, then run build/debug/holywisp $(ARGS)
run-release release, then run build/release/holywisp $(ARGS)
format clang-format -i over every .c and .h file in include/, src/ and tests/
check-format fail if clang-format would change anything (what CI runs)
tidy clang-tidy over the Debug compile database; runs build first
bench release, then bench/echo and bench/pump into build/bench (Client and benchmarks)
npm the npm package: a static server binary per platform (zig) into node/bin/, the compiled wrapper into node/dist/
npm-test release, then the Node wrapper's tests against build/release/holywisp
test-windows cross-build for Windows with zig into build/win, then run every test_*.exe under Wine
deb, rpm the server and client packages of that kind into build/packages/
packages every package this host can build (.deb, .rpm or both)
clean remove build/, node/bin and node/dist
help this list

Variables you can set on the command line:

Variable Default Meaning
CC cc the C compiler, used when a build directory is first configured
JOBS nproc parallel jobs for the build and for ctest
GENERATOR Ninja if found, else Unix Makefiles CMake generator
CMAKE_FLAGS empty extra -D options for the first configure, for example CMAKE_FLAGS="-DHW_BUILD_TESTS=OFF"
ARGS empty arguments for make run and make run-release
ZIG zig, else python-zig the zig executable
WINE wine the Wine executable
NODE, NPM node, npm for make npm and make npm-test
CLANG_FORMAT, CLANG_TIDY clang-format, clang-tidy the lint tools

A local server from the Debug build, allowed to reach loopback for testing:

make run ARGS="--host 127.0.0.1 --port 7000 --allow-loopback"

CMake directly and the presets

CMakePresets.json has a debug and a release preset, with the same directories and settings as the Makefile. They need Ninja.

cmake --preset release
cmake --build --preset release
ctest --preset release

Or by hand:

cmake -S . -B build/rel -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build/rel

A configure with no CMAKE_BUILD_TYPE builds Release.

Option Default Effect
HW_WERROR ON warnings are errors
HW_SANITIZE OFF ASan and UBSan (the debug preset and make turn it on)
HW_BUILD_TESTS ON build the test binaries and register them with CTest
HW_HARDEN ON exploit mitigations in optimised builds without sanitizers (see the table above)
HW_VERSION_SUFFIX empty appended to what holywisp --version prints, for example +<commit>

The release workflow builds with -DHW_BUILD_TESTS=OFF -DHW_VERSION_SUFFIX=+<12-digit commit>, so a binary from the latest release reports the commit it was built from.

The warning set is -Wall -Wextra -Wpedantic -Wshadow -Wvla -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wwrite-strings -Wundef with -Werror. If a newer compiler than CI's warns and stops your build, -DHW_WERROR=OFF gets you a binary; please report the warning.

Tests

make test           # Debug, under ASan and UBSan
make test-release   # the same tests, optimised

Both run 36 CTest entries: 32 test binaries and four runs of holywisp --check-config (the shipped deploy/holywisp.conf and holywisp.conf.example must pass, a config that breaks a rule across keys must be refused, and so must a policy-file that does not exist). The tail of a passing run (timed before the fourth check was added):

36/36 Test #36: test_client ......................   Passed    1.84 sec

100% tests passed, 0 tests failed out of 36

Total Test time (real) =  85.20 sec

That is make test-release; make test took 118 seconds on the same machine.

Tests What they cover
test_buf, test_map, test_smap, test_wisp, test_ws, test_net, test_loop, test_sys, test_log, test_config, test_dns, test_crypto one codec, container or module each
test_limits, test_filter, test_reputation the limiters, filters and reputation table
test_warp, test_udp_warp WARP tunnel choice and socket marking
test_sha256, test_aead, test_ecc, test_cert, test_tls13, test_quic_wire, test_quic, test_webtransport, test_wt_quic each layer of the WebTransport stack, linked alone
test_e2e, test_e2e_wt the real server against the real client, over WebSocket and over WebTransport
test_security, test_abuse, test_flow, test_client the security suite with real SOCKS5 and HTTP CONNECT proxies, attacks that were found against the server, flow control, and the client against misbehaving servers

The end-to-end tests start their own server on an ephemeral loopback port and their own echo services, and never connect anywhere else. They run one at a time (RUN_SERIAL), because under a parallel ctest they starve each other's threads.

To run one test, or a few by name:

build/debug/test_e2e
ctest --test-dir build/debug -R 'test_(wisp|ws)$' --output-on-failure

Timing problems show up as flakes, not failures, so after a change to the protocol path run the end-to-end binary several times:

for i in 1 2 3 4 5; do build/debug/test_e2e || break; done

test_udp_warp checks socket marks only where the process may set them. To run it with CAP_NET_ADMIN without root, in a user and network namespace:

unshare -Urn sh -c 'ip link set lo up && build/debug/test_udp_warp'

If your GCC has no sanitizer runtime (cannot find -lasan or similar), build the Debug tree with Clang: rm -rf build/debug && make test CC=clang.

Format and tidy

make format         # rewrite every source file in the repo style
make check-format   # what CI runs: fails if format would change anything
make tidy           # clang-tidy; needs the Debug build, which it runs first

Use clang-format 22.1.8: other versions format slightly differently, and on master the format workflow commits a fix-up of anything that differs. The style rules are in STYLE.md, enforced by .clang-format, .clang-tidy and .editorconfig.

Cross builds with zig

cmake/zig-toolchain.cmake uses zig cc as the compiler. zig carries a libc for every target, so one Linux machine builds Linux (static, musl), macOS and Windows binaries. Pass the target as HW_ZIG_TARGET and, if the command is not zig, the executable as HW_ZIG.

A static Linux server and client, which run on any distribution, glibc or musl:

cmake -S . -B build/musl -G Ninja -DCMAKE_BUILD_TYPE=Release -DHW_BUILD_TESTS=OFF \
  -DCMAKE_TOOLCHAIN_FILE=cmake/zig-toolchain.cmake \
  -DHW_ZIG=python-zig -DHW_ZIG_TARGET=x86_64-linux-musl
cmake --build build/musl
file build/musl/holywisp
build/musl/holywisp: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), static-pie linked, with debug_info, not stripped

The targets the npm package uses:

Node platform HW_ZIG_TARGET
linux-x64 x86_64-linux-musl
linux-arm64 aarch64-linux-musl
darwin-x64 x86_64-macos.13.0
darwin-arm64 aarch64-macos.13.0
win32-x64 x86_64-windows-gnu
win32-arm64 aarch64-windows-gnu

make npm

make npm runs npm ci in node/ (the first time, which needs the npm registry for TypeScript), then node/scripts/build.mjs. That builds the server for all six targets in build/npm/<platform>-<arch>/, stripped and without tests, copies each to node/bin/<platform>-<arch>/holywisp (holywisp.exe on Windows), compiles the wrapper into node/dist/ and copies the licence. Then cd node && npm pack makes the tarball.

To build only some targets, or only the wrapper:

node node/scripts/build.mjs --targets linux-x64,darwin-arm64
node node/scripts/build.mjs --no-binaries

A prerelease version in node/package.json, such as a nightly's 0.5.4-nightly.202611110643.g1a2b3c4, becomes the suffix holywisp --version prints. make npm is also the only local check that the macOS code still compiles, since nothing here runs macOS; CI's macOS job runs it.

make npm-test runs the wrapper's tests against build/release/holywisp. After changing either the wrapper or the server's side of what they exchange, run make npm before make npm-test.

make test-windows

make test-windows ZIG=python-zig

This configures build/win with the x86_64-windows-gnu target, builds everything including the tests, and runs each test_*.exe under Wine. It stops at the first failure. Wine has a real Winsock and a real select(), but it is not Windows; CI also runs the same binaries on a Windows runner. Set WINEPREFIX to a directory of your own to keep Wine out of ~/.wine. The first run creates the prefix, which takes a while.

The Windows build has no holywisp-client (the CLI waits for the console and a socket in one poll, which a Windows console cannot do); the library and the tests are built.

Packages

deploy/package.sh builds two packages of each kind: holywisp, the server with the systemd unit and the wisp user, and holywisp-client, the client alone.

make deb                         # or: bash deploy/package.sh deb
make rpm                         # or: bash deploy/package.sh rpm
make packages                    # or: bash deploy/package.sh all

Output goes to build/packages/. On a Fedora 44 host with both dpkg-deb and rpmbuild installed, make packages took 8 seconds and wrote:

holywisp_0.5.4-4_amd64.deb
holywisp-client_0.5.4-4_amd64.deb
holywisp-0.5.4-4.fc44.x86_64.rpm
holywisp-client-0.5.4-4.fc44.x86_64.rpm

The .rpm carries the dist tag of the machine that built it (fc44 here, fc41 in CI) and links that machine's glibc, so build it on the oldest release you want to install it on. CI builds the .deb in a debian:12 container and the .rpm in fedora:41.

Variable Default Meaning
HW_VERSION the project(holyWisp VERSION ...) in CMakeLists.txt package version; ignored unless it starts with a digit
HW_PKG_RELEASE 4 (pkg_release in the script) the .deb revision and the .rpm Release
GENERATOR Ninja CMake generator for the package build
DEB_BUILD_MAINT_OPTIONS hardening=+all passed to dpkg-buildflags

For the .deb, the script builds the binaries in build/pkg. Each package's Depends is read from its binary with objdump (binutils): libc6 (>= X), where X is the newest GLIBC_ symbol version the binary uses, and libcrypt1 (>= 1:4.1.0) only for a binary that links libcrypt, which is the server's alone. Where dpkg-buildflags is installed (Debian, Ubuntu) it adds the flags that gives and strips the debug sections they bring; elsewhere the binaries have the project's own flags only. The .rpm is built by rpmbuild from a source tarball of the working tree under %cmake, which applies the distribution's flags. Both packages are made from the working tree as it is, uncommitted changes included.

After changing the packaging or the unit, check that the sandbox still rates "OK":

systemd-analyze security --offline=true deploy/systemd/holywisp.service
→ Overall exposure level for holywisp.service: 1.3 OK

What the packages install and do is described in Install and run.

Troubleshooting

A compile error in src/common/aead.c that names __builtin_shufflevector: the compiler is GCC 11 or older. Install GCC 12 or later, or use Clang, then rm -rf build/release and build again with CC=gcc-12 or CC=clang.

fatal error: crypt.h: No such file or directory: install libcrypt-dev (Debian, Ubuntu) or libxcrypt-devel (Fedora).

CC=clang has no effect: the build directory was configured earlier with another compiler. Delete it and build again.

make tidy reports unknown check names: your clang-tidy is older than 22.1.8.

make npm stops with build: zig not found: install zig (pipx install ziglang==0.17.1) or set ZIG=/path/to/zig.

make npm fails in npm ci: it needs the npm registry once, for TypeScript and @types/node. After that node/node_modules is reused.

holyWisp builds on Linux, macOS and Windows; <system> has no loop backend or sys.h: the platform is not supported. A port is a loop backend and an implementation of include/holywisp/sys.h; see AGENTS.md.

Clone this wiki locally