Emulated build and test of Bioconductor packages for Linux ARM64

Martin Grigorov
3 min readMay 5, 2023

From Bioconductor’s website:

About Bioconductor

The mission of the Bioconductor project is to develop, support, and disseminate free open source software that facilitates rigorous and reproducible analysis of data from current and emerging biological assays. We are dedicated to building a diverse, collaborative, and welcoming community of developers and data scientists.

Bioconductor uses the R statistical programming language, and is open source and open development. It has two releases each year, and an active user community. Bioconductor is also available as Docker images.

Current state

At the moment of writing this article (May 2023, early days of 3.18 development phase) the Bioconductor packages are being regularly tested on x86_64 (Ubuntu 22.04, Windows Server 2022 and macOS 12) and macOS ARM64.

There is also a discussion about adding Linux ARM64 to the list above! The work on this has already started and some issues have been fixed!

Build on Linux ARM64

If you have access to a Linux ARM64 [virtual] machine (e.g. AWS Graviton, OracleCloud) then you can easily setup R 4.3.0 and start working on your Bioc package.

In this article I am going to explain the steps needed in case you work on x86_64 host machine by using the Bioconductor Docker Linux ARM64 image, i.e. using emulation.

  1. Fetch the image:

docker pull — platform linux/arm64 ghcr.io/bioconductor/bioconductor:devel-r-latest

Note the --platform argument! It tells the Docker client to pull the arm64 flavor of the image. If omitted it will download the amd64 flavor that matches the architecture of the host.

2. Run the image (unsuccessful)

If you try to run this image you will see an error about the wrong binary format:

$ docker run -it — rm ghcr.io/bioconductor/bioconductor:devel-r-latest bash
WARNING: The requested image’s platform (linux/arm64) does not match the detected host platform (linux/amd64/v4) and no specific platform was requested
exec /usr/bin/bash: exec format error

3. Run the image (successful)

To make it possible to run arm64 Docker images on x86_64 host we will need to install QEMU (qemu-user-static):

$ docker run — rm — privileged aptman/qus -s — -p aarch64
cat ./qemu-binfmt-conf.sh | sh -s — — path=/qus/bin -p aarch64 — suffix -static
Setting /qus/bin/qemu-aarch64-static as binfmt interpreter for aarch64

Now it is possible to run the image:

$ docker run -it — rm ghcr.io/bioconductor/bioconductor:devel-r-latest bash
WARNING: The requested image’s platform (linux/arm64) does not match the detected host platform (linux/amd64/v4) and no specific platform was requested
root@b40c553def79:/# uname -a
Linux b40c553def79 6.2.0 #5 SMP PREEMPT_DYNAMIC Wed Mar 22 12:42:40 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux

4. Build Bioconductor packages

The Docker image comes with R preinstalled:

root@b40c553def79:/# R — version
R version 4.3.0 (2023–04–21) — “Already Tomorrow”

To build and test a Bioconductor package you will need to git clone it locally:

root@b40c553def79:/# mkdir dev && cd dev

root@b40c553def79:/# git clone https://git.bioconductor.org/packages/xyz

root@b40c553def79:/# R CMD build xyz

root@b40c553def79:/# R CMD check xyz_VERSION.tar.gz

That’s it!

Optimization

For easier and faster development it would be better to clone the package on your x86_64 host and mount the folder:

$ docker run -it — rm -v /path/to/package:/dev ghcr.io/bioconductor/bioconductor:devel-r-latest bash

This way it will be easier to edit the source files with your preferred text editor on your workstation.

--

--