build: Updated development utilities for AArch64

Updated Dockerfile to work with multiple architectures.
Updated dev_cli.sh to:
1. Build container image before AArch64 image is ready in public.
2. Adjust default feature collection on AArch64.
3. Workaround a build problem with musl on AArch64.

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
This commit is contained in:
Michael Zhao
2020-04-16 10:02:42 +08:00
committed by Rob Bradford
parent af8292b623
commit 0090ec2dda
2 changed files with 36 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
FROM ubuntu:18.04 as dev
ARG TARGETARCH="x86_64"
ARG RUST_TOOLCHAIN="1.42.0"
ARG CLH_SRC_DIR="/cloud-hypervisor"
ARG CLH_BUILD_DIR="$CLH_SRC_DIR/build"
@@ -11,9 +12,9 @@ ENV RUSTUP_HOME=$CARGO_HOME
ENV PATH="$PATH:$CARGO_HOME/bin"
# Install all CI dependencies
RUN apt-get update
RUN apt-get -yq upgrade
RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq \
RUN apt-get update \
&& apt-get -yq upgrade \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq \
build-essential \
bc \
docker.io \
@@ -37,22 +38,29 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq \
dosfstools \
cpio \
bsdtar \
gcc-multilib \
libfdt-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN if [ "$TARGETARCH" = "x86_64" ]; then \
apt-get update \
&& apt-get -yq upgrade \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq gcc-multilib \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*; fi
# Fix the libssl-dev install
RUN cp /usr/include/x86_64-linux-gnu/openssl/opensslconf.h /usr/include/openssl/
ENV OPENSSL_DIR=/usr/lib/x86_64-linux-gnu/
ENV OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu/
RUN cp /usr/include/"$TARGETARCH"-linux-gnu/openssl/opensslconf.h /usr/include/openssl/
ENV OPENSSL_DIR=/usr/lib/"$TARGETARCH"-linux-gnu/
ENV OPENSSL_LIB_DIR=/usr/lib/"$TARGETARCH"-linux-gnu/
ENV OPENSSL_INCLUDE_DIR=/usr/include/
# Install the rust toolchain
RUN nohup curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "$RUST_TOOLCHAIN" \
&& rustup target add x86_64-unknown-linux-musl --toolchain "$RUST_TOOLCHAIN" \
&& rustup toolchain add $RUST_TOOLCHAIN-x86_64-unknown-linux-musl \
&& rustup component add rustfmt \
&& rustup component add clippy \
&& rustup target add $TARGETARCH-unknown-linux-musl --toolchain "$RUST_TOOLCHAIN" \
&& if [ "$TARGETARCH" = "x86_64" ]; then rustup toolchain add $RUST_TOOLCHAIN-x86_64-unknown-linux-musl; fi \
&& if [ "$TARGETARCH" = "x86_64" ]; then rustup component add rustfmt; fi \
&& if [ "$TARGETARCH" = "x86_64" ]; then rustup component add clippy; fi \
&& cargo install cargo-audit \
&& rm -rf "$CARGO_HOME/registry" \
&& ln -s "$CARGO_REGISTRY_DIR" "$CARGO_HOME/registry" \