Skip to content

[build-script-impl] Allow cross-compiling the host toolchain for Android #31065

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
Apr 22, 2020

Conversation

finagolfin
Copy link
Member

This was needed in order to cross-compile the Swift compiler for Android AArch64, which is why it is now available on any Android AArch64 device running 7.0 Nougat or later. Simply install the Termux app and run pkg install swift and you have a working Swift 5.2.1 compiler. I ran the Swift validation suite with this cross-compiled compiler and 90% of the tests passed, with the remaining failing mostly because they were missing host test binaries like sourcekitd-test.

@drexin, one last tiny Android patch extracted from my Termux packaging scripts that should be safe to merge.

@drexin
Copy link
Contributor

drexin commented Apr 17, 2020

@swift-ci smoke test

@finagolfin
Copy link
Member Author

Passes all CI, ready to go.

@finagolfin
Copy link
Member Author

@drexin or @drodriguez, can we get this one-liner in before the 5.3 branch?

@@ -917,7 +917,7 @@ function false_true() {
CROSS_COMPILE_HOSTS=($CROSS_COMPILE_HOSTS)
for t in "${CROSS_COMPILE_HOSTS[@]}"; do
case ${t} in
iphone* | appletv* | watch* | linux-armv6 | linux-armv7 )
iphone* | appletv* | watch* | linux-armv6 | linux-armv7 | android-aarch64 )
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be android-* like the ones at the start of the line? Thanks.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've never tried anything other than AArch64, but I guess the others would work too. I'll change it.

@finagolfin finagolfin changed the title [build-script-impl] Allow cross-compiling the host toolchain for Android AArch64 [build-script-impl] Allow cross-compiling the host toolchain for Android Apr 21, 2020
@drodriguez
Copy link
Contributor

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - fb5273822590e53de264a44350409d198eacbbe7

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - fb5273822590e53de264a44350409d198eacbbe7

Copy link
Contributor

@drexin drexin left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@drexin drexin merged commit f1ab4f8 into swiftlang:master Apr 22, 2020
@finagolfin
Copy link
Member Author

finagolfin commented Apr 23, 2020

Thanks.

@drexin, would you like me to submit a backport of #30565 for the 5.2 branch? If you try to build the whole Swift 5.2 toolchain with ./swift/utils/build-script --install-prefix=/opt --xctest -b -p, it fails when building SwiftPM on non-Darwin platforms, but that worked with 5.1 and I'm guessing even before, which is why I had to apply parts of that patch to my Android package of Swift 5.2. Or, this regression could just be ignored for now, since the fix is in the 5.3 branch. Just let me know what you want.

@drexin
Copy link
Contributor

drexin commented Apr 23, 2020

@buttaface This is not on 5.3, yet. If you want it on 5.3, you have to backport it to release/5.3.

@drexin
Copy link
Contributor

drexin commented Apr 23, 2020

Up to you if you also want it on 5.2.

@finagolfin
Copy link
Member Author

@drexin, there's a misunderstanding: I'm not talking about this pull but a different one, #30565, which has to do with the install prefix used by the build-script on non-Darwin platforms. That one was merged before the 5.3 branch, but I'm not sure if you want it in 5.2.

@finagolfin finagolfin deleted the android branch April 23, 2020 06:48
@drexin
Copy link
Contributor

drexin commented Apr 23, 2020

Ah, yes. It‘s really up to you if you want it in 5.2 or not. It‘s not up to me what gets merged anyway 🙂

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.

4 participants