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

build: update base image to Fedora 41 #244

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM public.ecr.aws/docker/library/fedora:39 AS base
FROM public.ecr.aws/docker/library/fedora:41 AS base

# Everything we need to build our SDK and packages.
RUN \
dnf config-manager setopt fedora-cisco-openh264.enabled=0 && \
dnf makecache && \
dnf -y update && \
dnf -y install --setopt=install_weak_deps=False \
Expand All @@ -28,6 +29,7 @@ RUN \
meson \
openssl \
openssl-devel \
openssl-devel-engine \
p11-kit-devel \
perl-ExtUtils-MakeMaker \
perl-FindBin \
Expand All @@ -38,9 +40,6 @@ RUN \
wget \
which \
&& \
dnf config-manager --set-disabled \
fedora-cisco-openh264 \
&& \
useradd builder
COPY ./sdk-fetch /usr/local/bin

Expand Down Expand Up @@ -425,9 +424,9 @@ RUN \
sdk-fetch /home/builder/hashes && \
rpm2cpio "grub2-${GRUB_VER}.src.rpm" \
| cpio -iu \
"grub-${GRUB_VER%%-*}.tar.xz" \
bootstrap bootstrap.conf gitignore \
"gnulib-*.tar.gz" "*.patch" && \
"./grub-${GRUB_VER%%-*}.tar.xz" \
./bootstrap ./bootstrap.conf ./gitignore \
"./gnulib-*.tar.gz" "./*.patch" && \
rm "grub2-${GRUB_VER}.src.rpm" && \
mkdir "grub-${GRUB_VER}" && \
cd "grub-${GRUB_VER}" && \
Expand Down Expand Up @@ -561,7 +560,7 @@ USER builder
WORKDIR /home/builder/sdk-go

