Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing examples and instructions #25

Open
k0pernicus opened this issue Oct 16, 2024 · 5 comments
Open

Confusing examples and instructions #25

k0pernicus opened this issue Oct 16, 2024 · 5 comments

Comments

@k0pernicus
Copy link

k0pernicus commented Oct 16, 2024

I wanted to use Swift for WASM and found out your book.

After installing the toolchain & Swift-SDK for WASM I found out that the "Hello, world" example does not work because of a

error: missing external dependency '.../usr/lib/swift/wasi/static-executable-args.lnk'

However, in your "Troubleshooting" setting, you explicitly say:

You may encounter this error while building with Swift SDK for WebAssembly and swiftc driver command. Unfortunately, Swift SDK does not support building with swiftc command yet, so you need to use swift build Swift Package Manager command instead.

First question: Does this means the "Hello, world" example is outdated?

After that I created a Swift package, and tried to build it using

swift build --swift-sdk 6.0-SNAPSHOT-2024-10-10-a-wasm32-unknown-wasi
but I had this error:

> Building for debugging...
error: emit-module command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: module compiled with Swift 6.0.3 cannot be imported by the Swift 6.1 compiler: /Users/antonin/Library/org.swift.swiftpm/swift-sdks/swift-wasm-6.0-SNAPSHOT-2024-10-10-a-wasm32-unknown-wasi.artifactbundle/6.0-SNAPSHOT-2024-10-10-a-wasm32-unknown-wasi/wasm32-unknown-wasi/swift.xctoolchain/usr/lib/swift_static/wasi/Swift.swiftmodule/wasm32-unknown-wasi.swiftmodule

Unfortunately my swift version is a 6.1-DEV compiler version:

> which swift
/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-10-08-a.xctoolchain/usr/bin/swift

Second question: Did I missed something in the book to handle this error?

@kateinoigakukun
Copy link
Member

You need to use 6.0 development snapshot toolchain instead of main (6.1) development snapshot.

@k0pernicus
Copy link
Author

Thanks, that solves the 2nd question (problem).

@kateinoigakukun
Copy link
Member

The hello world example seems outdated. It only works with non-Swift SDK installation

@k0pernicus
Copy link
Author

I can work on checking the documentation if you want, and make a PR with some changes based on my experience.
Please let me know if this could be useful for you & community.

@kateinoigakukun
Copy link
Member

Yes, it definitely helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants