buildscripts: Cross-compile in Docker

Previously builds were done with Ubuntu 16.04, and now we are using
18.04. Thus the generated binaries will no longer work for
Ubuntu 16.04 and Debian 9 users, both of which are outside of their
support window and aren't supported by Abseil. RHEL users are
unaffected, as the binaries already didn't work on RHEL 7 and they will
remain working with RHEL 8. FWIW, Ubuntu 18.04 will leave its support
window in June.
This commit is contained in:
Eric Anderson 2023-04-13 17:15:57 -07:00
parent 4fec5bbb83
commit 35852130d9
5 changed files with 33 additions and 35 deletions

View File

@ -4,4 +4,5 @@ set -eu -o pipefail
readonly buildscripts_dir="$(dirname "$(readlink -f "$0")")"
docker build -t grpc-java-artifacts-x86 "$buildscripts_dir"/grpc-java-artifacts
docker build -t grpc-java-artifacts-multiarch -f "$buildscripts_dir"/grpc-java-artifacts/Dockerfile.multiarch.base "$buildscripts_dir"/grpc-java-artifacts
docker build -t grpc-java-artifacts-ubuntu2004 -f "$buildscripts_dir"/grpc-java-artifacts/Dockerfile.ubuntu2004.base "$buildscripts_dir"/grpc-java-artifacts

View File

@ -1,10 +0,0 @@
#!/bin/bash
set -exu -o pipefail
# first we need to install the prerequisites required for s390x cross compilation
apt-get update && apt-get install -y g++-s390x-linux-gnu
# now kick off the build for the mvn artifacts for s390x
# mvn artifacts are stored in grpc-java/mvn-artifacts/
SKIP_TESTS=true ARCH=s390_64 "$(dirname $0)"/kokoro/unix.sh

View File

@ -1,15 +1,14 @@
FROM ubuntu:22.04
FROM ubuntu:18.04
# make sure apt-get works in unattended mode
ENV DEBIAN_FRONTEND=noninteractive
# install the OS-level prerequisites for building protobuf and running the gradle build
RUN apt-get update && \
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends ca-certificates build-essential wget curl openjdk-8-jdk && \
apt-get autoclean -y && \
apt-get autoremove -y && \
apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
g++-aarch64-linux-gnu \
g++-powerpc64le-linux-gnu \
openjdk-8-jdk \
&& \
rm -rf /var/lib/apt/lists/*
ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64

View File

@ -0,0 +1,13 @@
FROM ubuntu:20.04
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
g++-s390x-linux-gnu \
openjdk-8-jdk \
&& \
rm -rf /var/lib/apt/lists/*

View File

@ -52,16 +52,11 @@ readonly MVN_ARTIFACT_DIR="${MVN_ARTIFACT_DIR:-$GRPC_JAVA_DIR/mvn-artifacts}"
mkdir -p "$MVN_ARTIFACT_DIR"
cp -r "$LOCAL_MVN_TEMP"/* "$MVN_ARTIFACT_DIR"/
# for aarch64 platform
sudo apt-get install -y g++-aarch64-linux-gnu
SKIP_TESTS=true ARCH=aarch_64 "$GRPC_JAVA_DIR"/buildscripts/kokoro/unix.sh
# for ppc64le platform
sudo apt-get install -y g++-powerpc64le-linux-gnu
SKIP_TESTS=true ARCH=ppcle_64 "$GRPC_JAVA_DIR"/buildscripts/kokoro/unix.sh
# for s390x platform
# building these artifacts inside a Docker container as we have specific requirements
# for GCC (version 11.x needed) which in turn requires Ubuntu 22.04 LTS
"$GRPC_JAVA_DIR"/buildscripts/run_in_docker.sh grpc-java-artifacts-multiarch /grpc-java/buildscripts/build_s390x_artifacts_in_docker.sh
"$GRPC_JAVA_DIR"/buildscripts/run_in_docker.sh grpc-java-artifacts-multiarch env \
SKIP_TESTS=true ARCH=aarch_64 /grpc-java/buildscripts/kokoro/unix.sh
"$GRPC_JAVA_DIR"/buildscripts/run_in_docker.sh grpc-java-artifacts-multiarch env \
SKIP_TESTS=true ARCH=ppcle_64 /grpc-java/buildscripts/kokoro/unix.sh
# Use a newer GCC version. GCC 7 in multiarch has a bug:
# internal compiler error: output_operand: invalid %-code
"$GRPC_JAVA_DIR"/buildscripts/run_in_docker.sh grpc-java-artifacts-ubuntu2004 env \
SKIP_TESTS=true ARCH=s390_64 /grpc-java/buildscripts/kokoro/unix.sh