Skip to content
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

Update all GNU docker images to latest LTS version on Docker. #591

Merged
merged 2 commits into from
Jul 16, 2022

Conversation

Alexhuszagh
Copy link
Contributor

@Alexhuszagh Alexhuszagh commented Sep 6, 2021

Increment Ubuntu base image versions to 20.04.

Update linux-image script to latest kernel and debian versions.

Update by default to kernel version 5.10.0-8. This means updating our debian source to bullseye from buster. 32-bit big-endian mips was discontinued in bullseye, so we revert to buster. For some images, due to constantly updating linux kernel versions, we need to use wildcards otherwise the build step breaks. Since there may be more than one relevant package, we've added a function to manually expand wildcards and select the best kernel version, max_kernel_version. Likewise, on 32-bit big-endian mips, we need to specify the ncurses version.

Created temporary symlinks for autconf and autom4te due to the build expecting a hard-coded version (2.69) of these binaries. Fixed the patch for debian/rules due to changed line numbers. Updated the patch to use dwarf rather than sjlj exceptions to patch the template file (debian/gcc-mingw-w64-i686.install.in) since debian/gcc-mingw-w64-i686.install is overwritten during the build.

For x86_64-unknown-linux-gnu, building the linux image fails unless we download specific versions of libgcc-s1 and libstdc++6, since the pre-installed Ubuntu versions are higher than the Debian versions. We therefore extract the specific versions. However, while building the linux image, it prefers these system versions, so we must uninstall them or else while running qemu-system it cannot find libgcc_s1.so.1. Since apt and basically every other package besides dpkg relies on libgcc-s1, we have to temporarily delete it and reinstall it.

Closes #616.
Closes #557. We've already addressed the Qemu fixes, which will be applied automatically.
Closes #517.
Closes #417.

Replaces #481.

@Emilgardis Emilgardis added breaking change S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Sep 6, 2021
@Alexhuszagh
Copy link
Contributor Author

Alexhuszagh commented Sep 6, 2021

Most of the build errors seem to be from spurious network errors, but if any other of the build steps are failing, please let me know so I fix the images.

@deftsp
Copy link

deftsp commented Sep 7, 2021

./build-docker-image.sh x86_64-unknown-linux-gnu
#20 96.75 + apt-get update
#20 97.32 Get:1 http://security.debian.org bullseye-security InRelease [44.1 kB]
#20 97.83 Get:2 http://security.debian.org bullseye-security/main amd64 Packages [35.7 kB]
#20 103.1 Get:3 http://cdn-fastly.deb.debian.org/debian bullseye InRelease [113 kB]
#20 103.7 Get:4 http://cdn-fastly.deb.debian.org/debian bullseye/main amd64 Packages [11.1 MB]
#20 110.0 Fetched 11.3 MB in 13s (855 kB/s)
#20 110.0 Reading package lists...
#20 110.5 + mkdir -p /qemu/amd64
#20 110.5 + chmod 777 /qemu /qemu/amd64
#20 110.5 + cd /qemu/amd64
#20 110.5 + apt-get -d --no-install-recommends download busybox:amd64 dropbear-bin:amd64 libtommath1:amd64 libtomcrypt1:amd64 libgmp10:amd64 libc6:amd64 libgcc-s1:amd64 libstdc++6:amd64 linux-image-5.10.0-8-amd64:amd64 ncurses-base zlib1g:amd64
#20 111.3 E: Can't find a source to download version '10.3.0-1ubuntu1~20.04' of 'libgcc-s1:amd64'
#20 111.3 E: Can't find a source to download version '10.3.0-1ubuntu1~20.04' of 'libstdc++6:amd64'
#20 111.3 E: Can't find a source to download version '1:1.2.11.dfsg-2ubuntu1.2' of 'zlib1g:amd64'

@ChriFo
Copy link

ChriFo commented Oct 1, 2021

To build the i686-pc-windows-gnu image I had to adjust the mingw.sh:

@@ -37,7 +37,7 @@
     pushd gcc-mingw-w64-*

     # We are using dwarf exceptions instead of sjlj
-    sed -i -e 's/libgcc_s_sjlj-1/libgcc_s_dw2-1/g' debian/gcc-mingw-w64-i686.install
+    sed -i -e 's/libgcc_s_sjlj-1/libgcc_s_dw2-1/g' debian/gcc-mingw-w64-i686.install.in

     # Only build i686 packages (disable x86_64)
     patch -p0 <<'EOF'
@@ -90,8 +90,7 @@
      BUILD_TARGET :=
      INSTALL_TARGET := install install-lto-plugin
  endif
-@@ -85,7 +85,7 @@
 	touch $@
+@@ -87,6 +87,6 @@
  	touch $@

 -targets := i686-w64-mingw32 x86_64-w64-mingw32
@@ -99,7 +98,7 @@
  threads := posix win32

  # Hardening on the host, none on the target
-@@ -216,6 +216,10 @@
+@@ -220,6 +220,10 @@
  # Enable libatomic
  CONFFLAGS += \
  	--enable-libatomic
 # Enable dwarf exceptions
 +CONFFLAGS += \
 +	--disable-sjlj-exceptions \
 +	--with-dwarf2
- # Enable experimental::filesystem
+ # Enable experimental::filesystem and std::filesystem
  CONFFLAGS += \
  	--enable-libstdcxx-filesystem-ts=yes

@ChriFo
Copy link

ChriFo commented Oct 2, 2021

./build-docker-image.sh x86_64-unknown-linux-gnu
#20 96.75 + apt-get update
#20 97.32 Get:1 http://security.debian.org bullseye-security InRelease [44.1 kB]
#20 97.83 Get:2 http://security.debian.org bullseye-security/main amd64 Packages [35.7 kB]
#20 103.1 Get:3 http://cdn-fastly.deb.debian.org/debian bullseye InRelease [113 kB]
#20 103.7 Get:4 http://cdn-fastly.deb.debian.org/debian bullseye/main amd64 Packages [11.1 MB]
#20 110.0 Fetched 11.3 MB in 13s (855 kB/s)
#20 110.0 Reading package lists...
#20 110.5 + mkdir -p /qemu/amd64
#20 110.5 + chmod 777 /qemu /qemu/amd64
#20 110.5 + cd /qemu/amd64
#20 110.5 + apt-get -d --no-install-recommends download busybox:amd64 dropbear-bin:amd64 libtommath1:amd64 libtomcrypt1:amd64 libgmp10:amd64 libc6:amd64 libgcc-s1:amd64 libstdc++6:amd64 linux-image-5.10.0-8-amd64:amd64 ncurses-base zlib1g:amd64
#20 111.3 E: Can't find a source to download version '10.3.0-1ubuntu1~20.04' of 'libgcc-s1:amd64'
#20 111.3 E: Can't find a source to download version '10.3.0-1ubuntu1~20.04' of 'libstdc++6:amd64'
#20 111.3 E: Can't find a source to download version '1:1.2.11.dfsg-2ubuntu1.2' of 'zlib1g:amd64'

Maybe a bad hack... but when adding the following lines under line 12 in linux-image.sh:

    debsource="${debsource}\ndeb http://archive.ubuntu.com/ubuntu focal main"
    debsource="${debsource}\ndeb http://archive.ubuntu.com/ubuntu focal-updates main"

building x86_64-unknown-linux-gnu succeeded.

@Xuanwo
Copy link

Xuanwo commented Dec 13, 2021

What's going on here? Is there any help I can provide?

@Amanieu
Copy link

Amanieu commented Feb 23, 2022

Any updates on this?

@svenstaro
Copy link
Contributor

Any updates on this?

Currently needs someone to fix #609. Perhaps you can help?

@Alexhuszagh
Copy link
Contributor Author

Sorry for the delay, this is back on my priority list and will be working on this shortly.

@Emilgardis
Copy link
Member

bors try --target unknown-linux

bors bot added a commit that referenced this pull request Mar 18, 2022
@bors
Copy link
Contributor

bors bot commented Mar 18, 2022

try

Build failed:

@Alexhuszagh
Copy link
Contributor Author

Sorry this should be converted to a draft: this commit was simply to rebase to the current codebase, to avoid merge conflicts, and I'm tracking the list of all images that fail to build and annotating the reasons for their failure.

@Alexhuszagh
Copy link
Contributor Author

Alexhuszagh commented Mar 20, 2022

What's going on here? Is there any help I can provide?

@Xuanwo Sorry for the delay, I'm currently fixing the following images:

  • mips-unknown-linux-gnu
    • /usr/bin/ld: cannot find -lmount
  • mipsel-unknown-linux-gnu
    • Unable to locate package linux-image-5.10.0-8-4kc-malta:mipsel
  • mips64el-unknown-linux-gnuabi64
    • Unable to locate package linux-image-5.10.0-8-5kc-malta:mips64el
  • powerpc64le-unknown-linux-gnu
    • Unable to locate package linux-image-5.10.0-8-powerpc64le:ppc64el
  • s390x-unknown-linux-gnu
    • Unable to locate package linux-image-5.10.0-8-s390x:s390x
  • x86_64-unknown-linux-gnu
    • Can't find a source to download version '10.3.0-1ubuntu1~20.04' of 'libgcc-s1:amd64'

This is non-exhaustive and some of these should be trivial to fix, but if you are willing to submit PRs for any of these, it would be great.

For some, like libgcc-s1, it's a simple issue of the package name changing. For some, the supported kernel versions have changed, and for a few this requires essentially building everything from source if I remember correctly.

If you would like to submit patches for any of these, feel free to submit a PR on my fork, and I'd recommend starting at their of the first 2.

Make sure you run the following commands to test the code:

# This is an example export, all can be seen in `build_all.sh`.
# export TARGET=arm-unknown-linux-musleabihf STD=1 RUN=1 
./build-docker-image.sh "$TARGET"
ci/test.sh

This should require a nightly compiler for the tests, and for some very recent ones, I've been getting an issue with the manifest being unknown after some tests run. This isn't a big issue and they pass the CI tests, so failing with that error counts as a successful build locally.

The branch to submit PRs to can be found here.

@Emilgardis Emilgardis marked this pull request as draft March 20, 2022 15:52
@Alexhuszagh
Copy link
Contributor Author

In addition, the package armv5te-unknown-linux-gnueabi fails because of #593. This is because tzdata requires interactive prompts, so it cannot be built in an automated manner. Merging #593 should fix this issue.

@Alexhuszagh
Copy link
Contributor Author

Ok I've added numerous fixes for updating the Docker Ubuntu versions, and the only issues remaining are:

Interactive Issues

  • armv5te-unknown-linux-gnueabi
  • i686-pc-windows-gnu

Package Name Issues

  • x86_64-unknown-linux-gnu: Can't find a source to download version '10.3.0-1ubuntu1~20.04' of 'libgcc-s1:amd64'

Docker Dependency Issue

  • asmjs-unknown-emscripten: failed to load cache key: docker.io/trzeci/emscripten:1.39.20-upstream: not found
  • wasm32-unknown-emscripten: failed to load cache key: docker.io/trzeci/emscripten:1.39.20-upstream: not found

Other Issues

  • x86_64-unknown-linux-gnu: Can't find a source to download version '10.3.0-1ubuntu1~20.04' of 'libgcc-s1:amd64'
  • x86_64-apple-darwin (likely due to missing build dependencies since I'm running Linux)
  • x86_64-pc-windows-msvc (likely due to missing build dependencies since I'm running Linux)

Kernel Selection Logic

@Emilgardis Due to the use of backports or certain kernel versions which might not be stable (for example, 5.10.0-8 isn't present anymore on s390x, however, 5.10.0-9 is, I've added the following code to select the best (newest) kernel version from a wildcard:

max_kernel_version() {
    # kernel versions have the following format:
    #   `5.10.0-10-$arch`, where the `$arch` may be optional.
    local IFS=$'\n'
    local -a versions
    local major=0
    local minor=0
    local patch=0
    local release=0
    local index=0

    read -r -d '' -a versions <<< "$1"
    for i in "${!versions[@]}"; do
        local version="${versions[$i]}"
        local x=$(echo "$version" | cut -d '.' -f 1)
        local y=$(echo "$version" | cut -d '.' -f 2)
        local z=$(echo "$version" | cut -d '.' -f 3 | cut -d '-' -f 1)
        local r=$(echo "$version" | cut -d '-' -f 2)
        local is_larger=

        if [ "$x" -gt "$major" ]; then
            is_larger=1
        elif [ "$x" -eq "$major" ] && [ "$y" -gt "$minor" ]; then
            is_larger=1
        elif [ "$x" -eq "$major" ] && [ "$y" -eq "$minor" ] && [ "$z" -gt "$patch" ]; then
            is_larger=1
        elif [ "$x" -eq "$major" ] && [ "$y" -eq "$minor" ] && [ "$z" -eq "$patch" ] && [ "$r" -gt "$release" ]; then
            is_larger=1
        fi

        if [ -n "$is_larger" ]; then
            index="$i"
            major="$x"
            minor="$y"
            patch="$z"
            release="$r"
        fi
    done

    echo "${versions[index]}"
}

Any review of this code would be wonderful.

@Emilgardis
Copy link
Member

  • asmjs-unknown-emscripten: failed to load cache key: docker.io/trzeci/emscripten:1.39.20-upstream: not found

  • wasm32-unknown-emscripten: failed to load cache key: docker.io/trzeci/emscripten:1.39.20-upstream: not found

Feel free to ignore these, they are disabled in CI

@Emilgardis
Copy link
Member

@Alexhuszagh I added you as a member to bors so you can run bors try

please fix the conflict

@Alexhuszagh Alexhuszagh force-pushed the increment_versions branch 2 times, most recently from 15b6c99 to 63b9e51 Compare July 12, 2022 16:20
@Emilgardis
Copy link
Member

try again?

@Alexhuszagh
Copy link
Contributor Author

try again?

I still have to fix the FreeBSD issue.

Update linux-image script to latest kernel and debian versions.

Update by default to kernel version 5.10.0-8. This means updating our debian source to bullseye from buster. 32-bit big-endian mips was discontinued in bullseye, so we revert to buster. For some images, due to constantly updating linux kernel versions, we need to use wildcards otherwise the build step breaks. Since there may be more than one relevant package, we've added a function to manually expand wildcards and select the best kernel version, `max_kernel_version`. Likewise, on 32-bit big-endian mips, we need to specify the ncurses version.

Created temporary symlinks for autconf and autom4te due to the build expecting a hard-coded version (2.69) of these binaries. Fixed the patch for `debian/rules` due to changed line numbers. Updated the patch to use dwarf rather than sjlj exceptions to patch the template file (`debian/gcc-mingw-w64-i686.install.in`) since `debian/gcc-mingw-w64-i686.install` is overwritten during the build.

For `x86_64-unknown-linux-gnu`, building the linux image fails unless we download specific versions of `libgcc-s1` and `libstdc++6`, since the pre-installed Ubuntu versions are higher than the Debian versions. We therefore extract the specific versions. However, while building the linux image, it prefers these system versions, so we must uninstall them or else while running `qemu-system` it cannot find `libgcc_s1.so.1`. Since `apt` and basically every other package besides `dpkg` relies on `libgcc-s1`, we have to temporarily delete it and reinstall it.
@Alexhuszagh

This comment was marked as outdated.

bors bot added a commit that referenced this pull request Jul 15, 2022
@bors

This comment was marked as outdated.

@Alexhuszagh
Copy link
Contributor Author

bors try --target x86_64-unknown-freebsd

bors bot added a commit that referenced this pull request Jul 15, 2022
@bors
Copy link
Contributor

bors bot commented Jul 16, 2022

try

Build succeeded:

@Alexhuszagh
Copy link
Contributor Author

bors r=Emilgardis

bors bot added a commit that referenced this pull request Jul 16, 2022
591: Update all GNU docker images to latest LTS version on Docker. r=Emilgardis a=Alexhuszagh

Increment Ubuntu base image versions to 20.04.

Update linux-image script to latest kernel and debian versions.

Update by default to kernel version 5.10.0-8. This means updating our debian source to bullseye from buster. 32-bit big-endian mips was discontinued in bullseye, so we revert to buster. For some images, due to constantly updating linux kernel versions, we need to use wildcards otherwise the build step breaks. Since there may be more than one relevant package, we've added a function to manually expand wildcards and select the best kernel version, `max_kernel_version`. Likewise, on 32-bit big-endian mips, we need to specify the ncurses version.

Created temporary symlinks for autconf and autom4te due to the build expecting a hard-coded version (2.69) of these binaries. Fixed the patch for `debian/rules` due to changed line numbers. Updated the patch to use dwarf rather than sjlj exceptions to patch the template file (`debian/gcc-mingw-w64-i686.install.in`) since `debian/gcc-mingw-w64-i686.install` is overwritten during the build.

For `x86_64-unknown-linux-gnu`, building the linux image fails unless we download specific versions of `libgcc-s1` and `libstdc++6`, since the pre-installed Ubuntu versions are higher than the Debian versions. We therefore extract the specific versions. However, while building the linux image, it prefers these system versions, so we must uninstall them or else while running `qemu-system` it cannot find `libgcc_s1.so.1`. Since `apt` and basically every other package besides `dpkg` relies on `libgcc-s1`, we have to temporarily delete it and reinstall it.

Closes #616.
Closes #557. We've already addressed the Qemu fixes, which will be applied automatically.
Closes #517.
Closes #417.

Replaces #481.

Co-authored-by: Alex Huszagh <ahuszagh@gmail.com>
@bors
Copy link
Contributor

bors bot commented Jul 16, 2022

Build failed:

@Alexhuszagh
Copy link
Contributor Author

bors try --target mips-unknown-linux-gnu

bors bot added a commit that referenced this pull request Jul 16, 2022
@Alexhuszagh
Copy link
Contributor Author

bors r=Emilgardis

@bors
Copy link
Contributor

bors bot commented Jul 16, 2022

try

Build succeeded:

@bors
Copy link
Contributor

bors bot commented Jul 16, 2022

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants