Skip to content

Conversation

@etcwilde
Copy link
Member

Jammy uses the gcc-11 aligned c/c++ libraries and runtimes, but we force-install the gcc-9 aligned versions. If you install any tools from the Ubuntu-official repositories (e.g libtool), you'll get error messages because clang will look for the C++ headers aligned with the newest gcc version (11), instead of what we installed (9), so folks need to know to manually install libstdc++-11-dev if they want to do that, which is bad.

$ echo "#include <cerrno>" | clang++ -std=c++11 -xc++ -c -o /dev/null -
$ apt update && apt install libtool
$ echo "#include <cerrno>" | clang++ -std=c++11 -xc++ -c -o /dev/null -
<stdin>:1:10: fatal error: 'cerrno' file not found
#include <cerrno>
         ^~~~~~~~
1 error generated.
$ apt install libstdc++-11-dev
$ echo "#include <cerrno>" | clang++ -std=c++11 -xc++ -c -o /dev/null -
$

apt info for gcc, which depends on gcc-11.

$ apt show gcc
Package: gcc
Version: 4:11.2.0-1ubuntu1
Priority: optional
Build-Essential: yes
Section: devel
Source: gcc-defaults (1.193ubuntu1)
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian GCC Maintainers <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 51.2 kB
Provides: c-compiler, gcc-aarch64-linux-gnu (= 4:11.2.0-1ubuntu1)
Depends: cpp (= 4:11.2.0-1ubuntu1), gcc-11 (>= 11.2.0-1~)
Recommends: libc6-dev | libc-dev
Suggests: gcc-multilib, make, manpages-dev, autoconf, automake, libtool, flex, bison, gdb, gcc-doc
Conflicts: gcc-doc (<< 1:2.95.3)
Task: ubuntustudio-video, ubuntustudio-publishing, ubuntu-mate-core, ubuntu-mate-desktop
Download-Size: 5128 B
APT-Manual-Installed: no
APT-Sources: http://ports.ubuntu.com/ubuntu-ports jammy/main arm64 Packages
Description: GNU C compiler

rdar://109112170

@etcwilde
Copy link
Member Author

@swift-ci please test

@etcwilde
Copy link
Member Author

Bot Failure:

Setting up curl (7.81.0-1ubuntu1.10) ...
�[91mgpg: keyserver receive failed: Connection timed out

@etcwilde
Copy link
Member Author

@swift-ci please test

1 similar comment
@tomerd
Copy link
Contributor

tomerd commented May 15, 2023

@swift-ci please test

Copy link
Contributor

@tomerd tomerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to do the same in other versions of ubuntu, or other distributions?

@tomerd
Copy link
Contributor

tomerd commented May 15, 2023

cc @weissi @MaxDesiatov

@tomerd
Copy link
Contributor

tomerd commented May 15, 2023

in any case, seems like we should also this for nightly-5.9 and nightly-main

@etcwilde
Copy link
Member Author

do we need to do the same in other versions of ubuntu, or other distributions?

It looks like Ubuntu 20.04 uses gcc-9, so the original should be fine there.

Then ubuntu 18.04 uses gcc-7/libstdc++-7-dev as its tool C++, so it would probably be a good idea to bump the versions here: https://github.com/apple/swift-docker/blob/main/5.8/ubuntu/18.04/Dockerfile#L14C19-L15

in any case, seems like we should also this for nightly-5.9 and nightly-main

Yes, good point.

@etcwilde
Copy link
Member Author

Bot Failure:

Setting up curl (7.81.0-1ubuntu1.10) ...
�[91mgpg: keyserver receive failed: Connection timed out

Ubuntu 22.04 tools use gcc-11 aligned C/C++ libraries and runtimes as
built by the distribution. The package for gcc-9 aligned versions are
available, but installing any tool (e.g libtool) from the official
repositories will install gcc-11 aligned runtimes. Clang will see this
version instead and go looking for the C++ headers that match the latest
version of gcc, which is 11. The tools don't necessarily install the
libstdc++-11 headers though, so clang will fail to find things like
iostream and friends. Swift runs and builds fine with the newer C++
library, so I'm updating all 22.04-aligned swift dockerfiles with the
version used by the system natively.
@etcwilde etcwilde force-pushed the ewilde/update-jammy-libstdc++ branch from 744ff1b to 24370b5 Compare May 16, 2023 16:03
@tomerd
Copy link
Contributor

tomerd commented May 16, 2023

@swift-ci please test

1 similar comment
@etcwilde
Copy link
Member Author

@swift-ci please test

@tomerd
Copy link
Contributor

tomerd commented May 16, 2023

@shahmishal do you know why this keeps failing on gpg keyserver?

@tomerd
Copy link
Contributor

tomerd commented May 16, 2023

@swift-ci please test

@shahmishal
Copy link
Member

keyserver.ubuntu.com might be having connection issues

@MaxDesiatov
Copy link
Contributor

I think I had the same CI issue with #337 2 months ago, so this breakage does not seem intermittent.

@tomerd
Copy link
Contributor

tomerd commented May 16, 2023

@shahmishal wdyt?

@shahmishal
Copy link
Member

@swift-ci please test

@shahmishal shahmishal merged commit b39c770 into swiftlang:main May 18, 2023
@etcwilde etcwilde deleted the ewilde/update-jammy-libstdc++ branch August 15, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants