From e36a3085610b35453a53648a547ac22762b2686c Mon Sep 17 00:00:00 2001 From: Evan Wilde Date: Tue, 6 Jun 2023 16:30:49 -0700 Subject: [PATCH] Force linux builds off of base toolchain UBI9 installs the gcc-12 aligned toolchain as a dependency for clang. Clang picks up the gcc-12 aligned toolchain and symbols and adds a call to `glibcxx::__assert_fail`, which is not in the gcc-11 aligned libstdc++. To work with this when dynamically linking, the gcc-12 toolset contains a `libstdc++_noshared.a` static archive, which gets linked into the shared libraries and executables much like our compatibility libraries, and provides the missing symbols on top of the gcc-11 runtime that is already on UBI9 systems. Of course, folks want to be able to statically link the stdlib into their binaries, and we avoid overlinking and symbol collisions by not linking the libstdc++_noshared.a static archive into the libswiftCore.a. Of course, this means that there is no definition for the symbol when it comes time to link the static stdlib on a base UBI9 image. I've decided to just build the library against what is installed on the base system, so that we don't need to install anything additional to build and copy the binary to other systems running the same OS. --- utils/build-presets.ini | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/build-presets.ini b/utils/build-presets.ini index 948dd5c94e409..d39b1884932de 100644 --- a/utils/build-presets.ini +++ b/utils/build-presets.ini @@ -918,6 +918,11 @@ mixin-preset= mixin_lightweight_assertions,no-stdlib-asserts buildbot_linux_base +extra-cmake-options= + -DCMAKE_C_FLAGS="--gcc-toolchain=/usr" + -DCMAKE_CXX_FLAGS="--gcc-toolchain=/usr" + -DCMAKE_Swift_FLAGS="-Xcc --gcc-toolchain=/usr -Xclang-linker --gcc-toolchain=/usr" + [preset: buildbot_linux,no_assertions] mixin-preset=buildbot_linux_base