-
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
Force linux builds off of base toolchain #66398
Force linux builds off of base toolchain #66398
Conversation
CC: @FranzBusch |
@swift-ci please test |
@swift-ci please build linux toolchain |
Linux failure:
|
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.
b3417f2
to
e36a308
Compare
@swift-ci please test |
Windows failure:
|
Amazing investigation @etcwilde! Thanks for doing this. I agree with your sentiment that we should be doing this for all Linux platforms to make sure we are not picking up any gcc that is installed after the fact and might break on the base images. |
@swift-ci please test windows |
Alright, on a fresh ubi9 with the
|
@swift-ci build toolchain linux |
@swift-ci build toolchain ubi9 |
@swift-ci build toolchain CentOS 7 |
@swift-ci build toolchain Ubuntu 18.04 |
@swift-ci build toolchain Ubuntu 22.04 |
@swift-ci build toolchain Amazon Linux 2 |
CentOS 7 failure:
|
So yes, it looks like we'll need different configurations to handle building the different distros. The C++ stdlib on centOS 7 is too old. |
We definitely need to line up the installed dependencies for the toolchains here with the installed dependencies in the docker images then. @shahmishal can we come up with a way so this doesn’t get out of sync |
Do we know why it's out of sync? Is it because CentOS does not support newer version? @FranzBusch |
@etcwilde pointed out that we need to install newer gcc versions for some toolchain builds. We also need these to be installed in the respective docker images right? |
Just saw everything works except CentOS7 and UBI9. Need to check why UBI9 failed |
You can ignore the check of
|
All of the platforms passed except for CentOS 7. |
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 think it would be ok to merge this as is and deal with the CentOS 7 failure separately.
I'm waiting for discussions on swiftlang/swift-docker#341 to be resolved. CentOS 7 is a little odd since the base is so old, so it will need its own configuration and will need to build against the special devtoolset. In that case we'll want to ensure that the build images have the extra toolset as well, but I want to make sure that the clang that we're installing from our toolchain actually behaves correctly too. |
Checked static linking with 5.9.2 and 5.10.1, and bot are working. Closing this. |
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 alibstdc++_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.
This should fix the linking issue in #65097
In theory, this should actually work for all of the Linux images and ensure that we're actually building the Linux toolchains based on what is actually available on the base system and not what is installed with the toolchain-build-dependencies.