Skip to content

[SwiftCompilerSources][build] Require recent Swift compiler in HOSTTOOLS mode #59020

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
merged 1 commit into from
Jun 8, 2022

Conversation

egorzhdan
Copy link
Contributor

Some code in SwiftCompilerSources, especially the parts that use C++ interop, triggers bugs in older versions of the Swift compiler. To make sure that HOSTTOOLS builds don't produce obscure compiler errors or crashes, let's require a relatively new Swift compiler for HOSTTOOLS build.

Since the CI currently uses Xcode 13.0 beta, let's require Swift 5.5 for now to avoid breaking the CI.

@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

CMakeLists.txt Outdated
elseif(BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")
# If cross-compiling, we don't have to bootstrap. We can just use the previously
# built native swiftc to build the swift compiler modules.
message(STATUS "Building swift modules with previously built tools instead of bootstrapping")
set(SWIFT_EXEC_FOR_SWIFT_MODULES "${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/swiftc")
if(NOT "${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/swiftc" STREQUAL "${CMAKE_Swift_COMPILER}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure that this will break cross-compilation.
For cross-compilation we don't use the installed swift compiler, but the previously built swiftc.
See https://github.com/apple/swift/blob/98895861fa7f03f126b996648b87ea42c91c0b33/utils/build-script-impl#L2026

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I didn't know that, thanks! I think in cross-compilation mode we don't actually need the version check, since we're using a compiler that was just built. I'll make sure it only runs in hosttools mode.

…OOLS` mode

Some code in SwiftCompilerSources, especially the parts that use C++ interop, triggers bugs in older versions of the Swift compiler. To make sure that `HOSTTOOLS` builds don't produce obscure compiler errors or crashes, let's require a relatively new Swift compiler for `HOSTTOOLS` build.
@egorzhdan egorzhdan force-pushed the egorzhdan/libswift-version-check branch from 5010c03 to 2b3980b Compare May 31, 2022 12:36
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan egorzhdan requested a review from eeckstein May 31, 2022 13:14
Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@egorzhdan egorzhdan merged commit 9c09020 into main Jun 8, 2022
@egorzhdan egorzhdan deleted the egorzhdan/libswift-version-check branch June 8, 2022 11:51
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.

2 participants