Skip to content

Conversation

@MrXinWang
Copy link
Member

@MrXinWang MrXinWang commented Jul 1, 2020

As requested in #1395 (comment). This update of Dockerfile will add support to the AArch64 integration tests and musl building, including:

  1. Installation of the missing setcap binary on AArch64. On AArch64, setcap binary should be installed via libcap2-bin.
    This binary is needed in the integration test.

  2. Related support for the cloud-hypervisor binary building by musl toolchain. Details can be found in linking with cc failed on AArch64 with aarch64-unknown-linux-musl target rust-lang/rust#73493 (comment)

Test building with musl using the updated container:

~/cloud-hypervisor-dev/cloud-hypervisor-build# ./scripts/dev_cli.sh build --release --libc musl
...
Successfully tagged cloudhypervisor/dev:v4
...
   Compiling cloud-hypervisor v0.8.0 (/cloud-hypervisor)
    Finished release [optimized] target(s) in 2m 28s
[Cloud Hypervisor] Binaries placed under /root/cloud-hypervisor-dev/cloud-hypervisor-build/build/cargo_target/aarch64-unknown-linux-musl/release

~/cloud-hypervisor-dev/cloud-hypervisor-build/build/cargo_target/aarch64-unknown-linux-musl/release# file cloud-hypervisor

cloud-hypervisor: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), statically linked, with debug_info, not stripped

Signed-off-by: Henry Wang [email protected]

@MrXinWang MrXinWang requested a review from rbradford July 1, 2020 03:51
This update of Dockerfile will add support to the AArch64
integration tests and musl building, including:

1. Installation of the missing `setcap` binary on AArch64.
On AArch64, `setcap` binary should be installed via `libcap2-bin`.
This binary is needed in the integration test.

2. Related support for the cloud-hypervisor binary building by
musl toolchain.

Signed-off-by: Henry Wang <[email protected]>
@rbradford rbradford merged commit b70e254 into cloud-hypervisor:master Jul 1, 2020
@rbradford
Copy link
Member

@MrXinWang I think something is amiss. I tested the lastest master on the ARM64 CI machine:

root@ci-cloud-hypervisor-arm64-01:~/cloud-hypervisor/resources# docker build -f Dockerfile -t cloudhypervisor/dev:v4 .
Sending build context to Docker daemon  71.68kB
Step 1/19 : FROM ubuntu:18.04 as dev
 ---> 53ffe7187a86
Step 2/19 : ARG TARGETARCH="x86_64"
 ---> Using cache
 ---> 5f696084a47b
Step 3/19 : ARG RUST_TOOLCHAIN="1.43.0"
 ---> Using cache
 ---> 87b6bb6db537
Step 4/19 : ARG CLH_SRC_DIR="/cloud-hypervisor"
 ---> Using cache
 ---> a767d5b1acb8
Step 5/19 : ARG CLH_BUILD_DIR="$CLH_SRC_DIR/build"
 ---> Using cache
 ---> bd5832790030
Step 6/19 : ARG CARGO_REGISTRY_DIR="$CLH_BUILD_DIR/cargo_registry"
 ---> Using cache
 ---> 3c768bfbcaa0
Step 7/19 : ARG CARGO_GIT_REGISTRY_DIR="$CLH_BUILD_DIR/cargo_git_registry"
 ---> Using cache
 ---> cf482997153e
Step 8/19 : ENV CARGO_HOME=/usr/local/rust
 ---> Using cache
 ---> c3443c575a6e
Step 9/19 : ENV RUSTUP_HOME=$CARGO_HOME
 ---> Using cache
 ---> 83c914f257ca
Step 10/19 : ENV PATH="$PATH:$CARGO_HOME/bin"
 ---> Using cache
 ---> 778ab6d1333b
