-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
CMake: option to disable swift in swift #79778
CMake: option to disable swift in swift #79778
Conversation
This will require the compiler and stdlib-side changes in #77815
|
e044d9b
to
cc066eb
Compare
cc066eb
to
318c963
Compare
This patch is enough to bring up a stage-0 compiler without macro support using the C++ Swift driver without Swift on the platform. Verified with on Ubuntu 24.04 without a pre-installed Swift: ./sources/swift/utils/build-script \
--skip-test-cmark \
--skip-test-lldb \
--skip-test-swift \
--skip-test-llbuild \
--skip-test-swiftpm \
--skip-test-swift-driver \
--skip-test-xctest \
--skip-test-foundation \
--skip-test-libdispatch \
--skip-test-playgroundsupport \
--skip-test-indexstore-db \
--skip-test-sourcekit-lsp \
--skip-test-swiftdocc \
--skip-test-wasm-stdlib \
--skip-test-swiftformat \
--swift-include-tests=0 \
--llvm-include-tests=0 \
--release \
--skip-early-swiftsyntax \
--skip-early-swift-driver \
--skip-build-benchmarks \
--build-runtime-with-host-compiler=0 \
--build-swift-libexec=0 \
--build-swift-remote-mirror=0 \
'--swift-install-components=autolink-driver;compiler;clang-resource-dir-symlink;stdlib;sdk-overlay;toolchain-tools;license' \
'--llvm-install-components=llvm-ar;llvm-ranlib;clang;clang-resource-headers;compiler-rt;clang-features-file' \
'--extra-cmake-options=-DLLVM_TARGETS_TO_BUILD=X86;AArch64' \
'--swift-cmake-options=-DSWIFT_ENABLE_SWIFT_IN_SWIFT:BOOL=NO -DSWIFT_INCLUDE_DOCS:BOOL=NO' \
--build-subdir=stage0 \
--install-destdir=/staging/stage0 \
--install-llvm \
--install-swift The resulting compiler is able to build the standard library and a simple "hello world" program. |
@swift-ci please test |
318c963
to
4353c83
Compare
@swift-ci please test |
FYI: when building Swift with a recent bootstrap compiler, I've noticed the following error:
Bisecting leads to commit 008e10c and reverting this is a workaround for the problem. I haven't investigated or tested further than this, but a heads-up in case you run in to the same issue. |
yeah, I've seen that as well. Thanks for bisecting it. |
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.
Thank you for picking this up! Just the one question from me
Adding `SWIFT_ENABLE_SWIFT_IN_SWIFT` option to enable or disable the parts of Swift that require a Swift compiler to build. This is meant for bootstrapping compilers on new platforms and is not guaranteed to result in a compiler that will pass the test suite. This option is on by default so that folks won't forget. If the option is off, the resulting compiler does not include the Swift optimizer sources in SwiftCompilerSources nor does the resulting compiler have swift macro support.
Remove dependency on macros from compiler and stdlib build when bootstrapping the compiler without Swift available.
PR 79186 (swiftlang#79186) moved one of the mandatory passes from the C++ implementation to the Swift implementation resulting in a compiler that is unable to build the standard library. The pass used to ensure that inaccessible control-flow positions after an infinite loop was marked with `unreachable` in SIL. Since the pass is no longer running, any function that returns a value that also has an infinite loop internally must place a fatalError after the infinite loop or it will fail to compile as the compiler will determine that the function does not return from all control flow paths even though some of the paths are unreachable.
4353c83
to
ddaf003
Compare
@swift-ci please test |
@swift-ci please test Linux |
Adding
SWIFT_ENABLE_SWIFT_IN_SWIFT
option to enable or disable the parts of Swift that require a Swift compiler to build. This is meant for bootstrapping compilers on new platforms and is not guaranteed to result in a compiler that will pass the test suite.This option is on by default so that folks won't forget. If the option is off, the resulting compiler does not include the Swift optimizer sources in SwiftCompilerSources nor does the resulting compiler have swift macro support.