Table of Contents

Installing PolyHok 1.1 on Debian-based Linux

This page documents how to install Elixir, Erlang and the necessary compilers and build tools for using PolyHok v1.1 on Debian-based Linux distributions (such as Debian, Ubuntu, Linux Mint etc).

Step 1: Installing asdf

The official asdf documentation explains how to install the tool in great detail, but you can follow these steps for convenience:

  1. Install the required dependencies:
    sudo apt install git bash

  2. Go to the official asdf GitHub releases page and download the latest release for your OS and architecture.

  3. Extract the asdf binary into a folder that is in your $PATH. You can create a folder like ~/.mybins and add it to your path, or simply move the file to /usr/local/bin/.

  4. After this, confirm that asdf is correctly in your $PATH by running:
    type -a asdf
    The output of this command must be the path where you moved the asdf binary.

  5. Add the asdf shims folder to your $PATH. This is mandatory for it to work. Open ~/.bash_profile in a text editor (like nano) and append the following line to the end of the file:
    export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"

  6. (Optional) To enable asdf terminal autocomplete, paste this line below the one you added in the previous step:
    . <(asdf completion bash)

  7. Restart your terminal.
    exec $SHELL

Step 2: Installing Erlang and Elixir with asdf

asdf uses plugins to manage different versions of a tool. Since we want to use Elixir and Erlang, we need to install the appropriate plugins made for them.

  1. Before installing the plugins, however, ensure you have cURL installed. This tool is required by both the Erlang and Elixir plugins to transfer data over the network:
    sudo apt install -y curl

  2. Now we can install the Elixir and Erlang plugins:
    asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git
    asdf plugin add elixir https://github.com/asdf-vm/asdf-elixir.git

  3. List the available Elixir versions and pick one to install:
    asdf list all elixir
    Once you choose an Elixir version, note its corresponding Erlang/OTP version to install. For example, if you pick Elixir 1.19.3-otp-29, you must install Erlang 29.

    Remember: PolyHok requires Elixir v1.17 at minimum to work!

  4. Now that we know which version of Elixir and Erlang/OTP to install, we need to install Erlang first (since Elixir depends on it). First, install the Erlang prerequisites based on your specific OS and version:

    Ubuntu 20.04 LTS
    sudo apt-get -y install build-essential autoconf m4 libncurses5-dev libwxgtk3.0-gtk3-dev libwxgtk-webview3.0-gtk3-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop libxml2-utils libncurses-dev openjdk-11-jdk

    Ubuntu 24.04 LTS
    sudo apt-get -y install build-essential autoconf m4 libwxgtk3.2-dev libwxgtk-webview3.2-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop libxml2-utils libncurses-dev openjdk-11-jdk

    Debian 12 (bookworm)
    sudo apt-get -y install build-essential autoconf m4 libncurses-dev libwxgtk3.2-dev libwxgtk-webview3.2-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop libxml2-utils openjdk-17-jdk

    Debian 13 (trixie)
    sudo apt-get -y install build-essential autoconf m4 libncurses-dev libwxgtk3.2-dev libwxgtk-webview3.2-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop libxml2-utils openjdk-21-jdk

    If your OS is not listed here, please check the official Erlang asdf plugin documentation on GitHub.

  5. Now that we have the prerequisites, install Erlang using asdf (adjust the version number to match your choice):
    asdf install erlang 29.0
  6. Now it's Elixir turn. First, ensure you have installed unzip (required by the Elixir plugin) and install Elixir:
    sudo apt install -y unzip
    asdf install elixir 1.19.3-otp-29
  7. Now we will set these installations as the global defaults, so commands like iex, mix, and elixir will route to these versions anywhere on your terminal:
    asdf set --home erlang 29.0
    asdf set --home elixir 1.19.3-otp-29

Step 3: Installing Backend Requirements

Now that Elixir and Erlang are installed and configured, the final step is to install the dependencies required for your chosen PolyHok backend. The steps below are tagged according to your desired backend.



  1. (OpenCL & CUDA) Install the Erlang development library and CMake:
    sudo apt install -y erlang-dev cmake

  2. (OpenCL-only) Install clinfo to view your machine's OpenCL platforms and configurations:
    sudo apt install -y clinfo

  3. (CUDA-only) Install the CUDA toolkit, which contains the drivers, libraries, and compiler (nvcc) needed to compile and link the NIFs for the CUDA backend. Follow the official NVIDIA Linux installation guide and you will be ready to go!

  4. (OpenCL-only) You must have an OpenCL implementation available for your GPU. You can either install the proprietary driver from your GPU manufacturer or the Mesa OpenCL driver. To install the Mesa driver, run:
    sudo apt install -y mesa-opencl-icd

    After installation, enable the modern Rust implementation (rusticl) by adding the following to your ~/.bashrc:
    export RUSTICL_ENABLE='radeonsi'

    To prevent conflicts and ensure only Rusticl is active, disable Mesa's legacy Clover backend:
    sudo mv /etc/OpenCL/vendors/mesa.icd /etc/OpenCL/vendors/mesa.icd.disabled

    Warning: The value 'radeonsi' enables rusticl for AMD GPUs. If you use a different manufacturer, check the Mesa documentation for the correct environment variable value.

  5. (OpenCL-only) Lastly, install the OpenCL development headers and libraries for C/C++:
    sudo apt install -y ocl-icd-opencl-dev opencl-c-headers opencl-clhpp-headers
    Now you are ready to go!