Closed
Description
See #402 for a log of getting s390x Bazel built.
I managed a build of Bazel despite this being quite flaky (Dockerfile below):
$ sudo docker buildx build --no-cache --platform linux/s390x -t build-tools:ubuntu-20.04-bazel-6.5.0 -f Dockerfile.bazel .
[+] Building 4802.4s (20/20) FINISHED
But it doesn't work locally (emscripten/emcc.py missing?):
$ sudo docker run --rm --volume $(pwd):/mnt --workdir /mnt --platform linux/s390x build-tools:ubuntu-20.04-bazel-6.5.0 bazel test --verbose_failures --test_output=errors --define engine=wasmtime --config=clang --test_timeout=1800 -- //test/...
...
ERROR: /mnt/test/test_data/BUILD:88:21: Compiling test/test_data/http_logging.cc failed: (Exit 2): emcc.sh failed: error executing command (from target //test/test_data:proxy_wasm_http
_logging)
(cd /root/.cache/bazel/_bazel_root/bede119f64a38032435c6e05a554a267/sandbox/processwrapper-sandbox/10/execroot/proxy_wasm_cpp_host && \
exec env - \ BAZEL_COMPILER=clang \
CC=clang \
CXX=clang++ \
EMCC_WASM_BACKEND=1 \
EM_BIN_PATH=external/emsdk \
EM_CONFIG_PATH=external/emsdk/emscripten_toolchain/emscripten_config \
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
PWD=/proc/self/cwd \
external/emsdk/emscripten_toolchain/emcc.sh '--sysroot=external/emsdk/emscripten/cache/sysroot' -fdiagnostics-color -fno-exceptions -fno-strict-aliasing -funsigned-char -no-canonical-prefixes '-std=gnu++17' -nostdinc -nostdinc++ -fomit-frame-pointer -O0 -Wall '-DBAZEL_CURRENT_REPOSITORY=""' -iquote . -iquote bazel-out/wasm-fastbuild-ST-ca831c069035/bin -iquote external/proxy_wasm_cpp_sdk -iquote bazel-out/wasm-fastbuild-ST-ca831c069035/bin/external/proxy_wasm_cpp_sdk -iquote external/emsdk -iquote bazel-out/wasm-fastbuild-ST-ca831c069035/bin/external/emsdk -O3 -iwithsysroot/include/c++/v1 -iwithsysroot/include/compat -iwithsysroot/include -isystem external/emsdk/lib/clang/15.0.0/include -MD -MF bazel-out/wasm-fastbuild-ST-ca831c069035/bin/test/test_data/_objs/proxy_wasm_http_logging/http_logging.d -c test/test_data/http_logging.cc -o bazel-out/wasm-fastbuild-ST-ca831c069035/bin/test/test_data/_objs/proxy_wasm_http_logging/http_logging.o -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -Werror)
# Configuration: c8778a672e7196fd832fc49695b58b09d50dfe3e8617c6ffd959f0b0e0dfe535
# Execution platform: @local_config_platform//:host
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
/usr/bin/python3: can't open file '/root/.cache/bazel/_bazel_root/bede119f64a38032435c6e05a554a267/sandbox/processwrapper-sandbox/10/execroot/proxy_wasm_cpp_host/external/emsdk/emscripten/emcc.py': [Errno 2] No such file or directory
The Dockerfile below works natively on linux/amd64:
# syntax=docker/dockerfile:1
# Prep:
# docker run --rm --privileged tonistiigi/binfmt --install all
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# cat /proc/sys/fs/binfmt_misc/qemu-*
#
# Build:
# docker buildx build --platform linux/s390x -t $IMAGE -f Dockerfile.bazel
#
# Push:
# docker image tag $IMAGE $REPO/$IMAGE:latest
# docker push $IMAGE
#
# Test:
# docker run --rm --volume $(pwd):/mnt --workdir /mnt \
# --platform linux/s390x $IMAGE \
# bazel test --verbose_failures --test_output=errors \
# --define engine=null --config=clang --test_timeout=1800 \
# -- //test/...
# Update base image
ARG UBUNTU_VERSION=20.04
FROM ubuntu:${UBUNTU_VERSION} as build
RUN apt update && apt upgrade -y
RUN apt autoremove -y
# Install Bazel deps
RUN apt install -y software-properties-common
RUN add-apt-repository ppa:openjdk-r/ppa
RUN apt install -y \
build-essential \
openjdk-11-jdk \
python3 \
curl \
zip \
unzip
# Download Bazel source
ARG BAZEL_VERSION=6.5.0
RUN cd ~ && mkdir bazel && cd bazel
RUN curl -LO https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-dist.zip
RUN unzip -q bazel-${BAZEL_VERSION}-dist.zip
# Build Bazel
# NOTE: This step is flaky and frequently hangs for multiarch / buildx.
# If it takes more than 2 hours, restart the Docker build and try again.
ENV EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk"
RUN bash ./compile.sh
# Copy output to /usr/bin
RUN cp /output/bazel /usr/bin/bazel
# Install ProxyWasm build deps
RUN apt install -y \
git \
python3-distutils \
clang \
libstdc++6
Metadata
Metadata
Assignees
Labels
No labels