swiftwasm / carton

📦 Watcher, bundler, and test runner for your SwiftWasm apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Carton does not detect installed Swift versions properly.

jhoughjr opened this issue · comments

According to swiftenv globe swift is wasm-5.4-SNAPSHOT.
According to carton sdk install ..;. but is successfully installed.

jimmyhoughjr@Jimmys-iMac button-webapp % carton sdk install wasm-5.4-SNAPSHOT-2021-07-25-a

  • checking Swift compiler path: /Users/jimmyhoughjr/.carton/sdk/wasm-5.4-SNAPSHOT-2021-07-25-a/usr/bin/swift
  • checking Swift compiler path: /Users/jimmyhoughjr/.swiftenv/versions/wasm-5.4-SNAPSHOT-2021-07-25-a/usr/bin/swift
  • checking Swift compiler path: /Users/jimmyhoughjr/Library/Developer/Toolchains/swift-wasm-5.4-SNAPSHOT-2021-07-25-a.xctoolchain/usr/bin/swift
  • checking Swift compiler path: /Library/Developer/Toolchains/swift-wasm-5.4-SNAPSHOT-2021-07-25-a.xctoolchain/usr/bin/swift
    Inferring basic settings...
  • swift executable: /Library/Developer/Toolchains/swift-wasm-5.4-SNAPSHOT-2021-07-25-a.xctoolchain/usr/bin/swift
    SwiftWasm Swift version 5.4.2-dev (LLVM 4d1cec66bf3ce00, Swift 22ac70b9da4036e)
    Target: x86_64-apple-darwin20.6.0

Parsing package manifest: /Library/Developer/Toolchains/swift-wasm-5.4-SNAPSHOT-2021-07-25-a.xctoolchain/usr/bin/swift package dump-package

SDK successfully installed!
[12:11 PM]
carton dev
[12:11 PM]
Error: Process failed with non-zero exit status and following error output:
/Users/jimmyhoughjr/workspace/button-webapp: error: package at '/Users/jimmyhoughjr/workspace/button-webapp' is using Swift tools version 5.4.0 but the installed version is 5.3.0

Been trying for hours now as I thought this might fix my buffer overflow that strangely affects code that worked fine a week ago.

But since I got crickets in chat, figured id not the issue here and hope it gets fixed.

To have carton pick up the toolchain, you'll need to have a .swift-version file at the root of the project with the name, e.g. wasm-5.4-SNAPSHOT-2021-07-25-a. You can then verify this with the command:
carton sdk local
Note though that the 5.4 compiler doesn't is not yet able to build Tokamak, tracked in a separate issue.

This error occurs when building a simple Tokamak "Hello World" web app with the unreleased Swift 5.9 toolchain, even with the steps @yonihemi mentioned here.

Here is the output:

$ carton dev -v
- checking Swift compiler path: /Users/furby/.carton/sdk/wasm-5.9-SNAPSHOT-2023-07-11-a/usr/bin/swift
- checking Swift compiler path: /Users/furby/.swiftenv/versions/wasm-5.9-SNAPSHOT-2023-07-11-a/usr/bin/swift
- checking Swift compiler path: /Users/furby/Library/Developer/Toolchains/swift-wasm-5.9-SNAPSHOT-2023-07-11-a.xctoolchain/usr/bin/swift
- checking Swift compiler path: /Library/Developer/Toolchains/swift-wasm-5.9-SNAPSHOT-2023-07-11-a.xctoolchain/usr/bin/swift
Inferring basic settings...
- swift executable: /Library/Developer/Toolchains/swift-wasm-5.9-SNAPSHOT-2023-07-11-a.xctoolchain/usr/bin/swift
SwiftWasm Swift version 5.9-dev (LLVM edfa23b742ff932, Swift c45fedc5c3327e9)
Target: arm64-apple-darwin23.0.0

Parsing package manifest:
[error]: package 'cosmicportal' is using Swift tools version 5.9.0 but the installed version is 5.8.0Error: fatalError

Hopefully I am not creating too much noise for an unreleased version of Swift, but noticed this issue was still marked open.

I'll maybe try later or tomorrow to see if the issue still exists.

lol as im having it with 5.9 not 5.4 anymore iol.

Perhaps a pre-release version could be made available at some point?

Also, maybe as a separate feature improvement issue - Carton could inform the user that a current version of Carton is incompatible with the installed Swift toolchain version, since it appears to be hardcoded, (curious if this has to be the case as well).

In the meantime, for anyone else looking to use carton or Tokamak on macOS Sonoma beta and/or the Swift 5.9 toolchain, I released those here:

Carton - https://github.com/Wabi-Studios/carton/releases/tag/0.20.0
Tokamak - https://github.com/Wabi-Studios/carton/releases/tag/0.11.3

Appears to be working with this snapshot.

Hopefully the latest version resolved this issue. Feel free to re-open this if you still have any issues.