Environment setup

Scala Native has the following build dependencies:

  • Java 8 or newer
  • sbt 0.13.13 or newer
  • LLVM/Clang 3.7 or newer

And following completely optional runtime library dependencies:

  • Boehm GC 7.6.0 (optional)
  • zlib 1.2.8 or newer (optional)

These are only required if you use the corresponding feature.

Installing sbt

Please refer to this link for instructions for your operating system.

Installing clang and runtime dependencies

Scala Native requires Clang, which is part of the LLVM toolchain. The recommended LLVM version is 3.7 or newer, however, the Scala Native sbt plugin uses feature detection to discover the installed version of Clang so older versions may also work.

Scala Native uses the immix garbage collector by default. You can use the Boehm garbage collector instead, as described here. If you chose to use the Boehm garbage collector both the native library and header files must be provided at build time.

If you use classes from the java.util.zip for compression zlib needs to be installed.

Note

Some package managers provide the library header files in separate -dev packages.

Here are install instructions for a number of operating systems Scala Native has been used with:

macOS

$ brew install llvm
$ brew install bdw-gc # optional

Note: A version of zlib that is sufficiently recent comes with the installation of macOS.

Ubuntu

$ sudo apt install clang
$ sudo apt install libgc-dev # optional

Arch Linux

$ sudo pacman -S llvm clang
$ sudo pacman -S gc # optional

Note: A version of zlib that is sufficiently recent comes with the installation of Arch Linux.

Fedora 26

$ sudo dnf install llvm clang
$ sudo dnf install gc-devel zlib-devel # both optional

FreeBSD

$ pkg install llvm38
$ pkg install boehm-gc # optional

Note: A version of zlib that is sufficiently recent comes with the installation of FreeBSD.

Nix/NixOS

$ wget https://raw.githubusercontent.com/scala-native/scala-native/master/scripts/scala-native.nix
$ nix-shell scala-native.nix -A clangEnv

Continue to Building projects with sbt.