Installation
Inko's native code compiler is written in Rust and uses LLVM as its backend. The generated machine code links against a small runtime library, also written in Rust.
This guide covers the steps needed to get Inko installed on your platform of choice.
Supported platforms
Inko supports Linux, macOS, and FreeBSD (13.2 or newer). Inko might also work on other platforms, but we only provide support for the listed platforms.
Inko historically also supported Windows, but we dropped support with the introduction of the native code compiler. Our knowledge of Windows is limited, and the cost of maintaining Windows support isn't worth it. In the future we may support Windows again, providing somebody is willing to maintain the necessary changes.
Requirements
- A 64-bits little-endian platform
- Rust 1.68 or newer
- LLVM 15, with support for static linking against LLVM
- A C compiler such as GCC or clang
- Git, for managing Inko packages
lld is an optional dependency of Inko, and is used automatically on Linux when available.
Installing
Cross-platform
The easiest way to install Inko is to use Inko's own version manager: ivm. ivm supports all the platforms officially supported by Inko.
Info
Don't forget to install the necessary dependencies using your system's package manager, as ivm doesn't do this for you. You can find the list of the necessary packages to install below.
Once ivm is installed, you can install Inko as follows:
ivm install latest
This installs the latest known version. If you want to install a specific
version, run the following instead (where X.Y.Z
is the version you want to
install):
ivm install X.Y.Z
For more details on how to use ivm and switch versions, refer to the ivm guide.
From source
When building from Git, first clone the repository:
git clone https://github.com/inko-lang/inko.git
cd inko
Or use a release tarball:
mkdir 0.11.0
curl https://releases.inko-lang.org/0.11.0.tar.gz -o 0.11.0.tar.gz
tar -C 0.11.0 -xf 0.11.0.tar.gz
cd 0.11.0
You can then compile Inko as follows:
Mode | Command | Executable | Runtime library |
---|---|---|---|
Debug | cargo build |
./target/debug/inko |
./target/debug/libinko.a |
Release | cargo build --release |
./target/release/inko |
./target/release/libinko.a |
In both cases the standard library in std/src
is used. You can customise the
standard library and runtime library paths by setting these environment
variables when running cargo
build:
INKO_STD
: the full path to the directory containing the standard library modules, defaults to./std/src
.INKO_RT
: the full path to the directory containing the runtime libraries to link the generated code against, defaults to./target/MODE
whereMODE
is eitherdebug
for debug builds orrelease
for release builds.
If you are building a package, it's recommended to use the provided Makefile
instead, as this simplifies the process of moving the necessary files in place
and using the right paths. To compile a release build of Inko, run make
and
make install
to install the files. This process can be customised by setting
the following Make variables:
DESTDIR
: the directory to install files into when runningmake install
.PREFIX
: the path prefix to use for all files, defaults to/usr
. When combined withDESTDIR
, the value ofDESTDIR
prefixes this value.
For example:
make PREFIX=/usr/local
make install DESTDIR=./package-root PREFIX=/usr/local
The PREFIX
variable must be set for both the make
and make install
commands, but DESTDIR
is only necessary for make install
.
Linux
The dependencies listed per platform only need to be installed in your development environment. Executables generated by Inko's compiler only need libc and libm to be installed in the deployment environment, which is likely already the case.
Alpine
Warning
Due to this bug in
the llvm-sys crate, compiling the compiler for musl targets (which includes
Alpine) fails with the error "could not find native static library rt
,
perhaps an -L flag is missing?".
There's no official package for Inko in the Alpine repositories.
The compiler dependencies are installed as follows:
sudo apk add build-base rust cargo llvm15 llvm15-dev llvm15-static git
Arch Linux
Two AUR packages are provided: inko
and inko-git
. These can be installed
using your favourite AUR wrapper. For example, using
yay:
yay -S inko
Or manually:
git clone https://aur.archlinux.org/inko.git
cd inko
makepkg -si
The compiler dependencies are installed as follows:
sudo pacman -Sy llvm15 rust git base-devel
Debian
There's no official package for Inko in the Debian repositories.
For Debian 12, the compiler dependencies are installed as follows:
sudo apt-get install --yes rustc cargo git build-essential llvm-15 llvm-15-dev \
libstdc++-11-dev libclang-common-15-dev zlib1g-dev
For Debian 11, the process is a little different as the provided version of LLVM is too old. Installing the necessary dependencies is done as follows:
curl https://apt.llvm.org/llvm-snapshot.gpg.key | \
sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo add-apt-repository \
"deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-15 main"
sudo apt-get update
Now we can install the necessary dependencies:
sudo apt-get install --yes git build-essential llvm-15 llvm-15-dev \
libstdc++-10-dev libclang-common-15-dev zlib1g-dev libpolly-15-dev
The version of Rust provided by Debian 11 is also too old, so you'll need to use rustup to install the required Rust version.
Fedora
Inko isn't included in the Fedora repositories, but there's an official copr repository that you can use as follows:
sudo dnf install dnf-plugins-core
sudo dnf copr enable yorickpeterse/inko
sudo dnf install inko
For version 38 and newer, the compiler dependencies are installed as follows:
sudo dnf install gcc make rust cargo llvm15 llvm15-devel llvm15-static \
libstdc++-devel libstdc++-static libffi-devel zlib-devel git
For version 37, the compiler dependencies are instead installed as follows (note the different LLVM package names):
sudo dnf install gcc make rust cargo llvm llvm-devel llvm-static \
libstdc++-devel libstdc++-static libffi-devel zlib-devel git
Ubuntu
There's no official package for Inko in the Ubuntu repositories.
For Ubuntu 22.04, the compiler dependencies are installed as follows:
sudo apt-get install --yes rustc cargo git build-essential llvm-15 llvm-15-dev \
libstdc++-11-dev libclang-common-15-dev zlib1g-dev
For Ubuntu 20.04, the process is a little different as the provided version of LLVM is too old. Installing the necessary dependencies is done as follows:
curl https://apt.llvm.org/llvm-snapshot.gpg.key | \
sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo add-apt-repository \
"deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main"
sudo apt-get update
Now we can install the necessary dependencies:
sudo apt-get install --yes git build-essential llvm-15 llvm-15-dev \
libstdc++-10-dev libclang-common-15-dev zlib1g-dev libpolly-15-dev
The version of Rust provided by 20.04 is also too old, so you'll need to use rustup to install the required Rust version.
macOS
Inko is available in Homebrew:
brew install inko
The Homebrew formula is maintained by Homebrew and its contributors. For issues specific to the formula (e.g. it doesn't work on a certain version of macOS), please report issues in the homebrew-core issue tracker.
To build from source, install the necessary dependencies as follows:
brew install llvm@15 rust git
When building from source, you may need to add the LLVM bin
directory to your
PATH
as follows:
export PATH="$(brew --prefix llvm@15)/bin:$PATH"
You may also need to set the LIBRARY_PATH
to the LLVM lib
directory, though
this doesn't always appear to be necessary:
export LIBRARY_PATH="$(brew --prefix llvm@15)/lib"
If the zstd library can't be found, even though it's installed, you can use the following instead:
export LIBRARY_PATH="$(brew --prefix llvm@15)/lib:$(brew --prefix zstd)/lib"
FreeBSD
There's no official package for Inko available on FreeBSD.
The compiler dependencies are installed as follows:
sudo pkg install llvm15 rust git
To build from source, run the following command:
LIBRARY_PATH="/usr/local/lib" cargo build
The variable LIBRARY_PATH
is needed as otherwise the linker fails to find the
zstd and libffi libraries, which are needed by LLVM on FreeBSD.
Tip
This variable needs to be set every time you run cargo build
, cargo
test
, etc, so consider exporting it to your shell ahead of time.
Docker
If you are using Docker or Podman, you can use our official Docker/Podman images. These images are published on GitHub.com.
To install a specific version, run the following (replacing X.Y.Z
with the
version you want to install):
docker pull ghcr.io/inko-lang/inko:X.Y.Z
podman pull ghcr.io/inko-lang/inko:X.Y.Z
You can then run Inko as follows:
docker run inko-lang/inko:X.Y.Z inko --version
podman run inko-lang/inko:X.Y.Z inko --version
We also build a container for every commit on the main
branch, provided the
tests are passing. If you like to live dangerously, you can use these as
follows:
docker pull ghcr.io/inko-lang/inko:main
docker run inko-lang/inko:main inko --version
podman pull ghcr.io/inko-lang/inko:main
podman run inko-lang/inko:main inko --version