You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -49,41 +49,57 @@ as well as to the `--help` text for each tool.
49
49
50
50
> 💡 If you are a member of Nextstrain team, then you don't need a fork and you can contribute directly to the origin repository. Still, in most cases, please submit pull requests for review, rather than pushing changes to major branches directly.
51
51
52
-
2. Install Rust if not already (once) ([https://www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install)):
52
+
2. Install build dependencies (once)
53
53
54
-
This step is the same as for Nextclade CLI (see above). You can skip this step if you've done the setup for Nextclade CLI already.
Install Xcode Command Line Tools (provides compiler and linker):
55
68
56
-
The only supported Rust version is the one declared in [`rust-toolchain.toml`](https://github.com/nextstrain/nextclade/blob/master/rust-toolchain.toml). It may change in the future.
The only supported Rust version is the one declared in [`rust-toolchain.toml`](https://github.com/nextstrain/nextclade/blob/master/rust-toolchain.toml) (currently **1.92.0**).
57
78
58
79
```bash
59
-
#[once] Install Rustup, the Rust version manager
80
+
# Install Rustup, the Rust version manager
60
81
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
61
-
62
-
#[once] Add Rust tools to the $PATH
82
+
83
+
# Add Rust tools to the $PATH
63
84
export PATH="$PATH:$HOME/.cargo/bin"
64
-
65
-
# [once] [Linux only] install openssl and pkgconfig. Example for Ubuntu:
66
-
sudo apt-get update
67
-
sudo apt-get install --yes libssl-dev pkg-config
68
-
69
-
# Check your installed versions of Rust compiler, Cargo and Rustup
70
-
$ rustc -V
71
-
$ cargo -V
72
-
$ rustup -V
85
+
86
+
# Check your installed versions
87
+
rustc -V
88
+
cargo -V
89
+
rustup -V
73
90
```
74
91
75
92
> ⚠️ Nextclade team doesn't have bandwidth to support Rust installations deviating from the [officially recommended steps](https://doc.rust-lang.org/book/ch01-01-installation.html) and Rust versions different from what is declared in [rust-toolchain.toml](https://github.com/nextstrain/nextclade/blob/master/rust-toolchain.toml). If you install Rust from Linux package repositories, Homebrew, Conda etc., things may or may not work, or they may work but produce wrong results. Nextclade team doesn't have bandwidth to try every platform and config, so if you decide to go unofficial route, then you are on your own. But feel free to open pull requests if fixes are necessary to make your setup work.
76
93
77
94
> 💡 Note, Rustup allows to install multiple versions of Rust and to switch between them. This repository contains a [rust-toolchain.toml](https://github.com/nextstrain/nextclade/blob/master/rust-toolchain.toml) file, which describes which version of Rust is currently in use by Nextclade official build. Cargo and Rustup should be able to [pick it up automatically](https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file), install the required toolchain and use it when you type`cargo` commands. Any other versions of Rust toolchain are not supported.
78
95
79
-
3. Prepare environment variables (once). They configure Nextclade build-time settings. Optionally adjust the variables in the `.env` file to your needs.
96
+
4. Prepare environment variables (once). They configure Nextclade build-time settings. Optionally adjust the variables in the `.env` file to your needs.
80
97
81
98
```bash
82
-
# [once] Prepare dotenv file with default values
83
99
cp .env.example .env
84
100
```
85
101
86
-
4. Build and run Nextclade CLI in debug mode (convenient fordevelopment - faster to build, slow to run, has more debug infoin the executable, error messages are more elaborate):
102
+
5. Build and run Nextclade CLI in debug mode (convenient fordevelopment - faster to build, slow to run, has more debug infoin the executable, error messages are more elaborate):
87
103
88
104
```bash
89
105
# (Re-)build Nextclade in debug mode.
@@ -117,7 +133,7 @@ as well as to the `--help` text for each tool.
117
133
118
134
> 💡 Add `-v` to Nextclade arguments to make console output more verbose. Add more occurrences, e.g. `-vv`, for even more verbose output.
119
135
120
-
5. Build and run Nextclade CLI in release mode (slow to build, fast to run, very little debug info):
136
+
6. Build and run Nextclade CLI in release mode (slow to build, fast to run, very little debug info):
121
137
122
138
```bash
123
139
# Build Nextclade in release mode.
@@ -162,92 +178,118 @@ Note that there is no actual programmable backend server. Nextclade Web is a sta
162
178
163
179
> 💡 If you are a member of Nextstrain team, then you don't need a fork and you can contribute directly to the origin repository. Still, in most cases, please submit pull requests for review, rather than pushing changes to branches directly.
164
180
165
-
2. Install Node.js (once), by either downloading it from the official website: [nodejs.org](https://nodejs.org), or by using [nvm](https://github.com/nvm-sh/nvm).
181
+
2. Install Node.js and Bun (once)
166
182
167
-
The only supported Node.js version is the one that is currently declared in the [`.nvmrc`](https://github.com/nextstrain/nextclade/blob/master/.nvmrc) file. It may change in the future.
183
+
The only supported Node.js version is the one declared in [`.nvmrc`](https://github.com/nextstrain/nextclade/blob/master/.nvmrc) (currently **22.16.0**).
168
184
169
-
If you have `nvm` installed and configured, you can quickly install and switch to this Node.js version by navigating to the root of nextclade repository (where the [`.nvmrc`](https://github.com/nextstrain/nextclade/blob/master/.nvmrc) file is) and running:
185
+
Install Node.js from [nodejs.org](https://nodejs.org), or using [nvm](https://github.com/nvm-sh/nvm):
170
186
171
187
```bash
172
188
cd nextclade/
173
189
nvm install
174
190
nvm use
175
191
node --version
176
-
bun --version
177
192
```
178
193
179
-
Install Bun if you don't have it ([https://bun.sh](https://bun.sh)):
194
+
Install Bun (version **1.2.14** recommended) from [bun.sh](https://bun.sh):
180
195
181
196
```bash
182
197
curl -fsSL https://bun.sh/install | bash
198
+
bun --version
183
199
```
184
200
185
201
> ⚠️ Nextclade team doesn't have bandwidth to support Node.js installations from Linux package repositories, Homebrew, Conda, as well as versions of Node.js which are not the same as the one currently declared in the [`.nvmrc`](https://github.com/nextstrain/nextclade/blob/master/.nvmrc), and everything else deviating from the recommended setup. If you decide to go that route - things may or may not work - you are on your own. But feel free to open pull requests if fixes are necessary to make your setup work.
186
202
187
-
3. Install Rust if not already (once) ([https://www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install)):
203
+
3. Install Rust and build dependencies (once)
188
204
189
-
This step is the same as for Nextclade CLI (see above). You can skip this step if you've done the setupforNextclade CLI already.
205
+
Follow the same steps as for Nextclade CLI (see above). If you've already set up for CLI development, you can skip this step.
190
206
191
-
The only supported Rust version is the one declared in [`rust-toolchain.toml`](https://github.com/nextstrain/nextclade/blob/master/rust-toolchain.toml). It may change in the future.
207
+
4. Install LLVM/Clang toolchain (once)
192
208
193
-
```bash
194
-
# [once] Install Rustup, the Rust version manager
195
-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
196
-
197
-
# [once] Add Rust tools to the $PATH
198
-
export PATH="$PATH:$HOME/.cargo/bin"
199
-
200
-
# [once] [Linux only] install openssl and pkgconfig. Example for Ubuntu:
201
-
sudo apt-get update
202
-
sudo apt-get install --yes libssl-dev pkg-config
203
-
204
-
# Check your installed versions of Rust compiler, Cargo and Rustup
205
-
$ rustc -V
206
-
$ cargo -V
207
-
$ rustup -V
208
-
```
209
+
LLVM/Clang is required for compiling Rust code to WebAssembly. Version **13** is used in the official build environment.
209
210
210
-
> ⚠️ Nextclade team doesn't have bandwidth to support Rust installations deviating from the [officially recommended steps](https://doc.rust-lang.org/book/ch01-01-installation.html) and Rust versions different from what is declared in [rust-toolchain.toml](https://github.com/nextstrain/nextclade/blob/master/rust-toolchain.toml). If you install Rust from Linux package repositories, Homebrew, Conda etc., things may or may not work, or they may work but produce wrong results. Nextclade team doesn't have bandwidth to try every platform and config, so if you decide to go unofficial route, then you are on your own. But feel free to open pull requests if fixes are necessary to make your setup work.
211
+
<details>
212
+
<summary>🐧 Linux (Ubuntu/Debian)</summary>
211
213
212
-
> 💡 Note, Rustup allows to install multiple versions of Rust and to switch between them. This repository contains a [rust-toolchain.toml](https://github.com/nextstrain/nextclade/blob/master/rust-toolchain.toml) file, which describes which version of Rust is currently in use by Nextclade official build. Cargo and Rustup should be able to [pick it up automatically](https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file), install the required toolchain and use it when you type`cargo` commands. Any other versions of Rust toolchain are not supported.
4. Prepare environment variables (once). They configure Nextclade build-time settings. Optionally adjust the variables in the `.env` file to your needs.
Set the following environment variables before invoking `bun wasm-prod`:
234
+
235
+
```bash
236
+
export CC=/opt/homebrew/opt/llvm/bin/clang
237
+
export AR=/opt/homebrew/opt/llvm/bin/llvm-ar
238
+
```
239
+
240
+
</details>
241
+
242
+
5. Prepare environment variables (once). They configure Nextclade build-time settings. Optionally adjust the variables in the `.env` file to your needs.
215
243
216
244
```bash
217
245
cp .env.example .env
218
246
```
219
247
220
-
5. Install other required tools (once)
248
+
6. Install WebAssembly toolchain (once)
249
+
250
+
The following versions are pinned for build reproducibility:
251
+
252
+
| Tool | Version |
253
+
|------|---------|
254
+
| wasm-pack | 0.13.1 |
255
+
| wasm-bindgen-cli | 0.2.106 |
256
+
| binaryen | 125 |
221
257
222
258
```bash
223
-
cargo install wasm-pack --locked
259
+
# Install wasm-pack
260
+
cargo install wasm-pack@0.13.1 --locked
261
+
262
+
# Install wasm-bindgen-cli (must match the version in Cargo.toml)
263
+
cargo install wasm-bindgen-cli@0.2.106 --locked
264
+
265
+
# Add WebAssembly compilation target
266
+
rustup target add wasm32-unknown-unknown
224
267
```
225
268
226
269
<details>
227
-
<summary>🍏 Extra requirements for macOS [click to expand]</summary>
270
+
<summary>🐧 Install binaryen on Linux</summary>
228
271
229
-
> For macOS, you will also have to install llvm:
230
-
>
231
-
>```bash
232
-
> brew install llvm
233
-
>```
234
-
>
235
-
> Furthermore, you will need to set the following environment variables before invoking `bun wasm-prod`:
236
-
>
237
-
>```bash
238
-
>export CC=/opt/homebrew/opt/llvm/bin/clang
239
-
>export AR=/opt/homebrew/opt/llvm/bin/llvm-ar
240
-
>```
272
+
```bash
273
+
# Ubuntu/Debian (version may differ)
274
+
sudo apt-get install binaryen
241
275
242
-
</details>
276
+
# Or download pinned version (recommended):
277
+
export BINARYEN_VERSION="125"
278
+
curl -sSL "https://github.com/WebAssembly/binaryen/releases/download/version_${BINARYEN_VERSION}/binaryen-version_${BINARYEN_VERSION}-x86_64-linux.tar.gz" | sudo tar -C /usr/local -xz --strip-components=1
279
+
```
243
280
244
-
You might also have to install a particular version of `wasm-bindgen-cli` (if you get an error during `bun wasm-prod`):
281
+
</details>
245
282
246
-
```bash
247
-
cargo install wasm-bindgen-cli@0.2.106 --locked
248
-
```
283
+
<details>
284
+
<summary>🍏 Install binaryen on macOS</summary>
285
+
286
+
```bash
287
+
brew install binaryen
288
+
```
289
+
290
+
</details>
249
291
250
-
6. Install NPM dependencies (once)
292
+
7. Install NPM dependencies (once)
251
293
252
294
```bash
253
295
cd packages/nextclade-web
@@ -256,7 +298,7 @@ Note that there is no actual programmable backend server. Nextclade Web is a sta
256
298
257
299
> ⚠️ Nextclade uses `bun` to manage NPM dependencies. While you could try `npm` or other tools instead, we don't support this.
258
300
259
-
7. Build the WebAssembly module
301
+
8. Build the WebAssembly module
260
302
261
303
```bash
262
304
cd packages/nextclade-web
@@ -267,7 +309,7 @@ Note that there is no actual programmable backend server. Nextclade Web is a sta
267
309
268
310
Repeat this step every time you are changing Rust code.
269
311
270
-
8. Build and serve the development version of the web app locally
312
+
9. Build and serve the development version of the web app locally
271
313
272
314
We are going to run a development web server, which runs continuously (it does not yield terminal prompt until you stop it). It's convenient to do it in a separate terminal instance from WebAssembly module build to allow rebuilding the app and the module independently.
273
315
@@ -282,7 +324,7 @@ Note that there is no actual programmable backend server. Nextclade Web is a sta
282
324
283
325
Note that changes in Rust code (the algorithms) are not picked up automatically and the requirement rebuilding the WebAssembly module manually (as explained above). Once you rebuild the WebAssembly module in a separate terminal instance, the dev server should pick up the changes in the algorithms - no dev server restart is necessary.
284
326
285
-
9. Build and serve the production version of the web app locally
327
+
10. Build and serve the production version of the web app locally
286
328
287
329
Alternatively, the optimized ("production") version of the web app can be built and (optionally) served with
0 commit comments