Skip to content

Reference

Platforms

Brine runs on Linux, macOS and Windows, on x86-64 and 64-bit ARM. Every platform has a prebuilt compiler and needs a C compiler (gcc or clang; MinGW on Windows). Dev builds go straight to machine code on Linux and Windows; macOS builds go through C for now. GPU offload works with NVIDIA GPUs on Linux and Windows and with Apple GPUs on macOS, with nothing to install beyond the driver. Programs can also be compiled to WebAssembly, for WASI runtimes and browsers.

Platform Prebuilt Release archive Native dev builds Debug builds GPU
Linux x86-64 ✅ brine-linux-x64 ✅ native + DWARF NVIDIA (CUDA)
Linux ARM64 ✅ brine-linux-arm64 ✅ native + DWARF NVIDIA (CUDA)
Windows x86-64 ✅ brine-windows-x64 ✅ native + DWARF NVIDIA (CUDA)
macOS Apple silicon ✅ brine-macos-arm64 via C C with #line Apple GPU (Metal)
macOS Intel ✅ brine-macos-x64 via C C with #line –
  • Prebuilt: the installers and the releases page have a binary, with SHA256SUMS and build provenance. CI builds and tests Brine on all five on every change, and the compiler builds itself to a fixed point on each.
  • Native dev builds: the compiler writes x86-64 or AArch64 machine code itself, so dev builds take a fraction of a second (the whole compiler builds in under one). “Via C” means dev builds go through the C compiler at -O2 instead: same results, slower builds. --release always goes through C, on every platform. See Builds, backends and performance.
  • Debug builds: on native platforms gdb and lldb see Brine names, lines and types; through C they see #line positions and C variable names. See Debugging.
  • GPU: see GPU support.

Windows on ARM and 32-bit systems have no prebuilt binary. Brine can be built from source wherever there is a 64-bit C11 compiler.

Brine needs a C compiler on every platform, even where dev builds are native: it compiles the runtime (once, then cached), links every program, and compiles every --release build.

Platform Supported Install
Linux gcc or clang your package manager (apt install gcc, dnf install gcc, …)
macOS Apple clang xcode-select --install
Windows MinGW-w64 gcc, or clang winget install LLVM.LLVM or scoop install mingw-winlibs

Brine uses BRINE_CC, then CC, then the first of clang, gcc and cc on your PATH. The C it generates is C11 and needs GCC/Clang extensions (128-bit integers, atomics builtins). MSVC (cl.exe) isn’t supported yet. Programs link against ws2_32 and shell32 on Windows, and libm, libpthread and libdl elsewhere.

Without a C compiler, building fails with E0702; brine check still works. brine doctor shows which compiler Brine found and builds a test program with it.

i128 and u128 use the C compiler’s __int128, which gcc and clang provide on 64-bit targets, as does wasi-sdk’s clang for WebAssembly. All supported platforms are 64-bit, so they work everywhere Brine ships, and in WebAssembly builds too. Their overflow checks always run: the prover itself computes with 128-bit integers, so it never proves them away.

par for, par [...] and par reductions can run on a GPU when the runtime expects that to be faster. Nothing is needed at build time: the program carries the GPU code and loads the driver when it first needs it.

GPU Platforms How Notes
NVIDIA Linux x86-64, Linux ARM64, Windows x86-64 CUDA driver (libcuda.so.1, nvcuda.dll), PTX kernels f64 runs, but GeForce cards run it at a fraction of their f32 speed
Apple (M1 and later) macOS Apple silicon Metal, loaded through the Objective-C runtime no f64 and no recursion on the device: those constructs stay on the CPU
AMD, Intel any – the CPU runs everything; Vulkan support is planned
AMD or Intel GPU in an Intel Mac macOS Intel – Metal is used only on Apple GPUs for now

Without a driver or a device, programs run on the CPU and print the same results. See GPUs for which constructs qualify and how the runtime decides.

brine run --ranks N and the world module work on every platform: ranks talk over TCP, through Winsock on Windows and BSD sockets elsewhere. brine doctor checks that a local port can be reserved.

Every platform can also build WebAssembly. This is new on Brine’s main branch and not in a release yet. brine build --target wasm makes a module for WASI preview 1 (wasm32-wasip1), which brine run and brine test run with Node.js; --target web makes a folder a browser opens.

WebAssembly
Build needs wasi-sdk, found through WASI_SDK_PATH or /opt/wasi-sdk
Run needs Node.js (Brine’s CI uses Node 24), another WASI runtime in BRINE_WASM_RUNNER, or a browser
Code generator C, in every profile
Threads one: par runs in order, with the same results
world one rank
GPU, processes, sockets none
Files the current folder under brine run; none in the browser

os.name() returns "wasi" and os.arch() returns "wasm32". Brine’s CI installs wasi-sdk 34 and Node 24 and runs the WebAssembly tests on Linux, macOS and Windows. See WebAssembly.

The compiler is written in Brine, and its own generated C (bootstrap/brinec.c) builds it from scratch with only a C compiler:

Terminal window
git clone https://github.com/brinelang/brine && cd brine
cc -std=c11 -O2 -fno-strict-aliasing -w -Iruntime bootstrap/brinec.c runtime/brine_rt.c -o brine -lm -lpthread -ldl
./brine build compiler/main.br -o brine2 # brine rebuilding itself

On Windows, use brine.exe and -lws2_32 -lshell32 instead of -lm -lpthread -ldl. On a 64-bit platform without a native backend, every build then goes through C. The runtime has Win32 and POSIX code paths; other POSIX systems may work but aren’t tested.

From the roadmap:

Planned What it brings
Mach-O objects native dev and debug builds on macOS (Apple silicon)
MSVC support in the C backend building with Visual Studio’s compiler on Windows
CodeView debug info debugging in Visual Studio and WinDbg
A built-in linker and a prebuilt runtime builds that need no C toolchain at all
Vulkan compute (SPIR-V kernels) AMD and Intel GPUs, including those in Intel Macs
Threads on WebAssembly (wasi-threads, Web Workers) par running in parallel in WebAssembly builds