Skip to content

Commit

Permalink
MULTIARCH-3441: Enable builds for s390x (openshift#1)
Browse files Browse the repository at this point in the history
- Update the .goreleaser.yaml to include s390x
- Update the cross build for s390x
- Link gcc to s390x-linux-gnu-gcc binary

On s390x go compiler seems to expect the gcc binary at
s390x-linux-gnu-gcc binary. However on rhel it is not installed there.

Signed-off-by: Jan Schintag <jan.schintag@de.ibm.com>
  • Loading branch information
jschintag committed May 24, 2023
1 parent 2efa317 commit 9022cd3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ builds:
goarch:
- amd64
- ppc64le
- s390x
env:
- CGO_ENABLED=1
flags:
Expand Down
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ RUN set -ex \
&& /usr/local/go/bin/go version \
&& ln -f /usr/local/go/bin/go /usr/bin/go

#################################################################################
# Link gcc to /usr/bin/s390x-linux-gnu-gcc as go requires it on s390x
RUN ARCH=$(arch | sed 's|x86_64|amd64|g') \
&& [ "${ARCH}" == "s390x" ] \
&& ln /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc \
|| echo "Not running on s390x, skip linking gcc binary"

WORKDIR /build
ENTRYPOINT ["make"]
CMD []
Expand Down
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ cross-build-linux-ppc64le:
+@GOOS=linux GOARCH=ppc64le $(MAKE) "$(GO_BUILD_FLAGS)" --no-print-directory build GO_BUILD_BINDIR=$(GO_BUILD_BINDIR)/linux-ppc64le
.PHONY: cross-build-linux-ppc64le

cross-build: cross-build-linux-amd64 cross-build-linux-ppc64le
cross-build-linux-s390x:
+@GOOS=linux GOARCH=s390x $(MAKE) "$(GO_BUILD_FLAGS)" --no-print-directory build GO_BUILD_BINDIR=$(GO_BUILD_BINDIR)/linux-s390x
.PHONY: cross-build-linux-s390x

cross-build: cross-build-linux-amd64 cross-build-linux-ppc64le cross-build-linux-s390x
.PHONY: cross-build

hack-build: clean
Expand Down Expand Up @@ -75,12 +79,12 @@ publish-catalog:
@cd test/operator && make
.PHONY: publish-catalog

format:
format:
$(GO) fmt ./pkg/...
$(GO) fmt ./cmd/...
.PHONY: format

vet:
$(GO) vet $(GO_BUILD_FLAGS) ./pkg/...
$(GO) vet $(GO_BUILD_FLAGS) ./cmd/...
.PHONY: vet
vet:
$(GO) vet $(GO_BUILD_FLAGS) ./pkg/...
$(GO) vet $(GO_BUILD_FLAGS) ./cmd/...
.PHONY: vet

0 comments on commit 9022cd3

Please sign in to comment.