-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[build] Add a new --cross-compile-build-swift-tools
flag to disable cross-compiling the compiler
#38441
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
Conversation
@@ -1909,6 +1910,12 @@ for host in "${ALL_HOSTS[@]}"; do | |||
cmake_options=( | |||
"${cmake_options[@]}" | |||
-DLLVM_TABLEGEN=$(build_directory "${LOCAL_HOST}" llvm)/bin/llvm-tblgen | |||
-DSWIFT_INCLUDE_TOOLS:BOOL=$(true_false "${CROSS_COMPILE_BUILD_SWIFT_TOOLS}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the way --build-swift-tools
works, where before it would control building both native and cross-compiled host tools, but now it only affects the native ones. Since very few people were likely using this flag, I think it's better to split the functionality up like this for cross-compiling the host tools, rather than keeping --build-swift-tools
controlling both even after --cross-compile-build-swift-tools
is added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will have to re-read and play around with the posix_spawn
problems to understand them. In general, I would say that things should work with vanilla Android, without special libraries or headers.
For the time being, let's see if this works in macOS and Linux and we are not going to break another platform by mistake.
@swift-ci please test |
Build failed |
Build failed |
The problem is that swiftlang/swift-corelibs-foundation#2928 added a dependency on some
A single failing test because I added a new path variable to the Android preset, didn't know I had to do something else for that, will fix it. |
90f4c15
to
40ef38d
Compare
I added a line to fix the single failing test on the CI and fixed the preset arch issue we discussed above. @drodriguez, I think this is ready for you to try on your local version of the Android CI. I think the only remaining issue will be adding library dependencies that the corelibs depend on to the Android CI, which will require the Termux packages I mentioned above for the Android corelibs and perhaps the native Ubuntu packages to build the native linux corelibs, if those Ubuntu packages like libcurl aren't already installed on the Android CI. |
40ef38d
to
26f0200
Compare
I remember that code 😀. I don't think anyone will object if we switch (again) all the direct usages of |
@swift-ci please test |
Alright, I will look into implementing that CF polyfill on top of that |
Build failed |
Build failed |
26f0200
to
fd79ea8
Compare
Gah, playing whack-a-mole with the non-Android CI: I had missed that preset variables need that |
@swift-ci please test |
… cross-compiling the compiler This is useful when building cross-compilation toolchains where you want the stdlib and corelibs cross-compiled but don't want the Swift compiler cross-compiled too with '--cross-compile-hosts'.
fd79ea8
to
5b1bff8
Compare
@swift-ci smoke test |
I've stripped this down to just adding the single build flag, with no changes to any of the Android presets, so the Foundation considerations no longer apply. @drodriguez, if you have any feedback on this final version, let me know. |
@swift-ci smoke test macos |
--cross-compile-build-swift-tools
flag to disable cross-compiling the compiler
Merging since this won't break anything, just wondered if Daniel had any input, still listening if he comes up with anything later. |
This is useful when building cross-compilation toolchains where you want the stdlib and corelibs cross-compiled but don't want the Swift compiler cross-compiled too with
--cross-compile-hosts
. This pull demonstrates using the new flag for the Android build presets.I'm submitting this after discussing cross-compiling the corelibs on the Android CI with @drodriguez, as the easiest way to do so after #33724 is by using
--cross-compile-hosts
but we don't want to cross-compile the Swift compiler too.To build this, I first had to unpack three Termux packages for Android,
libandroid-spawn
,libcurl
, andlibxml2
(I also unpackedlibicu
but the Android CI does that differently) as detailed here, because those libraries are dependencies ofswift-corelibs-foundation
.I then passed that
swift-android-aarch64-24-sdk
path into thisbuild-script
invocation with the July 9 trunk source snapshot to build an Android cross-compilation toolchain that includes the corelibs:swift-corelibs-foundation
recently added a dependency on someposix_spawn
functions on Android, which as discussed on the forum isn't officially supported before Android API 28, so I linked against Termux's backported library with these additional patches:Alternatively, since the build only fails when linking
plutil
againstlibFoundation.a
and we can't run the tests for the cross-compiled corelibs, we could hack out building a staticplutil
or revert the small pull adding that dependency, as done in vgorloff/swift-everywhere-toolchain#116.@drodriguez, let me know what you think.