From c805cbd149a1e637948aed49d42bb18a6ca558e9 Mon Sep 17 00:00:00 2001 From: "Justin R. Evans" <330911+jurevans@users.noreply.github.com> Date: Tue, 23 May 2023 12:40:02 +0200 Subject: [PATCH] docs: Updating README for building interface on macOS (#289) * Updating docs for building interface on macOS * Adding one note --- README.md | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 5a8c1cfd4af..9dd246aaf68 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,6 @@ for solving possible issue see [Troubleshooting](#troubleshooting) - [Testing](#testing) - [Unit](#unit) - [e2e](#e2e) - - [Troubleshooting](#troubleshooting) ## Introduction @@ -96,12 +95,40 @@ sudo apt-get install -y protobuf-compiler # Install yarn and JS dependencies npm install -g yarn + +# within namada-interface/ base folder: yarn # Install web-ext yarn global add web-ext ``` +#### macOS on Intel and Apple Silicon + +On macOS, when using Apple Silicon architecture, in order to compile some packages for our wasm dependencies, you will need to install +the following: + +``` +xcode-select --install + +# Mac M1/M2 only - install brew's version of llvm +brew install llvm +``` + +Then, in your shell profile (e.g., `~/.zshrc`), export the following environment variables: + +``` +# Mac M1/M2 only +export LDFLAGS="-L/opt/homebrew/opt/llvm/lib" +export CPPFLAGS="-I/opt/homebrew/opt/llvm/include" +export CC=/opt/homebrew/opt/llvm/bin/clang +export AR=/opt/homebrew/opt/llvm/bin/llvm-ar + +# Mac Intel only +export CC=/usr/local/opt/llvm/bin/clang +AR=/usr/local/opt/llvm/bin/llvm-ar +``` + At the root-level, we can issue commands for all packages in the monorepo. Following is an example: ```bash @@ -212,23 +239,3 @@ yarn test #### e2e TBA - -### Troubleshooting - -When running or building the wallet on **MacOS**, it's possible compilation will fail with some error similar to that: - -``` -cargo:warning=error: unable to create target: 'No available targets are compatible with this triple.' -``` - -If that's the case, make sure you have installed both xcode-select and LLVM from brew, then run the command appending the full path of the Custom Compiler(`CC`) and the Archiver tool(`AR`): - -``` -xcode-select --install -brew install llvm - -# M1 -CC=/opt/homebrew/opt/llvm/bin/clang AR=/opt/homebrew/opt/llvm/bin/llvm-ar yarn wasm:build -# Intel -CC=/usr/local/opt/llvm/bin/clang AR=/usr/local/opt/llvm/bin/llvm-ar yarn build -```