Step 11/19 : RUN apt-get update 	&& apt-get -yq upgrade 	&& DEBIAN_FRONTEND=noninteractive apt-get install -yq 	build-essential 	bc 	docker.io 	curl 	wget 	sudo 	mtools 	musl-tools 	libssl-dev 	pkg-config 	flex 	bison 	libelf-dev 	qemu-utils 	qemu-system 	libglib2.0-dev 	libpixman-1-dev 	libseccomp-dev 	libcap-ng-dev 	socat 	dosfstools cpio 	bsdtar 	libfdt-dev     && apt-get clean     && rm -rf /var/lib/apt/lists/*
 ---> Using cache
 ---> e47c93a795ba
Step 12/19 : 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
 ---> Running in c4bc390bab4b
Get:1 http://ports.ubuntu.com/ubuntu-ports bionic InRelease [242 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease [88.7 kB]
Get:3 http://ports.ubuntu.com/ubuntu-ports bionic-backports InRelease [74.6 kB]
Get:4 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease [88.7 kB]
Get:5 http://ports.ubuntu.com/ubuntu-ports bionic/universe arm64 Packages [11.0 MB]
Get:6 http://ports.ubuntu.com/ubuntu-ports bionic/main arm64 Packages [1285 kB]
Get:7 http://ports.ubuntu.com/ubuntu-ports bionic/restricted arm64 Packages [572 B]
Get:8 http://ports.ubuntu.com/ubuntu-ports bionic/multiverse arm64 Packages [153 kB]
Get:9 http://ports.ubuntu.com/ubuntu-ports bionic-updates/universe arm64 Packages [1240 kB]
Get:10 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main arm64 Packages [889 kB]
Get:11 http://ports.ubuntu.com/ubuntu-ports bionic-updates/restricted arm64 Packages [1312 B]
Get:12 http://ports.ubuntu.com/ubuntu-ports bionic-updates/multiverse arm64 Packages [3457 B]
Get:13 http://ports.ubuntu.com/ubuntu-ports bionic-backports/main arm64 Packages [8260 B]
Get:14 http://ports.ubuntu.com/ubuntu-ports bionic-backports/universe arm64 Packages [7827 B]
Get:15 http://ports.ubuntu.com/ubuntu-ports bionic-security/multiverse arm64 Packages [1843 B]
Get:16 http://ports.ubuntu.com/ubuntu-ports bionic-security/main arm64 Packages [617 kB]
Get:17 http://ports.ubuntu.com/ubuntu-ports bionic-security/restricted arm64 Packages [895 B]
Get:18 http://ports.ubuntu.com/ubuntu-ports bionic-security/universe arm64 Packages [756 kB]
Fetched 16.5 MB in 5s (3162 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists...
Building dependency tree...
Reading state information...
Package gcc-multilib is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'gcc-multilib' has no installation candidate
The command '/bin/sh -c 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' returned a non-zero code: 100
root@ci-cloud-hypervisor-arm64-01:~/cloud-hypervisor/resources# 

@rbradford
Copy link
Member

The x86-64 version is uploaded to Docker hub now.

@MrXinWang
Copy link
Member Author

MrXinWang commented Jul 1, 2020

Hi @rbradford!

  1. Firstly, thanks for updating this x86_64 image. It works perfectly and I have updated the tests: AArch64: Enable AArch64 integration tests #1395

  2. There is no error in the Dockerfile. It is just how we play with it. Currently we are using docker build arg to separate the ARCH in the container, and if you want to build by manually inputting the docker build command, you should add --build-arg TARGETARCH="$(uname -m)" in the end of the command.

And there is a much simpler way: Just running ./scripts/dev_cli.sh build-container and the script takes care of everything.
(also btw, as I triggered the CI in #1395, I think the arm64 v4 image is already on the arm64 CI machine, you don't have to build it again :) )

@MrXinWang MrXinWang mentioned this pull request Jul 8, 2020
8 tasks
@MrXinWang MrXinWang deleted the arm64_Dockerfile branch June 4, 2021 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants