swiftlang / swift-docker

Docker Official Image packaging for Swift
https://swift.org
Apache License 2.0
1.36k stars 182 forks source link

Update Jammy dockerfile libstdc++ version #340

Closed etcwilde closed 1 year ago

etcwilde commented 1 year ago

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 <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
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 commented 1 year ago

@swift-ci please test

etcwilde commented 1 year ago

Bot Failure:

Setting up curl (7.81.0-1ubuntu1.10) ...
gpg: keyserver receive failed: Connection timed out
etcwilde commented 1 year ago

@swift-ci please test

tomerd commented 1 year ago

@swift-ci please test

tomerd commented 1 year ago

cc @weissi @MaxDesiatov

tomerd commented 1 year ago

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

etcwilde commented 1 year ago

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 commented 1 year ago

Bot Failure:

Setting up curl (7.81.0-1ubuntu1.10) ...
gpg: keyserver receive failed: Connection timed out
tomerd commented 1 year ago

@swift-ci please test

etcwilde commented 1 year ago

@swift-ci please test

tomerd commented 1 year ago

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

tomerd commented 1 year ago

@swift-ci please test

shahmishal commented 1 year ago

keyserver.ubuntu.com might be having connection issues

MaxDesiatov commented 1 year ago

I think I had the same CI issue with https://github.com/apple/swift-docker/pull/337 2 months ago, so this breakage does not seem intermittent.

tomerd commented 1 year ago

@shahmishal wdyt?

shahmishal commented 1 year ago

@swift-ci please test