lus

Compiling Lus

Contents (6)
  1. Installing Dependencies
  2. Building
    1. Build types
    2. Verification
  3. Installation
  4. Embedding Lus

Compiling Lus is a straightforward process. The build produces three artifacts: the lus interpreter, the lusc bytecode compiler, and liblus (a static library for embedding).

You will need the following tools to compile the runtime:

  • The Lus source code, which can be downloaded from its repository.
  • A C compiler (gcc or clang recommended).
  • The Meson build system.
  • OpenSSL development libraries (for HTTPS support)
  • c-ares development libraries (for async DNS)
  • Compression libraries: zlib, zstd, brotli, and lz4 (for vector.archive)
  • A threading library (pthreads; included by default on most systems)
  • readline (macOS) or libedit (FreeBSD/NetBSD/OpenBSD) for the REPL

Installing Dependencies#

# macOS (Homebrew)
brew install openssl c-ares zstd brotli lz4

# Ubuntu/Debian
sudo apt install libssl-dev libc-ares-dev zlib1g-dev libzstd-dev libbrotli-dev liblz4-dev

# Fedora/RHEL
sudo dnf install openssl-devel c-ares-devel zlib-devel libzstd-devel brotli-devel lz4-devel

# FreeBSD/NetBSD/OpenBSD
pkg install openssl c-ares libedit zstd brotli liblz4

# Arch Linux
sudo pacman -S openssl c-ares zlib zstd brotli lz4

# Windows (vcpkg)
vcpkg install openssl c-ares zlib zstd brotli lz4

Building#

git clone https://github.com/lus-lang/lus.git
cd lus/lus
meson setup build
meson compile -C build

The lus interpreter and lusc compiler will be placed in the build directory. The lusc compiler precompiles Lus source files to bytecode.

Build types#

meson setup build --buildtype=release

The default build already enables -O2 and LTO. The release buildtype additionally disables assertions via -DNDEBUG.

Verification#

./build/lus -v
meson test -C build

Tests are organized into four suites: h1 (language integrity), h2 (C API), h3 (system integration), and h4 (benchmarks). You can run a specific suite with:

meson test -C build --suite h1

Installation#

sudo meson install -C build

This installs the lus and lusc executables, headers, and static library to the system prefix (typically /usr/local). Alternatively, copy the binaries manually:

  • On macOS and Linux, you can place them in the /usr/local/bin directory.
  • On Windows, you should create a new directory for Lus and follow these instructions to add it to your system’s PATH.

Embedding Lus#

The build installs the following headers: lua.h, luaconf.h, lualib.h, lauxlib.h, and lua.hpp (C++ wrapper). Use pkg-config to get the correct compiler and linker flags:

pkg-config --cflags --libs lus

Example compilation:

gcc -o myapp myapp.c $(pkg-config --cflags --libs lus) -lm -lpthread

See C API error handling in the Guide for details on using the C API.