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
Description
While trying to compile the same swift to wasm from both linux and macos, I noticed that some builds would fail depending on the host OS for the same toolchain release.
Steps to reproduce
For the following swift file:
varx="nodispatch"#if canImport(Dispatch)
import Dispatch
varq=DispatchQueue(label:"foo", attributes:.concurrent)
x ="yesdispatch"#endifprint(x)
Expected behavior
I expected some difference in behavior for swift on macos vs linux, but given that I'm targetting wasm here I expected a statement like #if canImport(Dispatch) would be consistently pass/failing depending on the target toolchain irrespective of the host.
The text was updated successfully, but these errors were encountered:
Thank you for creating a ticket for this :)
This is an issue of the toolchain directory layout. The libdispatch's mdoulemap is placed at usr/lib/swift_static/dispatch/module.modulemap but the directory is shared between all platforms. This is apparently wrong place considering crosscompiling. Ideally, that should be moved to platform-specific directory like usr/lib/swift_static/wasi/ to avoid this kind of issue.
But I haven't tried this yet and I think it's better to discuss the toolchain layout in the forum at first to fix it in upstream also.
kateinoigakukun
changed the title
Difference between macos and linux host when targetting wasmcanImport(Dispatch) is wrongly truthy on WASI target
Mar 9, 2024
Description
While trying to compile the same swift to wasm from both linux and macos, I noticed that some builds would fail depending on the host OS for the same toolchain release.
Steps to reproduce
For the following swift file:
On macos:
But on linux (tested under
docker run -it ubuntu:20.04
):Expected behavior
I expected some difference in behavior for swift on macos vs linux, but given that I'm targetting wasm here I expected a statement like
#if canImport(Dispatch)
would be consistently pass/failing depending on the target toolchain irrespective of the host.The text was updated successfully, but these errors were encountered: