update llvm and zig version in all locations

This commit is contained in:
Brendan Hansknecht 2023-09-24 18:32:19 -07:00
parent 8e06f22483
commit 077672b058
No known key found for this signature in database
GPG Key ID: 0EA784685083E75B
10 changed files with 43 additions and 35 deletions

View File

@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v3
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.9.1
version: 0.11.0
- name: get the latest release archive for linux (x86_64)
if: startsWith(matrix.os, 'ubuntu')

View File

@ -1 +1 @@
13.0.0
16.0.0

View File

@ -97,13 +97,13 @@ sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
### Zig
**version: 0.9.1**
**version: 0.11.0**
For any OS, you can use [`zigup`](https://github.com/marler8997/zigup) to manage zig installations.
If you prefer a package manager, you can try the following:
- For MacOS, you can install with `brew install zig@0.9.1`
- For MacOS, you can install with `brew install zig@0.11.0`
- For, Ubuntu, you can use Snap, you can install with `snap install zig --classic --beta`
- For other systems, checkout this [page](https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager)
@ -113,15 +113,15 @@ If you want to install it manually, you can also download Zig directly [here](ht
### LLVM
**version: 13.0.x**
**version: 16.0.x**
For macOS, you can install LLVM 13 using `brew install llvm@13` and then adding
`$(brew --prefix llvm@13)/bin` to your `PATH`. You can confirm this worked by
running `llc --version` - it should mention "LLVM version 13.0.1" at the top.
For macOS, you can install LLVM 16 using `brew install llvm@16` and then adding
`$(brew --prefix llvm@16)/bin` to your `PATH`. You can confirm this worked by
running `llc --version` - it should mention "LLVM version 16.0.x" at the top.
You may also need to manually specify a prefix env var like so:
```sh
export LLVM_SYS_130_PREFIX=/usr/local/opt/llvm@13
export LLVM_SYS_160_PREFIX=/usr/local/opt/llvm@16
```
For Ubuntu and Debian:
@ -130,14 +130,14 @@ For Ubuntu and Debian:
sudo apt -y install lsb-release software-properties-common gnupg
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
./llvm.sh 13
./llvm.sh 16
```
If you use this script, you'll need to add `clang` to your `PATH`.
By default, the script installs it as `clang-13`. You can address this with symlinks like so:
By default, the script installs it as `clang-16`. You can address this with symlinks like so:
```sh
sudo ln -s /usr/bin/clang-13 /usr/bin/clang
sudo ln -s /usr/bin/clang-16 /usr/bin/clang
```
There are also alternative installation options at <http://releases.llvm.org/download.html>
@ -161,10 +161,10 @@ If you encounter:
```text
error: No suitable version of LLVM was found system-wide or pointed
to by LLVM_SYS_130_PREFIX.
to by LLVM_SYS_160_PREFIX.
```
Add `export LLVM_SYS_130_PREFIX=/usr/lib/llvm-13` to your `~/.bashrc` or equivalent file for your shell.
Add `export LLVM_SYS_160_PREFIX=/usr/lib/llvm-16` to your `~/.bashrc` or equivalent file for your shell.
### LLVM installation on MacOS
@ -182,14 +182,14 @@ export CPPFLAGS="-I/usr/local/opt/llvm/include"
**Warning** While `cargo build` works on windows, linking roc programs does not yet, see issue #2608. This also means the repl, and many tests will not work on windows.
The official LLVM pre-built binaries for Windows lack features that roc needs. Instead:
1. Download the custom LLVM 7z archive [here](https://github.com/roc-lang/llvm-package-windows/releases/download/v13.0.1/LLVM-13.0.1-win64.7z).
1. Download the custom LLVM 7z archive [here](https://github.com/roc-lang/llvm-package-windows/releases/download/v16.0.6/LLVM-16.0.6-win64.7z).
1. [Download 7-zip](https://www.7-zip.org/) to be able to extract this archive.
1. Extract the 7z file to where you want to permanently keep the folder. We recommend you pick a path without any spaces in it.
1. In powershell, set the `LLVM_SYS_130_PREFIX` environment variable (check [here](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.2#saving-environment-variables-with-the-system-control-panel) to make this a permanent environment variable):
1. In powershell, set the `LLVM_SYS_160_PREFIX` environment variable (check [here](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.2#saving-environment-variables-with-the-system-control-panel) to make this a permanent environment variable):
```text
<# ! Replace YOUR_USERNAME ! #>
$env:LLVM_SYS_130_PREFIX = 'C:\Users\YOUR_USERNAME\Downloads\LLVM-13.0.1-win64'
$env:LLVM_SYS_160_PREFIX = 'C:\Users\YOUR_USERNAME\Downloads\LLVM-16.0.6-win64'
```
Once all that was done, `cargo build` ran successfully for Roc!
@ -217,8 +217,8 @@ Create `~/.cargo/config.toml` if it does not exist and add this to it:
rustflags = ["-C", "link-arg=-fuse-ld=lld", "-C", "target-cpu=native"]
```
Then install `lld` version 13 (e.g. with `$ sudo apt-get install lld-13`)
Then install `lld` version 16 (e.g. with `$ sudo apt-get install lld-16`)
and add make sure there's a `ld.lld` executable on your `PATH` which
is symlinked to `lld-13`.
is symlinked to `lld-16`.
That's it! Enjoy the faster builds.

View File

@ -16,19 +16,19 @@ install-zig-llvm:
ARG ZIG_ARCH
FROM +install-other-libs
# zig
RUN wget -c https://ziglang.org/download/0.9.1/zig-linux-$ZIG_ARCH-0.9.1.tar.xz --no-check-certificate
RUN tar -xf zig-linux-$ZIG_ARCH-0.9.1.tar.xz
RUN ln -s /earthbuild/zig-linux-$ZIG_ARCH-0.9.1/zig /bin/zig
RUN wget -c https://ziglang.org/download/0.11.0/zig-linux-$ZIG_ARCH-0.11.0.tar.xz --no-check-certificate
RUN tar -xf zig-linux-$ZIG_ARCH-0.11.0.tar.xz
RUN ln -s /earthbuild/zig-linux-$ZIG_ARCH-0.11.0/zig /bin/zig
# zig builtins wasm tests
RUN apt -y install build-essential
# llvm
RUN apt -y install lsb-release software-properties-common gnupg
RUN wget https://apt.llvm.org/llvm.sh
RUN chmod +x llvm.sh
RUN ./llvm.sh 13
RUN ln -s /usr/bin/clang-13 /usr/bin/clang
RUN ./llvm.sh 16
RUN ln -s /usr/bin/clang-16 /usr/bin/clang
# use lld as linker
RUN ln -s /usr/bin/lld-13 /usr/bin/ld.lld
RUN ln -s /usr/bin/lld-16 /usr/bin/ld.lld
ENV RUSTFLAGS="-C link-arg=-fuse-ld=lld -C target-cpu=native"
RUN apt -y install libssl-dev
RUN OPENSSL_NO_VENDOR=1 cargo install wasm-pack

View File

@ -12,7 +12,12 @@ let
actualRustVersion = pkgs.rustc;
rustVersionsMatch = pkgs.lib.strings.hasSuffix desiredRustVersion actualRustVersion;
llvmPkgs = pkgs.llvmPackages_13;
# When updating the zig or llvm version, make sure they stay in sync.
# Also update in flake.nix (TODO: maybe we can use nix code to sync this)
zigPkg = pkgs.zig_0_11;
llvmPkgs = pkgs.llvmPackages_16;
llvmVersion = builtins.splitVersion llvmPkgs.release_version;
llvmMajorMinorStr = builtins.elemAt llvmVersion 0 + builtins.elemAt llvmVersion 1;
# nix does not store libs in /usr/lib or /lib
glibcPath =
if pkgs.stdenv.isLinux then "${pkgs.glibc.out}/lib" else "";
@ -48,7 +53,9 @@ in
};
};
LLVM_SYS_130_PREFIX = "${llvmPkgs.llvm.dev}";
shellHook = ''
export LLVM_SYS_${llvmMajorMinorStr}_PREFIX="${llvmPkgs.llvm.dev}"
'';
# required for zig
XDG_CACHE_HOME =
@ -70,7 +77,7 @@ in
llvmPkgs.clang
llvmPkgs.llvm.dev
llvmPkgs.bintools-unwrapped # contains lld
zig_0_9
zigPkg
]);
buildInputs = (with pkgs;

View File

@ -29,6 +29,7 @@
pkgs = import nixpkgs { inherit system overlays; };
# When updating the zig or llvm version, make sure they stay in sync.
# Also update in default.nix (TODO: maybe we can use nix code to sync this)
zigPkg = pkgs.zig_0_11;
llvmPkgs = pkgs.llvmPackages_16;
llvmVersion = builtins.splitVersion llvmPkgs.release_version;

View File

@ -53,7 +53,7 @@ you'll need to install one or more of these platform languages too.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
1. For Zig-based platforms: [download zig 0.9.1](https://ziglang.org/download/0.9.1/zig-linux-x86_64-0.9.1.tar.xz), extract the archive and add export PATH=$PATH:~/path/to/zig to your shell startup script (.profile, .zshrc, …).
1. For Zig-based platforms: [download zig 0.11.0](https://ziglang.org/download/0.11.0/zig-linux-x86_64-0.11.0.tar.xz), extract the archive and add export PATH=$PATH:~/path/to/zig to your shell startup script (.profile, .zshrc, …).
1. Install a C compiler, for apps with C-based platforms:

View File

@ -22,10 +22,10 @@ which includes the Roc compiler and some helpful utilities.
cd roc_night<TAB TO AUTOCOMPLETE>
```
1. Install llvm 13:
1. Install llvm 16:
```sh
brew install llvm@13
brew install llvm@16
```
1. To be able to run the `roc` command anywhere on your system; add the line below to your shell startup script (.profile, .zshrc, ...):
@ -48,7 +48,7 @@ you'll need to install one or more of these platform languages too.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
1. If you'd like to use Zig-based platforms: download [zig 0.9.1](https://ziglang.org/download/0.9.1/zig-macos-aarch64-0.9.1.tar.xz), extract the archive and add `export PATH=$PATH:~/path/to/zig` to your shell startup script (.profile, .zshrc, …). Note: zig 0.9.1 is not available on homebrew.
1. If you'd like to use Zig-based platforms: download [zig 0.11.0](https://ziglang.org/download/0.11.0/zig-macos-aarch64-0.11.0.tar.xz), extract the archive and add `export PATH=$PATH:~/path/to/zig` to your shell startup script (.profile, .zshrc, …). Note: zig 0.11.0 is currently available on homebrew, but future update may remove it.
1. Run examples:

View File

@ -42,7 +42,7 @@ you'll need to install one or more of these platform languages too.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
1. If you'd like to use Zig-based platforms: download [zig 0.9.1](https://ziglang.org/download/0.9.1/zig-macos-x86_64-0.9.1.tar.xz), extract the archive and add `export PATH=$PATH:~/path/to/zig` to your shell startup script (.profile, .zshrc, …). Note: zig 0.9.1 is not available on homebrew.
1. If you'd like to use Zig-based platforms: download [zig 0.11.0](https://ziglang.org/download/0.11.0/zig-macos-x86_64-0.11.0.tar.xz), extract the archive and add `export PATH=$PATH:~/path/to/zig` to your shell startup script (.profile, .zshrc, …). Note: zig 0.11.0 is not available on homebrew.
1. Run examples:

View File

@ -8,8 +8,8 @@ set -euxo pipefail
rustup update
rustup default stable
ZIG_DIRNAME="zig-linux-x86_64-0.9.1"
wget https://ziglang.org/download/0.9.1/${ZIG_DIRNAME}.tar.xz
ZIG_DIRNAME="zig-linux-x86_64-0.11.0"
wget https://ziglang.org/download/0.11.0/${ZIG_DIRNAME}.tar.xz
tar --extract --xz --file=${ZIG_DIRNAME}.tar.xz
PATH="$(pwd)/${ZIG_DIRNAME}:${PATH}"