Skip to content

[wasm] Repair build for recent SwiftDriver linkage changes #73746

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

Merged

Conversation

kateinoigakukun
Copy link
Member

  • Before f34d388, the EarlySwiftDriver used Dispatch/Foundation from old host toolchain at the initial "build" step, and then re-linked the just built Dispatch/Foundation at "install" step.
  • WasmStdlib product incorrectly set BOOTSTRAPPING_MODE to HOSTTOOLS and it makes SwiftSource.cmake set LD_LIBRARY_PATH to load the Dispatch/Foundation from the just built toolchain (SWIFT_NATIVE_SWIFT_TOOLS_PATH).

After f34d388, the EarlySwiftDriver always uses the corelibs of the old host toolchain, so setting LD_LIBRARY_PATH leads to loading incompatible corelibs of the old host toolchain, and the build fails.

This change tells the CMake build system to use CROSSCOMPILE mode. We already built the toolchain for the current host from the revision being built for the target, so we don't need to inject the lib library of the old host toolchain.

This patch fixes the following CI failure:
https://ci.swift.org/job/oss-swift-pr-test-crosscompile-wasm-ubuntu-20_04/681/console

/home/build-user/swift-nightly-install/usr/bin/swiftc: symbol lookup error: /home/build-user/build/buildbot_linux/earlyswiftdriver-linux-x86_64/release/dependencies/swift-tools-support-core/lib/libTSCBasic.so: undefined symbol: $s8Dispatch0A5QueueC5async5group3qos5flags7executeyAA0A5GroupCSg_AA0A3QoSVAA0A13WorkItemFlagsVyyXBtF

- Before f34d388, the EarlySwiftDriver used Dispatch/Foundation from
old host toolchain at the initial "build" step, and then re-linked the just
built Dispatch/Foundation at "install" step.
- WasmStdlib product incorrectly set `BOOTSTRAPPING_MODE` to `HOSTTOOLS`
and it makes `SwiftSource.cmake` set `LD_LIBRARY_PATH` to load the
Dispatch/Foundation from the just built toolchain (SWIFT_NATIVE_SWIFT_TOOLS_PATH).

After f34d388, the EarlySwiftDriver always uses the corelibs of
the old host toolchain, so setting `LD_LIBRARY_PATH` leads to loading
incompatible corelibs of the old host toolchain, and the build fails.

This change tells the CMake build system to use CROSSCOMPILE mode.
We already built the toolchain for the current host from the revision
being built for the target, so we don't need to inject the lib library
of the old host toolchain.
@kateinoigakukun
Copy link
Member Author

@swift-ci test WebAssembly

WASI does not support crashing tests
5298450 added @_used for the function
and it added "R" flag (WASM_SEG_FLAG_RETAIN) to the section directive.

This patch updates the test to match the new section flags.
The `classes-wasm.swift` test was the only executable test for
WebAssembly that requires wasm runtime at test-time. Other tests
in the `embedded` directory run only on the macOS / Linux host toolchain
builds and some of them are incompatible with SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB=OFF.
Given that the `classes-wasm.swift` test is the only test we want to run
during WasmStdlib build, move it to a separate directory `embedded/wasm`.
@kateinoigakukun
Copy link
Member Author

@swift-ci test WebAssembly

@kateinoigakukun
Copy link
Member Author

@swift-ci smoke test

@kateinoigakukun kateinoigakukun marked this pull request as ready for review May 20, 2024 17:09
@kateinoigakukun kateinoigakukun requested a review from a team as a code owner May 20, 2024 17:09
@kateinoigakukun kateinoigakukun enabled auto-merge May 20, 2024 17:10
@kateinoigakukun kateinoigakukun merged commit 7ce4df7 into swiftlang:main May 20, 2024
4 checks passed
@kateinoigakukun kateinoigakukun deleted the yt/repair-wasm-ci-20240519 branch May 21, 2024 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant