From 7c888b34be5f48893d1dd2b97edd9d1d26c66c52 Mon Sep 17 00:00:00 2001 From: Jakob-Naucke Date: Thu, 14 Jan 2021 18:05:53 +0100 Subject: [PATCH] osbuilder: Fix USE_DOCKER on s390x - Install the required protobuf-compiler on Ubuntu - Install correct libc Rust target (glibc on s390x) - Do not skip Rust installation on s390x Fixes: #1266 Signed-off-by: Jakob-Naucke --- .../rootfs-builder/ubuntu/Dockerfile.in | 1 + tools/osbuilder/scripts/lib.sh | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/osbuilder/rootfs-builder/ubuntu/Dockerfile.in b/tools/osbuilder/rootfs-builder/ubuntu/Dockerfile.in index a5da267a4e..81b2c2391c 100644 --- a/tools/osbuilder/rootfs-builder/ubuntu/Dockerfile.in +++ b/tools/osbuilder/rootfs-builder/ubuntu/Dockerfile.in @@ -34,6 +34,7 @@ RUN apt-get update && apt-get --no-install-recommends install -y \ musl \ musl-dev \ musl-tools \ + protobuf-compiler \ sed \ systemd \ tar \ diff --git a/tools/osbuilder/scripts/lib.sh b/tools/osbuilder/scripts/lib.sh index e43f78143e..7987e11289 100644 --- a/tools/osbuilder/scripts/lib.sh +++ b/tools/osbuilder/scripts/lib.sh @@ -239,6 +239,7 @@ generate_dockerfile() local architecture=$(uname -m) local rustarch=${architecture} local muslarch=${architecture} + local libc=musl case "$(uname -m)" in "ppc64le") goarch=ppc64le @@ -251,6 +252,7 @@ generate_dockerfile() ;; "s390x") goarch=s390x + libc=gnu ;; *) @@ -324,7 +326,7 @@ RUN . /root/.cargo/env; \ export http_proxy=${http_proxy:-}; \ export https_proxy=${http_proxy:-}; \ cargo install cargo-when; \ - rustup target install ${rustarch}-unknown-linux-musl + rustup target install ${rustarch}-unknown-linux-${libc} RUN ln -sf /usr/bin/g++ /bin/musl-g++ " # rust agent still need go to build @@ -342,7 +344,7 @@ RUN ln -sf /usr/bin/g++ /bin/musl-g++ # powerpc have no musl target, don't setup rust enviroment # since we cannot static link agent. Besides, there is # also long double representation problem when building musl-libc - if [ "${architecture}" == "ppc64le" ] || [ "${architecture}" == "s390x" ]; then + if [ "${architecture}" == "ppc64le" ]; then sed \ -e "s|@GO_VERSION@|${GO_VERSION}|g" \ -e "s|@OS_VERSION@|${OS_VERSION:-}|g" \ @@ -352,6 +354,17 @@ RUN ln -sf /usr/bin/g++ /bin/musl-g++ -e "s|@INSTALL_RUST@||g" \ -e "s|@SET_PROXY@|${set_proxy:-}|g" \ "${dockerfile_template}" > Dockerfile + # no musl target on s390x, will use GNU + elif [ "${architecture}" == "s390x" ]; then + sed \ + -e "s|@GO_VERSION@|${GO_VERSION}|g" \ + -e "s|@OS_VERSION@|${OS_VERSION:-}|g" \ + -e "s|@INSTALL_CMAKE@|${install_cmake//$'\n'/\\n}|g" \ + -e "s|@INSTALL_MUSL@||g" \ + -e "s|@INSTALL_GO@|${install_go//$'\n'/\\n}|g" \ + -e "s|@INSTALL_RUST@|${install_rust//$'\n'/\\n}|g" \ + -e "s|@SET_PROXY@|${set_proxy:-}|g" \ + "${dockerfile_template}" > Dockerfile else sed \ -e "s|@GO_VERSION@|${GO_VERSION}|g" \