Skip to content

Commit e720f2f

Browse files
Update installation
1 parent 0dcbaf8 commit e720f2f

File tree

1 file changed

+23
-73
lines changed

1 file changed

+23
-73
lines changed

src/getting-started/setup.md

Lines changed: 23 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
To install Swift for WebAssembly toolchain, download one of the packages below and follow the instructions for your operating system.
44

5-
## Releases
5+
## Latest Release
66

7-
### SwiftWasm 5.9
7+
**SwiftWasm 5.9**
88

99
Tag: [swift-wasm-5.9.1-RELEASE](https://github.com/swiftwasm/swift/releases/tag/swift-wasm-5.9.1-RELEASE)
1010

@@ -20,108 +20,58 @@ Tag: [swift-wasm-5.9.1-RELEASE](https://github.com/swiftwasm/swift/releases/tag/
2020

2121
You can download the latest development snapshot from [the Releases page](https://github.com/swiftwasm/swift/releases)
2222

23+
## Toolchain Installation
2324

24-
# Using Downloads
25+
### macOS
2526

26-
## macOS
27-
28-
An Xcode toolchain (`.xctoolchain`) includes a copy of the compiler, linker, and other related tools needed to provide a cohesive development experience for working in a specific version of Swift.
29-
30-
31-
### Requirements
32-
33-
- macOS 10.15 or later
34-
35-
36-
### Installation
37-
38-
1. [Download the latest package release](https://book.swiftwasm.org/getting-started/setup.html#swiftwasm-57) according to your CPU architecture (arm64 for [Apple Silicon Macs](https://support.apple.com/en-us/HT211814), x86 for Intel Macs).
27+
1. [Download the latest package release](#latest-release) according to your CPU architecture (arm64 for [Apple Silicon Macs](https://support.apple.com/en-us/HT211814), x86 for Intel Macs).
3928
2. Run the package installer, which will install an Xcode toolchain into `/Library/Developer/Toolchains/`.
40-
3. To use the Swift toolchain with command-line tools, use `xcrun --toolchain swiftwasm` or add the Swift toolchain to your path as follows:
29+
3. To use the Swift toolchain with command-line tools, use `env TOOLCHAINS=swiftwasm swift` or add the Swift toolchain to your path as follows:
4130

4231
```bash
43-
export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"
32+
export PATH=/Library/Developer/Toolchains/<toolchain name>.xctoolchain/usr/bin:"${PATH}"
4433
```
4534

4635
4. Run `swift --version`. If you installed the toolchain successfully, you can get the following message.
4736

4837
```bash
4938
$ swift --version
39+
# Or TOOLCHAINS=swiftwasm swift --version
5040
SwiftWasm Swift version 5.9.1 (swiftlang-5.9.1)
5141
Target: x86_64-apple-darwin21.6.0
5242
```
5343

54-
> Warning: `xcrun` finds executable binary based on `--toolchain` option or `TOOLCHAINS` environment variable, but it also sets `SDKROOT` as host target SDK (e.g. `MacOSX.sdk`). So you need to specify `-sdk` option as `/Library/Developer/Toolchains/swift-wasm-5.9.1-RELEASE.xctoolchain/usr/share/wasi-sysroot` when launching `swiftc` from xcrun. `swift build` or other SwiftPM commands automatically find SDK path based on target triple, so they don't require to specify it.
55-
56-
5744
## Linux
5845

59-
Packages for Linux are tar archives including a copy of the Swift compiler, linker, and related tools. You can install them anywhere as long as the extracted tools are in your PATH.
46+
1. [Download the latest package release](#latest-release) according to your Ubuntu version and CPU architecture.
47+
2. Follow the official Swift installation guide for Linux from [swift.org](https://www.swift.org/install/linux/#installation-via-tarball) while skipping GPG key verification, which is not provided for SwiftWasm releases.
6048

61-
### Requirements
49+
<!--- TODO: Update the link and uncomment after releasing 5.9.2
50+
## Experimental: Swift SDK
6251
63-
- Ubuntu 18.04 or 20.04 (64-bit)
64-
65-
### Installation
66-
67-
1. Install required dependencies:
52+
SwiftWasm provides [Swift SDK](https://github.com/apple/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md)s for WebAssembly. You can use the Swift SDK to cross-compile Swift packages for WebAssembly without installing the whole toolchain.
6853
54+
To use the Swift SDK, you need to install the official Swift toolchain 5.9 or later. Then, you can install the Swift SDK using the following command:
6955
7056
```bash
71-
# Ubuntu 18.04
72-
apt-get install \
73-
binutils \
74-
git \
75-
libc6-dev \
76-
libcurl4 \
77-
libedit2 \
78-
libgcc-5-dev \
79-
libpython2.7 \
80-
libsqlite3-0 \
81-
libstdc++-5-dev \
82-
libxml2 \
83-
pkg-config \
84-
tzdata \
85-
zlib1g-dev
86-
# Ubuntu 20.04
87-
apt-get install \
88-
binutils \
89-
git \
90-
gnupg2 \
91-
libc6-dev \
92-
libcurl4 \
93-
libedit2 \
94-
libgcc-9-dev \
95-
libpython2.7 \
96-
libsqlite3-0 \
97-
libstdc++-9-dev \
98-
libxml2 \
99-
libz3-dev \
100-
pkg-config \
101-
tzdata \
102-
zlib1g-dev
57+
$ swift experimental-sdk install https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.9-SNAPSHOT-2024-03-02-a/swift-wasm-5.9-SNAPSHOT-2024-03-02-a-macos_arm64.artifactbundle.zip
10358
```
10459
105-
2. Download the latest binary release above.
106-
107-
The `swift-wasm-<VERSION>-<PLATFORM>.tar.gz` file is the toolchain itself.
108-
109-
3. Extract the archive with the following command:
60+
After installing the Swift SDK, you can see the installed SDKs using the following command:
11061
11162
```bash
112-
tar xzf swift-wasm-<VERSION>-<PLATFORM>.tar.gz
63+
$ swift experimental-sdk list
64+
<SDK name>
65+
...
11366
```
114-
This creates a usr/ directory in the location of the archive.
11567
68+
You can use the installed SDKs to cross-compile Swift packages for WebAssembly using the following command:
11669
117-
4. Add the Swift toolchain to your path as follows:
118-
119-
```
120-
export PATH=$(pwd)/usr/bin:"${PATH}"
70+
```bash
71+
$ swift build --experimental-swift-sdk <SDK name>
12172
```
12273
123-
You can now execute the swiftc command to build Swift projects.
124-
74+
-->
12575

12676
## Docker
12777

0 commit comments

Comments
 (0)