Closed Kyle-Ye closed 4 months ago
swift build
step) does not build for WebAssembly. It's building for host platform. It would help if you used swift build --triple wasm32-unknown-wasi
instead.So this is not WebAssembly target-dependent stuff at all, but a build configuration issue.
- Your CI configuration (
swift build
step) does not build for WebAssembly. It's building for host platform. It would help if you usedswift build --triple wasm32-unknown-wasi
instead.- The code hits compiler internal assertions. swift.org toolchains are built without assertions, so it just ignored the violation, but SwiftWasm is built with assertion enabled, so crashing.
So this is not WebAssembly target-dependent stuff at all, but a build configuration issue.
The old cargo based action https://github.com/swiftwasm/swiftwasm-action does not need pass any param here. So after I switched to https://github.com/swiftwasm/setup-swiftwasm, I forgot to add it. Maybe we can add this info (swift build --triple wasm32-unknown-wasi
) in setup-swiftwasm repo's README to help prevent other newcomers from making similar mistakes.
Unmanaged<OGGraphContext>
come from here. Maybe it is an internal type checking compiler bug.Anyway I finally fixed(workaround) it temporarily as you suggest. Thanks for your help.
I'll dig the type mismatch assert issue later.
Hitting internal assertions rather than compilation errors is definitely a compiler issue. Will have a closer look when iI get a time.
Hitting internal assertions rather than compilation errors is definitely a compiler issue. Will have a closer look when iI get a time.
Actually this will also appear on Linux with the latest nightly toolchain (assertion on).
I believe this is not a WASM specific issue but a universal issue for non-Darwin/non-ObjectiveC platform since OGGraphContext
is defined in a header file via typedef struct CF_BRIDGED_TYPE(id) OGGraphContextStorage * OGGraphContextRef;
.
I found WASM CI failure recently due to a swift compile issue here.
I don't have time to investigate for the time being. And I feel that there is a high probability that the subsequent Swift-wasm will fix it, so I'm trying to use some workarounds here.
https://github.com/OpenSwiftUIProject/OpenGraph/actions/runs/7948140518/job/21697819791?pr=25
But even I add such macro to block it, the CI is still complaining about the type mismatch here. What should I do to fix/workaround it? Is
#if os(WASI)
the correct way to detect swiftwasm toolchain?