Skip to content

Commit

Permalink
Disable dynamic linking for non amd64 compiling. Can't
Browse files Browse the repository at this point in the history
find proper cross compiler glibc library that works.

Signed-off-by: Alexander Wels <awels@redhat.com>
  • Loading branch information
awels committed Jul 18, 2023
1 parent a4050c9 commit 8a34b14
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
11 changes: 10 additions & 1 deletion hack/build-csi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,14 @@
script_dir="$(cd "$(dirname "$0")" && pwd -P)"
source "${script_dir}"/common.sh
setGoInProw $GOLANG_VER
type go
go version
echo $GOOS $GOARCH
if [ "${GOARCH}" != "amd64" ]; then
#disable dynamic linking for non amd64 architectures. Don't have a proper cross compiler to make this
#work. In particular can't find a glibc that can be installed.
CGO_ENABLED=0 go build -a -o _out/hostpath-csi-driver cmd/plugin/plugin.go
else
CGO_ENABLED=1 go build -a -tags strictfipsruntime -o _out/hostpath-csi-driver cmd/plugin/plugin.go
fi

CGO_ENABLED=1 go build -a -tags strictfipsruntime -o _out/hostpath-csi-driver cmd/plugin/plugin.go
9 changes: 7 additions & 2 deletions hack/build-provisioner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,10 @@
script_dir="$(cd "$(dirname "$0")" && pwd -P)"
source "${script_dir}"/common.sh
setGoInProw $GOLANG_VER

CGO_ENABLED=1 go build -a -tags strictfipsruntime -o _out/hostpath-provisioner cmd/provisioner/hostpath-provisioner.go
if [ "${GOARCH}" != "amd64" ]; then
#disable dynamic linking for non amd64 architectures. Don't have a proper cross compiler to make this
#work. In particular can't find a glibc that can be installed.
CGO_ENABLED=0 go build -a -o _out/hostpath-provisioner cmd/provisioner/hostpath-provisioner.go
else
CGO_ENABLED=1 go build -a -tags strictfipsruntime -o _out/hostpath-provisioner cmd/provisioner/hostpath-provisioner.go
fi
3 changes: 0 additions & 3 deletions hack/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ function setGoInProw() {
if [[ -v PROW_JOB_ID ]] ; then
export GIMME_HOSTARCH=amd64
export GIMME_ARCH=${GOARCH}
if [ "${GOARCH}" == "arm64" ]; then
dnf install -y gcc-aarch64-linux-gnu
fi
eval $(gimme ${1})
echo "~/.gimme/versions/go${1}.linux.${GOARCH}"
cp -R ~/.gimme/versions/go${1}.linux.${GOARCH} /usr/local/go
Expand Down

0 comments on commit 8a34b14

Please sign in to comment.