Skip to content

Fix cross-compile build failure. #75970

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
Aug 20, 2024
Merged

Conversation

hjyamauchi
Copy link
Contributor

In Build-FoundationMacros, use the build Swift SDK for the build case and when cross-compiling, use the swift syntax build from the build arch binary cache as opposed to the host arch binary cache or else the architecture mismatch will happen.

This fixes the CI failure: https://ci-external.swift.org/job/swift-6.0-windows-toolchain-arm64/192/console

In Build-FoundationMacros, use the build Swift SDK for the build case
and when cross-compiling, use the swift syntax build from the build
arch binary cache as opposed to the host arch binary cache or else the
architecture mismatch will happen.
@hjyamauchi hjyamauchi requested a review from compnerd August 19, 2024 23:37
@hjyamauchi
Copy link
Contributor Author

@swift-ci please test

@@ -1766,6 +1766,12 @@ function Build-FoundationMacros() {
$InstallDir = "$($Arch.ToolchainInstallRoot)\usr"
}

$SwiftSyntaxCMakeModules = if ($Build -and $HostArch -ne $BuildArch) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we not get away with if ($Build)? We will have the host build for distribution anyway.

Copy link
Contributor Author

@hjyamauchi hjyamauchi Aug 20, 2024

Choose a reason for hiding this comment

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

No, because SwiftSyntax is built part of Build-Compilers and in a normal (not cross-compiling) build, we only build in the host-arch binary cache (Get-HostProjectCMakeModules Compilers) and the build-arch binary cache (Get-BuildProjectCMakeModules Compilers) would be empty. If we just have if ($Build), we would look for the SwiftSyntax build artifacts in the empty location. It's true that we build FoundationMacros twice and both for the build-arch and host-arch binary caches. But this is about its dependency SwiftSyntax.

@shahmishal shahmishal linked an issue Aug 19, 2024 that may be closed by this pull request
@shahmishal
Copy link
Member

Thanks for the fix. Can we also cherry-pick this to release/6.0 branch?

@shahmishal shahmishal merged commit ebf3ec7 into swiftlang:main Aug 20, 2024
5 checks passed
@hjyamauchi
Copy link
Contributor Author

Thanks for the fix. Can we also cherry-pick this to release/6.0 branch?

I'm on it

@hjyamauchi
Copy link
Contributor Author

@shahmishal Created #75988 for release/6.0

hjyamauchi added a commit to hjyamauchi/swift that referenced this pull request Aug 21, 2024
This fix is similar to swiftlang#75970
but for `Build-TestingMacros`.
andrurogerz pushed a commit to andrurogerz/swift that referenced this pull request Sep 3, 2024
This fix is similar to swiftlang#75970
but for `Build-TestingMacros`.
andrurogerz pushed a commit to andrurogerz/swift that referenced this pull request Sep 3, 2024
This fix is similar to swiftlang#75970
but for `Build-TestingMacros`.
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.

[Swift 6.0] Windows arm64 nightly bot failing to build
4 participants