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
We updated to macOS Sequoia and are trying to get SwiftWasm working again in this environment.
After installing a Swift release toolchain (6.0.1) and a matching SwiftWasm SDK, we are able to build our Swift package, with some changes.
swift.setInstance(instance);
wasi.initialize(instance);
swift.main(); // <-- new
runCmd(
"swift",
[
"build",
"--swift-sdk", // <-- new
"6.0-SNAPSHOT-2024-08-30-a-wasm32-unknown-wasi", // <-- new
// "--skip-update", // for offline support
"-c",
BUILD_CONFIG,
"--product",
PRODUCT_NAME,
"-Xswiftc",
"-Xclang-linker",
"-Xswiftc",
"-mexec-model=reactor",
"-Xlinker",
"--export-if-defined=main",
"-Xlinker",
"--export-if-defined=__main_argc_argv", // <-- new
"-Xswiftc",
"-DJAVASCRIPTKIT_WITHOUT_WEAKREFS",
],
{
cwd: swiftPackageDir,
env: { ...process.env, TOOLCHAINS: "Swift 6.0.1" }, // <-- new
shell: true,
stdio: "inherit",
}
);
After the above changes, almost everything works as expected.
Now here is the issue: previously we had issues with JavaScriptKit using resources in its target definition (in Package.swift) under certain circumstances – I think because we were using an API that "might" be provided by Foundation if it's imported (note that the resources flag depends on Foundation, see here).
Now it seems we can't escape it. I can remove the resources line and the package will build fine, but doing so would require a fork of JavaScriptKit to get reproducible builds. Do you have any idea what could be going on here? Have you seen this issue yourself at all?
To be clear: we don't want or need Foundation at all in our project. It is being automatically imported due to the resources line in JavaScriptKit's Package.swift. I can't see how to workaround this any more in Swift 6.x: it seems like something has changed such that whenever resources is there, Foundation is required. Any ideas?
The text was updated successfully, but these errors were encountered:
For now, I went with the workaround here, but I do wonder what has changed since Swift 5.7 that means that Foundation is linked even if we're not using it at all. This appears to be a regression to me but I'm not sure it's related to SwiftWasm directly
We updated to macOS Sequoia and are trying to get SwiftWasm working again in this environment.
After installing a Swift release toolchain (6.0.1) and a matching SwiftWasm SDK, we are able to build our Swift package, with some changes.
After the above changes, almost everything works as expected.
Now here is the issue: previously we had issues with JavaScriptKit using
resources
in its target definition (in Package.swift) under certain circumstances – I think because we were using an API that "might" be provided by Foundation if it's imported (note that theresources
flag depends onFoundation
, see here).This happens due to this line:
Now it seems we can't escape it. I can remove the
resources
line and the package will build fine, but doing so would require a fork of JavaScriptKit to get reproducible builds. Do you have any idea what could be going on here? Have you seen this issue yourself at all?To be clear: we don't want or need Foundation at all in our project. It is being automatically imported due to the
resources
line in JavaScriptKit's Package.swift. I can't see how to workaround this any more in Swift 6.x: it seems like something has changed such that wheneverresources
is there, Foundation is required. Any ideas?The text was updated successfully, but these errors were encountered: