Skip to content

Latest commit

 

History

History
105 lines (73 loc) · 2.09 KB

LINK_MAC.md

File metadata and controls

105 lines (73 loc) · 2.09 KB

Mac (M1) Specific Installations

This guide provides a detailed walkthrough on how to link the saito-lite-rust repository to the saito-wasm locally via the saito-js wrapper. This process leverages the npm link command.

Note: The saito-lite-rust (SLR) repository by default comes bundled with the saito-js library in its package.json. If, however, you wish to manually establish this linkage, the instructions below will guide you.

Prerequisites

Before starting, ensure:

Installation Guide

Step 1: Prepare saito-wasm for Linking

1. Navigate to the saito-wasm directory

If you're using a Mac with the M1 chip, follow these additional steps:

2. Set Environment Variables

export CC=/opt/homebrew/opt/llvm/bin/clang

3. Install LLVM: This provides the necessary tools, including clang.

brew install llvm

4. Install wasm-pack: This is a crucial tool for compiling Rust to WebAssembly.

npm i -g wasm-pack

5. Build with wasm pack

CC=/opt/homebrew/opt/llvm/bin/clang AR=/opt/homebrew/opt/llvm/bin/llvm-ar wasm-pack build --target web --out-dir wasm_build/deps/pkg/

6. Install

npm install

7. build

npm run build

8. create a symbolic link for saito-wasm

npm link 

Step 2: Link saito-js to saito-wasm

1. Navigate to the saito-js directory

2. Installation

npm install

3. linking with saito-wasm

npm link saito-wasm

4. build

npm run build

5. create a symbolic link for saito-js

  • Navigate into the dist folder in the saito-js directory
  • Run link command
npm link

Step 3: Link SLR to saito-js

1. Navigate to the SLR directory

2. Install

npm install

3. Link with saito js

npm link saito-js

4. Build and run SLR

npm run go