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

Spin build, for swiftwasm, uses 'swiftc' instead of 'swift build' #2888

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

Spin build, for swiftwasm, uses 'swiftc' instead of 'swift build' #2888

k0pernicus opened this issue Oct 16, 2024 · 2 comments

Comments

@k0pernicus
Copy link

Only for spin with Swift (swiftwasm):

Reproduction:

> spin new swiftwasm_test # uses http-swift
> cd swiftwasm_test
> spin build
Building component swiftwasm-test with `swiftc -target wasm32-unknown-wasi main.swift -o main.wasm`
error: missing external dependency '/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-10-08-a.xctoolchain/usr/lib/swift/wasi/static-executable-args.lnk'
Error: Build command for component swiftwasm-test failed with status Exited(1)

I checked quickly on the Swiftwasm book, and found out that swiftc should not be used to build a WASM component / binary:

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.
Source: https://book.swiftwasm.org/getting-started/troubleshooting.html

So, swift build should be used here instead of swiftc.


Version: spin 2.7.0 (a111517 2024-07-30)
Plugins:

  • cloud 0.9.1 [installed]
  • js2wasm 0.6.1 [installed]
@lann
Copy link
Collaborator

lann commented Oct 16, 2024

Hi @k0pernicus, thanks for the report. We are currently planning to drop support for Swift with Spin 3.0 because of limitations in the Swift toolchain that the 2.7 template is based on.

We'd be very happy to reintroduce/keep support if a newer Swift SDK can be made to work with Spin 3.0 (i.e. the main branch, currently). I wasn't able to get it to work but I have practically zero experience with Swift so it may be possible for someone to do so already.

@k0pernicus
Copy link
Author

Thank you for your response.
I could take a look as I got more and more into Swift "these days", but I can't promise anything.
I will try to look at this in the upcoming weeks.

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