To get the maximum performance, you'll need to build Cyber from source.
Get the Zig compiler (0.12.0) here:
- Linux x64
- macOS x64
- macOS arm64
- Windows x64
- If you use Zig often, you can use zigup to manage different versions of the compiler.
Once you have zig installed, checkout the repo:
git clone https://github.com/fubark/cyber.git
# Runs all tests.
zig build test
# Runs just the tracing tests.
zig build test-trace
# Test WASM target.
zig build build-test -Doptimize=ReleaseFast -Dtarget=wasm32-wasi
wasm3 zig-out/test/test.wasm
wasm3 zig-out/test/trace_test.wasm
Cyber is optimized for the ReleaseFast build.
# For your native target.
zig build cli -Doptimize=ReleaseFast
# For cross platform build. eg. Host: Linux x64, Target: MacOS arm64
zig build cli -Doptimize=ReleaseFast -Dtarget=aarch64-macos-none
# For a debug build instead.
zig build cli
If all goes well, the Cyber CLI executable will be located in ./zig-out/cyber
.
When using Cyber as a API library, you'll need to build a library instead.
# For your native target.
zig build lib -Doptimize=ReleaseFast
# For cross platform build. eg. Host: Linux x64, Target: MacOS arm64
zig build lib -Doptimize=ReleaseFast -Dtarget=aarch64-macos-none
# For Web/WASM.
zig build lib -Doptimize=ReleaseFast -Dtarget=wasm32-freestanding
You'll find the resulting shared library in ./zig-out/lib
.
-
If you have trouble building mimalloc on MacOS, consider changing the sdk path in
lib/mimalloc/lib.zig
to your installed version. -
On a linux distro with selinux (eg. Fedora), add
-Dselinux
to the zig build commands.