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

swift build fails when targeting Wasm Swift SDK on macOS #7919

Closed
1 task done
cwakamo opened this issue Aug 26, 2024 · 0 comments · Fixed by #7920
Closed
1 task done

swift build fails when targeting Wasm Swift SDK on macOS #7919

cwakamo opened this issue Aug 26, 2024 · 0 comments · Fixed by #7920
Assignees
Labels

Comments

@cwakamo
Copy link
Contributor

cwakamo commented Aug 26, 2024

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

With swift-DEVELOPMENT-SNAPSHOT-2024-08-20-a, cross-compiling from macOS to WASM with the WASM Swift SDK fails:

error: link command failed with exit code 1 (use -v to see invocation)
wasm-ld: error: unknown argument: -rpath
wasm-ld: error: cannot open /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-08-20-a.xctoolchain/usr/lib/swift/macosx/testing: Is a directory

Expected behavior

I'd expect this to link successfully since I just have a "Hello, world" program with no dependencies.

Actual behavior

Instead, it failed to link because -rpath /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-08-20-a.xctoolchain/usr/lib/swift/macosx/testing is being passed to wasm-ld.

Steps to reproduce

  1. Download or build a recent Swift toolchain (e.g. swift-DEVELOPMENT-SNAPSHOT-2024-08-20-a)
  2. Download or build a recent Swift SDK for WASM (https://book.swiftwasm.org/getting-started/setup-snapshot.html)
  3. Install the Swift SDK for WASM
  4. Create a new package with swift package init --executable
  5. Try to build that package with swift build --swift-sdk wasm32-unknown-wasi

Swift Package Manager version/commit hash

swift-DEVELOPMENT-SNAPSHOT-2024-08-20-a

Swift & OS version (output of swift --version ; uname -a)

Apple Swift version 6.0-dev (LLVM 6c1a2ac10cabb71, Swift 2a04604247a93e7)
Target: arm64-apple-macosx15.0

@cwakamo cwakamo added the bug label Aug 26, 2024
xedin added a commit to xedin/swift-package-manager that referenced this issue Aug 26, 2024
…ting macOS

Fixes a bug where swift and linker flags for swift-testing were
injected into `extraFlags` of a toolchain that was targeting WASM
but used macOS to build.

Resolves: swiftlang#7919
xedin added a commit to xedin/swift-package-manager that referenced this issue Aug 26, 2024
…ting macOS

Fixes a bug where swift and linker flags for swift-testing were
injected into `extraFlags` of a toolchain that was targeting WASM
but used macOS to build.

Resolves: swiftlang#7919
(cherry picked from commit d2141cd)
xedin added a commit to xedin/swift-package-manager that referenced this issue Aug 26, 2024
…ting macOS

Fixes a bug where swift and linker flags for swift-testing were
injected into `extraFlags` of a toolchain that was targeting WASM
but used macOS to build.

Resolves: swiftlang#7919
(cherry picked from commit d2141cd)
(cherry picked from commit db603e6)
xedin added a commit that referenced this issue Aug 26, 2024
… target… (#7922)

- Explanation:

Fixes a bug where swift and linker flags for swift-testing were injected
into `extraFlags` of a toolchain that was targeting WASM but used macOS
to build.

- Main Branch PR:
#7920
- 6.0 Branch PR:
#7921

- Resolves:
#7919
- Resolves: rdar://134714404

- Risk: Low (only affects cross-compilation to WASM).

- Reviewed By: @bnbarham 

- Testing: Manual testing since this is not currently possible to test
automatically.
xedin added a commit that referenced this issue Aug 26, 2024
…arget… (#7921)

- Explanation:

Fixes a bug where swift and linker flags for swift-testing were injected
into `extraFlags` of a toolchain that was targeting WASM but used macOS
to build.

- Main Branch PR:
#7920

- Resolves:
#7919
- Resolves: rdar://134714404

- Risk: Low (only affects cross-compilation to WASM).

- Reviewed By: @bnbarham 

- Testing: Manual testing since this is not currently possible to test
automatically.
@xedin xedin closed this as completed in b755e1d Aug 26, 2024
@MaxDesiatov MaxDesiatov changed the title swift build fails when targeting WASM Swift SDK on macOS swift build fails when targeting Wasm Swift SDK on macOS Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
@xedin @cwakamo and others