-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[build] extend support for building with a prebuilt toolchain to the corelibs and llbuild #32922
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
…corelibs and llbuild
cmake_options=( | ||
${cmake_options[@]} | ||
-DCMAKE_Swift_COMPILER:PATH="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc" | ||
) |
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.
Updated this pull for two swiftc invocations that I had missed: lldb above and removing this one that's unused, as cmake_options
isn't invoked by the test commands. Since this flag was never used, just remove it.
-DCMAKE_Swift_COMPILER:PATH="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc" | ||
-DCMAKE_C_COMPILER:PATH="${CLANG_BIN}/clang" | ||
-DCMAKE_CXX_COMPILER:PATH="${CLANG_BIN}/clang++" | ||
-DCMAKE_Swift_COMPILER:PATH=${SWIFTC_BIN} |
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 was set this way before but I notice that @benlangmuir changed it, a mistake? Would be good if you could review this pull.
@davezarzycki, since you appear familiar with these native tools options to employ a prebuilt toolchain, let me know if you have any input on this pull. |
Hi @buttaface – I actually just recently discovered that pre-built binaries could be used so I'm not familiar with the feature. I also don't use the |
OK, good to know. |
Seems like an obvious thing to do. I'm not the best person to decide if this is the right way to do it, but it looks like good work to me. |
Alright, thanks. |
cc: @edymtt |
@swift-ci build toolchain |
@swift-ci Please test |
Build failed |
Linux Toolchain (Ubuntu 16.04) Install command |
macOS Toolchain Install command |
@gottesmm, this extends the prebuilt toolchain support- that you added a preset for to build a standalone Swift stdlib, 5f15385- to the corelibs and llbuild, mind reviewing? |
LGTM! Thanks for the PR! |
Thanks for reviewing. |
The flags
--native-{swift,clang,llvm}-tools-path
, for building the Swift stdlib with a prebuilt Swift and clang compiler, have been around since the beginning, so might as well use them to quickly build other Swift repos too. This is useful when iterating on the Swift corelibs, so you don't have to build the most recent compilers from scratch each time.The following commands will set up, build, and run the tests for libdispatch for the most recent trunk snapshot for which there's an official prebuilt compiler, with this pull merged:
This is obviously much quicker than rebuilding the Swift and clang compilers every time you checkout a trunk snapshot. Replacing
--libdispatch
with--xctest -b
in that last command, I was able to build and test all the corelibs and llbuild on linux, though I had to remove the CoreFoundation module.map too (rm /home/butta/swift-715/usr/lib/swift/CoreFoundation/module.map
), as those module maps that come with the prebuilt toolchain conflict with the freshly built ones (the tests already passLD_LIBRARY_PATH
where necessary to link and test the freshly built corelibs), and XCTest and llbuild needed my recent pull #32860 for testing to work (otherwise, lit and some other testing utilities couldn't be found).@shahmishal, this could also be used on the CI to greatly reduce testing times for these corelibs, by caching the build of the latest merged commit in this compiler repo and reusing it for the CI for the corelibs and other repos. A few projects like libdispatch couldn't be run this way, as it's a dependency of SourceKit and is built as part of this repo too, but the rest of these Swift repos' CI could be run a lot faster, saving a lot of wasted builds.
This pull is based on my patch to cross-compile the corelibs and SPM for Android AArch64, which is used to distribute a Swift toolchain that runs on Android AArch64 devices.