COPY ./hashes/go-${GOMAJOR} /home/builder/hashes-go
COPY ./helpers/go/* ./
COPY ./helpers/go/prep-go.sh ./
COPY ./patches/go-${GOMAJOR} /home/builder/patches-go

COPY ./hashes/aws-lc /home/builder/hashes-aws-lc
Expand All @@ -584,7 +583,7 @@ USER builder
WORKDIR /home/builder/sdk-go

COPY ./hashes/go-${GOMAJOR} /home/builder/hashes-go
COPY ./helpers/go/* ./
COPY ./helpers/go/prep-go.sh ./
COPY ./patches/go-${GOMAJOR} /home/builder/patches-go

COPY ./hashes/aws-lc /home/builder/hashes-aws-lc
Expand Down Expand Up @@ -680,7 +679,7 @@ COPY --from=sdk-go-1.23-aws-lc-musl-aarch64 \
/home/builder/aws-lc/build/goboringcrypto_linux_arm64.syso \
/home/builder/sdk-go/src/crypto/internal/boring/syso/goboringcrypto_linux_musl_arm64.syso

COPY ./helpers/go/* ./
COPY ./helpers/go/build-go.sh ./

# Build Go - finally!
RUN ./build-go.sh --go-version=${GO123VER}
Expand All @@ -705,7 +704,7 @@ COPY --from=sdk-go-1.22-aws-lc-musl-aarch64 \
/home/builder/aws-lc/build/goboringcrypto_linux_arm64.syso \
/home/builder/sdk-go/src/crypto/internal/boring/syso/goboringcrypto_linux_musl_arm64.syso

COPY ./helpers/go/* ./
COPY ./helpers/go/build-go.sh ./

# Build Go - finally!
RUN ./build-go.sh --go-version=${GO122VER}
Expand Down Expand Up @@ -1096,7 +1095,6 @@ RUN \
createrepo_c \
dosfstools \
e2fsprogs \
efitools \
erofs-utils \
flatbuffers-compiler \
gdisk \
Expand Down Expand Up @@ -1451,8 +1449,16 @@ COPY \
./configs/docker/docker-cli.json \
/home/builder/.docker/config.json

# Forcibly undefine the auto_set_build_flags macros, since it no longer works to
# undefine it when rpmbuild is invoked (as of RPM 4.20).
RUN \
sed -i '/%_auto_set_build_flags 1/d' \
/usr/lib/rpm/redhat/macros

# Reset permissions for `builder`.
RUN chown builder:builder -R /home/builder
RUN \
mkdir -p /home/builder && \
chown builder:builder -R /home/builder

USER builder
RUN rpmdev-setuptree
Expand Down
46 changes: 46 additions & 0 deletions patches/go-1.22/0003-Default-to-ld.bfd-on-ARM64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
From 46ec67413008607e2150e3395668e54e538c5b6b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alejandro=20S=C3=A1ez?= <[email protected]>
Date: Wed, 19 Jun 2024 10:18:58 +0200
Subject: [PATCH] Default to ld.bfd on ARM64

---
src/cmd/link/internal/ld/lib.go | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
index eab74dc328..b401f58727 100644
--- a/src/cmd/link/internal/ld/lib.go
+++ b/src/cmd/link/internal/ld/lib.go
@@ -1620,22 +1620,16 @@ func (ctxt *Link) hostlink() {
}

if ctxt.Arch.InFamily(sys.ARM64) && buildcfg.GOOS == "linux" {
- // On ARM64, the GNU linker will fail with
- // -znocopyreloc if it thinks a COPY relocation is
- // required. Switch to gold.
- // https://sourceware.org/bugzilla/show_bug.cgi?id=19962
- // https://go.dev/issue/22040
- altLinker = "gold"
-
- // If gold is not installed, gcc will silently switch
- // back to ld.bfd. So we parse the version information
- // and provide a useful error if gold is missing.
+ // Use ld.bfd as the default linker
+ altLinker = "bfd"
Comment on lines +21 to +29
Copy link
Contributor

Choose a reason for hiding this comment

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

Given the context in the linked issues, I assume upstream will probably also converge back to bfd. Seems like the reason for the switch to gold in the first place is resolved upstream, and gold is on a deprecation path.

+
+ // Provide a useful error if ld.bfd is missing
name, args := flagExtld[0], flagExtld[1:]
- args = append(args, "-fuse-ld=gold", "-Wl,--version")
+ args = append(args, "-fuse-ld=bfd", "-Wl,--version")
cmd := exec.Command(name, args...)
if out, err := cmd.CombinedOutput(); err == nil {
- if !bytes.Contains(out, []byte("GNU gold")) {
- log.Fatalf("ARM64 external linker must be gold (issue #15696, 22040), but is not: %s", out)
+ if !bytes.Contains(out, []byte("GNU ld")) {
+ log.Fatalf("ARM64 external linker must be ld.bfd, but is not: %s", out)
}
}
}
--
2.45.1

46 changes: 46 additions & 0 deletions patches/go-1.23/0003-Default-to-ld.bfd-on-ARM64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
From 46ec67413008607e2150e3395668e54e538c5b6b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alejandro=20S=C3=A1ez?= <[email protected]>
Date: Wed, 19 Jun 2024 10:18:58 +0200
Subject: [PATCH] Default to ld.bfd on ARM64

---
src/cmd/link/internal/ld/lib.go | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
index eab74dc328..b401f58727 100644
--- a/src/cmd/link/internal/ld/lib.go
+++ b/src/cmd/link/internal/ld/lib.go
@@ -1620,22 +1620,16 @@ func (ctxt *Link) hostlink() {
}

if ctxt.Arch.InFamily(sys.ARM64) && buildcfg.GOOS == "linux" {
- // On ARM64, the GNU linker will fail with
- // -znocopyreloc if it thinks a COPY relocation is
- // required. Switch to gold.
- // https://sourceware.org/bugzilla/show_bug.cgi?id=19962
- // https://go.dev/issue/22040
- altLinker = "gold"
-
- // If gold is not installed, gcc will silently switch
- // back to ld.bfd. So we parse the version information
- // and provide a useful error if gold is missing.
+ // Use ld.bfd as the default linker
+ altLinker = "bfd"
+
+ // Provide a useful error if ld.bfd is missing
name, args := flagExtld[0], flagExtld[1:]
- args = append(args, "-fuse-ld=gold", "-Wl,--version")
+ args = append(args, "-fuse-ld=bfd", "-Wl,--version")
cmd := exec.Command(name, args...)
if out, err := cmd.CombinedOutput(); err == nil {
- if !bytes.Contains(out, []byte("GNU gold")) {
- log.Fatalf("ARM64 external linker must be gold (issue #15696, 22040), but is not: %s", out)
+ if !bytes.Contains(out, []byte("GNU ld")) {
+ log.Fatalf("ARM64 external linker must be ld.bfd, but is not: %s", out)
}
}
}
--
2.45.1