Home

Documentation

Community

Download

Github

Getting Started

Odin is dead-simple to get started with!

Install using Homebrew

brew install odin

Clone or download Odin

Clone the repository (recommended, `git clone https://github.com/gingerBill/Odin`) or download the latest release[1].

1: https://github.com/gingerBill/Odin/releases/latest

Download and include necessary extras

Odin only supports x86-64 at the moment (64-bit) and it relies on LLVM (for code generation) and an external linker.

For Windows...

There's a couple prerequisites here. First, make sure you have Visual Studio installed; you have to compile Odin from source, and Odin also requires `link.exe` from VS anyway. Also, you'll need to download a couple LLVM binaries[2] and move the `bin` folder in that zip file into your Odin directory. These are used internally by the compiler.

2: https://github.com/odin-lang/Odin/releases/tag/llvm-windows

Now, it's time to build Odin and get started! Open the X64 Visual Studio command prompt (if you don't typically use it, here's how to find it[3]) and navigate to the directory where you downloaded Odin. Run the `build.bat` file, and you should have a successfully built Odin compiler!

3: https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs

To use Odin `link.exe` is required to be in the PATH of the callee as mentioned, this can either be achieved but calling Odin from the X64 Visual Studio command prompt or by calling the vcvarsall.bat (with x64 as an argument) script either in your shell or in your build script.

For Mac and *Nix...

For Linux, make sure you have `llvm` and `clang` installed through your package managers. For macOS, make sure you've installed the Xcode command-line tools (`xcode-select --install`), then install LLVM. If you use Homebrew[4], you can run `brew install llvm` to do this.

4: https://brew.sh/

Homebrew will not add LLVM to the PATH, run `echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bash_profile` to add LLVM to your PATH. Then run `source ~/.bash_profile` to update your PATH variable in the current terminal session.

On newer versions of macOS, some headers are not installed by default. Open `macOS_SDK_headers_for_macOS_*.pkg` in `/Library/Developer/CommandLineTools/Packages/`.

Now navigate to the Odin directory in your terminal, use `make` or `./build.sh`, and you should have a newly-built, fresh Odin compiler!

Building Odin

Now, it's time to build Odin and get started!

For Windows...

The easiest way to build Odin is to use the X64 Visual Studio command prompt (if you don't typically use it, here's how to find it[5]). Navigate to the directory where you downloaded Odin. Run the `build.bat` file, and you should have a successfully built Odin compiler!

5: https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs

To use Odin `link.exe` is required to be in the PATH of the callee as mentioned, this can either be achieved but calling Odin from the X64 Visual Studio command prompt or by calling the `vcvarsall.bat` (with x64 as an argument) script either in your shell or in your build script.

For Mac and *Nix...

Navigate to the Odin directory in your terminal, use `make` or `./build.sh`, and you should have a newly-built, fresh Odin compiler!

General Setup

In addition, the following platform-specific steps are necessary:

* Have Visual Studio installed (MSVC 2010 or later, for the linker) * Have a copy of `opt.exe` and `llc.exe` in `Odin/bin`. Pre-built Windows binaries can be found here[6] and *must* be explicitly copied * Open a valid command prompt: * **Basic:** run the `x64 Native Tools Command Prompt for VS2017` shortcut bundled with VS 2017, or * **Advanced:** run `vcvarsall.bat x64` from a blank `cmd` session

6: https://github.com/odin-lang/Odin/releases/tag/llvm-windows

* Have LLVM explicitly installed (`brew install llvm`) * Have XCode installed (version X.X or later, for linking) * Make sure the LLVM binaries and the linker are added to your `$PATH` environmental variable

* Have LLVM installed (opt/llc) * Have Clang installed (version X.X or later, for linking) * Make sure the LLVM binaries and the linker are added to your `$PATH` environmental variable

Updating the compiler

For a compiler that's in-development like Odin, things move fast. Make sure you keep your compiler up-to-date by running `git pull` and then rebuilding every now and then. (or, if you use releases, redownload and rebuild)

What Next?

Why not check out the Odin Overview[7] for more information on the Odin Programming Language!

7: /docs/overview/.gmi