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
Merge pull request #1024 from swiftwasm/maxd/build-host-toolchain
Build host toolchain w/o copying it from snapshots
Currently the host toolchain is copied over to the target WASI toolchain from snapshots downloaded from [swift.org](https://swift.org/download/#snapshots). This is not ideal as snapshots on swift.org are not always fresh and don't always match what we have in the `swiftwasm` branch or even in the upstream `master` branch. This causes issues similar to what can be seen in #1000, where the host toolchain and SDK don't match the target toolchain with this error:
```
error: compiled module was created by an older version of the compiler;
rebuild 'Swift' and try again:
/usr/lib/swift/macosx/Swift.swiftmodule/x86_64-apple-macos.swiftmodule
```
The solution is to:
1) build the host toolchain together with the host SDK and SwiftPM as the first part of the CI process
2) install the host products into the `$SOURCE_PATH/host-toolchain-sdk` directory
3) clean up the build directory
4) build the target SwiftWasm SDK
5) install the target SwiftWasm SDK into the `$SOURCE_PATH/install` directory
6) copy over WASI SDK clang/llvm-ar/wasm-ld into the `$SOURCE_PATH/host-toolchain-sdk` directory
6) copy over the target SwiftWasm SDK into the `$SOURCE_PATH/host-toolchain-sdk` directory
7) create an archive from the `$SOURCE_PATH/host-toolchain-sdk` directory
Thus `build-swiftpm.sh` script is no longer needed as SwiftPM is already compiled as a part of the host toolchain, which also avoids similar issues where SwiftPM from upstream snapshots can also be out of sync from what we build here on CI.
0 commit comments