Bug while compiling Swift 5.9-RELEASE under Fedora Rawhide on `aarch64`

Hey all-

I know this is a corner-case, but I cannot get Swift to build under Fedora Rawhide/39 (the soon-to-be-current version) on aarch64; it builds just fine on x864_64.

I'm including the stack trace here in hopes someone might recognize the error and perhaps have some suggestions about trying to troubleshooting this problem; as it stands I haven't been able to update Swift on Fedora due to not being able to be built on both architectures.

Thanks for any suggestions!

[root@7a272ff37024 bin]# ./swift-frontend
<unknown>:0: error: fatal error encountered during compilation; please submit a bug report (https://swift.org/contributing/#reporting-bugs)
<unknown>:0: note: Compiler-internal integrated REPL has been removed; use the LLDB-enhanced REPL instead.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.      Program arguments: /root/rpmbuild/BUILD/swift-source/build/buildbot_linux/swift-linux-aarch64/bin/swift-frontend -frontend -repl -Xllvm -aarch64-use-tbi -disable-objc-interop -color-diagnostics -plugin-path /root/rpmbuild/BUILD/swift-source/build/buildbot_linux/swift-linux-aarch64/lib/swift/host/plugins -plugin-path /root/rpmbuild/BUILD/swift-source/build/buildbot_linux/swift-linux-aarch64/local/lib/swift/host/plugins -module-name REPL
1.      Swift version 5.9 (swift-5.9-RELEASE)
2.      Compiling with the current language version
 #0 0x0000000006227760 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/root/rpmbuild/BUILD/swift-source/build/buildbot_linux/swift-linux-aarch64/bin/swift-frontend+0x6227760)
 #1 0x00000000062257d8 llvm::sys::RunSignalHandlers() (/root/rpmbuild/BUILD/swift-source/build/buildbot_linux/swift-linux-aarch64/bin/swift-frontend+0x62257d8)
 #2 0x0000000006227b78 SignalHandler(int) Signals.cpp:0:0
 #3 0x0000ffff9698a78c (linux-vdso.so.1+0x78c)
 #4 0x0000ffff95d41b60 __pthread_kill_implementation (/lib64/libc.so.6+0x91b60)
 #5 0x0000ffff95cf5800 gsignal (/lib64/libc.so.6+0x45800)
 #6 0x0000ffff95ce0288 abort (/lib64/libc.so.6+0x30288)
 #7 0x00000000005d2520 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*)::$_1::__invoke(void*, char const*, bool) FrontendTool.cpp:0:0
 #8 0x000000000614fd48 llvm::report_fatal_error(llvm::Twine const&, bool) (/root/rpmbuild/BUILD/swift-source/build/buildbot_linux/swift-linux-aarch64/bin/swift-frontend+0x614fd48)
 #9 0x000000000614fc2c llvm::report_fatal_error(llvm::Twine const&, bool) (/root/rpmbuild/BUILD/swift-source/build/buildbot_linux/swift-linux-aarch64/bin/swift-frontend+0x614fc2c)
#10 0x00000000005cc500 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) FrontendTool.cpp:0:0
#11 0x00000000005cad78 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/root/rpmbuild/BUILD/swift-source/build/buildbot_linux/swift-linux-aarch64/bin/swift-frontend+0x5cad78)
#12 0x000000000044d6a0 swift::mainEntry(int, char const**) (/root/rpmbuild/BUILD/swift-source/build/buildbot_linux/swift-linux-aarch64/bin/swift-frontend+0x44d6a0)
#13 0x0000ffff95ce09dc __libc_start_call_main (/lib64/libc.so.6+0x309dc)
#14 0x0000ffff95ce0ab0 __libc_start_main@GLIBC_2.17 (/lib64/libc.so.6+0x30ab0)
#15 0x000000000044c530 _start (/root/rpmbuild/BUILD/swift-source/build/buildbot_linux/swift-linux-aarch64/bin/swift-frontend+0x44c530)
Aborted

To be clear, you're able to build it, but it crashes? Or this error is from running a prebuilt Swift toolchain from swift.org?

I build the toolchain for Android AArch64 and it works fine, but I turn bootstrapping off with --bootstrapping=off , as C++ Interop is not fully working on Android. You may want to turn it off and run the compiler validation suite, to make sure all the C++ Interop tests pass on Fedora 39 AArch64. If they don't, that could be causing the problem, and you may want to fix it.

I’m able to build it, but it crashes when being invoked, which happens as part of building the whole Swift toolchain. Can you tell me a little more about what the bootstrapping=off flag does; isn’t this a requirement for building the entire Swift toolchain from scratch?

Bootstrapping is the process described in this forum post last year, where parts of the Swift compiler are written in Swift and call C++ methods in the compiler through the growing C++ Interop.

As stated there, it is not required, though some features, like bare regex literals and macros, do require it in 5.9, contradicting that plan. There has been some work in trunk and the release/5.9 branch to not require C++ Interop for those two features, so that posted plan will likely stick soon.

Check what bootstrapping mode you are currently using with 5.9: grep -i bootstrapping_mode build/Ninja-Release/swift-linux-aarch64/CMakeCache.txt. Try turning it off to see if that's the problem. Alternatively, bootstrapping was likely the default for you before, but was recently overridden to hosttools on linux, so that may be causing the crash.

Try a couple different bootstrapping modes and see what works now, as I'm just speculating that this is the cause. Turning it off will be easiest, while going back to bootstrapping may require some patching, as I don't think that mode supports building macros in 5.9.0, though it may eventually in 5.9.2.