From a1cedc567ab4d3114903261cbdee34195e14fcc2 Mon Sep 17 00:00:00 2001 From: Jakob Naucke Date: Thu, 14 Jan 2021 16:27:09 +0100 Subject: [PATCH 1/2] agent: Build for glibc on s390x Since there is no Rust target for musl on s390x, builds on s390x should use glibc. This commit makes glibc the default on s390x as per the agent Makefile. Fixes: #1262 Signed-off-by: Jakob Naucke --- src/agent/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/agent/Makefile b/src/agent/Makefile index e33802037f..0763681e74 100644 --- a/src/agent/Makefile +++ b/src/agent/Makefile @@ -41,6 +41,11 @@ ifeq ($(ARCH), ppc64le) $(warning "WARNING: powerpc64le-unknown-linux-musl target is unavailable") endif +ifeq ($(ARCH), s390x) + override LIBC = gnu + $(warning "WARNING: s390x-unknown-linux-musl target is unavailable") +endif + EXTRA_RUSTFLAGS := ifeq ($(ARCH), aarch64) From afb41978139e25772b47d4b53967c44bef7844a8 Mon Sep 17 00:00:00 2001 From: Jakob Naucke Date: Thu, 14 Jan 2021 16:28:11 +0100 Subject: [PATCH 2/2] osbuilder: Build for glibc on s390x Since there is no Rust target for musl on s390x, builds on s390x should use glibc. This commit removes the "Cannot build Rust agent on s390x" restriction in rootfs.sh and only installs musl in the build environment when it is required. Fixes: #1262 Signed-off-by: Jakob Naucke --- tools/osbuilder/rootfs-builder/rootfs.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tools/osbuilder/rootfs-builder/rootfs.sh b/tools/osbuilder/rootfs-builder/rootfs.sh index 6ac1625756..dce1b94c8f 100755 --- a/tools/osbuilder/rootfs-builder/rootfs.sh +++ b/tools/osbuilder/rootfs-builder/rootfs.sh @@ -561,7 +561,7 @@ EOT if [ -z "${AGENT_SOURCE_BIN}" ] ; then [ "$ARCH" == "ppc64le" ] && { LIBC=gnu; echo "WARNING: Forcing LIBC=gnu for ppc64le because musl toolchain is not supported on ppc64le"; } - bash ${script_dir}/../../../ci/install_musl.sh + [ "$LIBC" == "musl" ] && bash ${script_dir}/../../../ci/install_musl.sh # rust agent needs ${arch}-unknown-linux-${LIBC} rustup show | grep linux-${LIBC} > /dev/null || bash ${script_dir}/../../../ci/install_rust.sh test -r "${HOME}/.cargo/env" && source "${HOME}/.cargo/env" @@ -626,13 +626,6 @@ parse_arguments() shift $(($OPTIND - 1)) distro="$1" arch=$(uname -m) - - if [ "${RUST_AGENT}" == "yes" ] && [ "${arch}" == "s390x" ]; then - die "Cannot build rust agent on s390x -musl cannot be built on s390x because of long double -reprentation is broken. And rust has no musl target on s390x. -See issue: https://github.com/kata-containers/osbuilder/issues/388" - fi } detect_host_distro()