Skip to content

Preparation

Requirements

To build and use the compiler you need:

  • The Rust toolchain. The source repository pins the toolchain in rust-toolchain.toml.
  • A C99-compatible compiler named cc, or a compiler selected with CC, when using the C backend.
  • The Ligare standard library. It is shipped with releases and lives at libs/std in a source checkout.

Node.js and pnpm are only needed to work on this documentation site.

Install from a release

Release binaries are published on the GitHub releases page. Unpack ligare, ligls, and the accompanying std directory. Set the standard-library path before invoking the binaries:

bash
export LIGARE_STD_PATH="/absolute/path/to/std"
ligare --version

LIGARE_STD_PATH entries must be absolute paths. Multiple roots may be supplied using the path separator used by the host operating system.

Build from source

From the compiler repository:

bash
cargo build --release
cargo build -p ligls --release
export LIGARE_STD_PATH="$PWD/libs/std"
target/release/ligare --version

Debug builds made from the checkout also search its libs/std directory, so cargo run -- ... normally needs no extra environment variable.

Verify the toolchain

bash
ligare --help
ligare new /tmp/ligare-check
ligare check --manifest-path /tmp/ligare-check/ligare.toml

The last command should report that the generated package was checked.

Editor support

ligls is an LSP server that communicates over standard input and output:

bash
test -x target/release/ligls

Configure an editor to launch that command for .lig files and pass the same LIGARE_STD_PATH environment variable to it. See Editor integration for the important details.

Common setup errors

  • ligare: command not found: add the binary directory to PATH, or invoke the binary by its full path.
  • standard library module not found: set LIGARE_STD_PATH to the directory containing src/lib.lig.
  • C compiler not found: install a C compiler or set CC to its executable.