Odin Setup

10/29/2023

Odin Install Docs

Getting Started

Clone Odin Repo to your machine

bash
cd ~/downloads
git clone https://github.com/odin-lang/Odin

For Linux

Note: I switched to windows because graphics programming not supported on WSL as of 8/6/2022, meaning I couldn’t use the core:vendor packages.

Install LLVM and Clang stuff if not already installed

bash
# Automatic Install script provided at https://apt.llvm.org/
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh all

LLVM Setup (may not be required for you)

bash
# spent like an hour figuring out this nonsense because my llvm-config defaulted to 10 rather than my newest version of 14
sudo update-alternatives --install 
        /usr/bin/llvm-config       llvm-config      /usr/bin/llvm-config-14  200

Building Odin

bash
cd ~/downloads/Odin
./build_odin.sh

Add Odin to Path

bash
# move to personal bin folder
cd ~/bin
# add symlink of odin exe to bin. bin is already added to path for me
ln -s ~/downloads/Odin/odin odin
# can now type `odin` directly from command line

For Windows

Install Visual Studio if you do not already have it.

Open the x64 Native Tools Command Prompt for VS 2022 as it has the correct environment variables set to build odin.

Navigate to the cloned Odin repo using the x64 Native Tools Command Prompt and run build.bat.

ps1
cd C:/Users/your-username/dev/downloads/odin/Odin
build.bat

Add this Odin directory to your Windows path if you want to use the executable at any directory. Do so by editing system environment variables, double clicking PATH, and adding the full pathname to the Odin directory.

Visit http://odin-lang.org/docs/overview/ to see what’s next

Odin Language Server (ols)

Clone the ols repo and setup

bash
git clone git@github.com:DanielGavin/ols.git
cd ols
# ./build.bat on windows
./build.sh

Install the VS Code Extension

In VS Code add an ols.json at the root directory of your project. Example below. Installing ols plugin may add this automatically.

my-cool-project
    src
        utils
            utils.odin
        main.odin
    gitignore
    ols.json
    README.md

If you want auto completion on things like the core collection or the vendor collection, ols.json will need to be updated to point to point to the directory where those collections are.

json
// ols.json
{
    "collections": [
        {
            "name": "core",
            // path must point to the `core` directory in the Odin repo we cloned
            "path": "/home/sam/downloads/Odin/core"
        }
    ],
    "enable_document_symbols": true,
    "enable_semantic_tokens": false,
    "enable_hover": true,
    "enable_snippets": true
}