From c090e1729badfcdda072026319814450c293e74c Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 7 Jun 2021 21:51:28 -0400 Subject: [PATCH] Update macOS installation instructions --- BUILDING_FROM_SOURCE.md | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/BUILDING_FROM_SOURCE.md b/BUILDING_FROM_SOURCE.md index 0bbd5fdda8..af1e8b7e0d 100644 --- a/BUILDING_FROM_SOURCE.md +++ b/BUILDING_FROM_SOURCE.md @@ -54,13 +54,15 @@ If you want to install it manually, you can also download Zig directly [here](ht ### LLVM **version: 12.0.x** +For macOS, you can install LLVM 12 using `brew install llvm@12` and then adding +`/usr/local/opt/llvm/bin` to your `PATH`. You can confirm this worked by +running `llc --version` - it should mention "LLVM version 12.0.0" at the top. + For Ubuntu and Debian, you can use the `Automatic installation script` at [apt.llvm.org](https://apt.llvm.org): ``` sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ``` -For macOS, check the troubleshooting section below. - There are also plenty of alternative options at http://releases.llvm.org/download.html ## Using Nix @@ -143,31 +145,15 @@ If you encounter `cannot find -lz` run `sudo apt install zlib1g-dev`. ### LLVM installation on macOS -By default homebrew will try to install llvm 11, which is currently -unsupported. You need to install an older version (10.0.0_3) by doing: - -``` -$ brew edit llvm - -# Replace the contents of the file with https://raw.githubusercontent.com/Homebrew/homebrew-core/6616d50fb0b24dbe30f5e975210bdad63257f517/Formula/llvm.rb - -# we expect llvm-as-10 to be present -$ ln -s /usr/local/opt/llvm/bin/{llvm-as,llvm-as-10} - -# "pinning" ensures that homebrew doesn't update it automatically -$ brew pin llvm -``` +If installing LLVM fails, it might help to run `sudo xcode-select -r` before installing again. It might also be useful to add these exports to your shell: ``` -export PATH="/usr/local/opt/llvm/bin:$PATH" export LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib" export CPPFLAGS="-I/usr/local/opt/llvm/include" ``` -If installing LLVM still fails, it might help to run `sudo xcode-select -r` before installing again. - ### LLVM installation on Windows Installing LLVM's prebuilt binaries doesn't seem to be enough for the `llvm-sys` crate that Roc depends on, so I had to build LLVM from source