Skip to content

Fix s390x dynamic loader symlink #672

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

Merged
merged 1 commit into from
Apr 11, 2025
Merged
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
3 changes: 2 additions & 1 deletion cmd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ build: semvalidator-build-$(ARCH)

.PHONY: semvalidator-build-$(ARCH)
semvalidator-build-$(ARCH): semvalidator/main.go
CGO_ENABLED=0 go build -o bin/semvalidator-$(ARCH) -v -buildvcs=false -ldflags "-s -w" semvalidator/main.go
CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) \
go build -o bin/semvalidator-$(ARCH) -v -buildvcs=false -ldflags "-s -w" semvalidator/main.go

.PHONY: clean
clean:
Expand Down
10 changes: 10 additions & 0 deletions images/calico-base/Dockerfile.ubi8
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest AS ubi

ARG LDSONAME
ARG TARGETARCH

RUN microdnf upgrade -y

Expand All @@ -9,11 +10,16 @@ RUN microdnf upgrade -y
RUN mkdir -p /rootfs/lib64 /rootfs/etc

# Copy dynamic loader and symbolic links.
# For s390x architecture, modify the /lib/${LDSONAME} symlink to ../lib64/${LDSONAME}
# instead of /usr/lib64 as the /usr/lib64 directory is not included in our base.
RUN cp /lib64/ld-2.28.so /rootfs/lib64/ld-2.28.so
RUN set -eux; \
cp -a /lib64/${LDSONAME} /rootfs/lib64/${LDSONAME}; \
if [ -f /lib/${LDSONAME} ]; then \
mkdir -p /rootfs/lib && cp -a /lib/${LDSONAME} /rootfs/lib/${LDSONAME}; \
if [ "${TARGETARCH}" = "s390x" ]; then \
ln -sf ../lib64/${LDSONAME} /rootfs/lib/${LDSONAME}; \
fi \
fi

# Required external C dependencies for CGO builds.
Expand All @@ -37,6 +43,10 @@ FROM scratch AS source

COPY --from=ubi /rootfs /

# Verify if glibc can be properly loaded.
# This check ensures that the dynamic loader and symbolic links are copied correctly.
RUN ["/lib64/libc.so.6"]

# tmp.tar has a /tmp with the correct permissions 01777.
ADD tmp.tar /

Expand Down
4 changes: 4 additions & 0 deletions images/calico-base/Dockerfile.ubi9
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ FROM scratch AS source

COPY --from=ubi /rootfs /

# Verify if glibc is properly loaded.
# This check ensures that the dynamic loader and symbolic links are copied correctly.
RUN ["/lib64/libc.so.6"]

# tmp.tar has a /tmp with the correct permissions 01777.
ADD tmp.tar /

Expand Down