[8.x] qemu-user does not build under CentOS 7 any longer
INFO: CentOS 7 provides gcc-8 and python-3.8 in the SCL repository
qemu-user-8.0.3 does not build under CentOS 7 any longer; qemu-user-7.2.4 works
Error messages include:
../linux-user/mmap.c: In function 'target_madvise':
../linux-user/mmap.c:916:18: error: 'MADV_WIPEONFORK' undeclared (first use in this function); did you mean 'MADV_DOFORK'?
advice = MADV_WIPEONFORK;
^~~~~~~~~~~~~~~
MADV_DOFORK
In case you cannot reproduce, here is a complete Dockerfile that builds qemu from scratch (tested under Podman, but probably should work under Docker)
# build qemu-user from source code under CentOS 7
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
# NOTE: see QEMU_VERSION below
# WARNING: this image needs A LOT of disk space!
# takes about 30 minutes on an older 4-core HD-disk machine; faster with more cores or SSD-disks
FROM quay.io/centos/centos:centos7
# enable SCL (Software Collections) and EPEL (Extra Packages for Enterprise Linux)
RUN yum update -y && yum install -y centos-release-scl centos-release-scl-rh epel-release && yum update -y
# install system packages (including gcc-8 and python-3.8)
RUN yum update -y && yum install -y \
bash bison bzip2 cmake cpio curl diffutils findutils flex \
gawk gcc gcc-c++ gdb git gzip less m4 make mksh patch perl \
strace tar time unzip wget xz zip \
# SCL packages
devtoolset-8 \
rh-python38 \
# EPEL packages
ninja-build \
zstd \
&& ln -v -s /opt/rh/rh-python38/root/usr/bin/pip3* /usr/local/bin \
&& ln -v -s /opt/rh/rh-python38/root/usr/bin/pydoc3* /usr/local/bin \
&& ln -v -s /opt/rh/rh-python38/root/usr/bin/python3* /usr/local/bin \
&& python3 --version \
&& true
# install devel packages
RUN yum update -y && yum install -y \
bzip2-devel \
elfutils-devel \
glib2-devel \
libuv-devel \
libzstd-devel \
ncurses-devel \
pcre-devel \
pcre2-devel \
xz-devel \
zlib-devel \
&& true
# create default user builder:builder 2000:2000
RUN useradd builder -U --uid 2000 --shell /bin/bash -m \
&& cd /home/builder && chmod 00700 . \
&& mkdir -p .cache/tmp .local/bin src/packages src/builder \
&& chown -R builder:builder . \
&& true
# create installation directory
RUN mkdir -p -v /usr/local/packages \
&& chown -R builder:builder /usr/local/packages \
&& true
# switch to user builder
USER builder
# 7.2.4 works; 8.0.3 FAILS
#ARG QEMU_VERSION=7.2.4
ARG QEMU_VERSION=8.0.3
# download and unpack qemu source code
RUN echo "downloading, please be patient" \
&& cd /home/builder/src/packages \
&& time nice wget -q https://download.qemu.org/qemu-${QEMU_VERSION}.tar.xz \
&& time nice tar -xoaf ./qemu-*.tar.xz \
&& rm ./qemu-*.tar.xz \
&& true
# run configure
RUN echo "configuring" \
&& source /opt/rh/devtoolset-8/enable \
&& cd /home/builder/src/packages/qemu-* \
&& time nice ./configure --prefix=/usr/local/packages/qemu-user-${QEMU_VERSION}-centos7 --enable-user --disable-system \
&& true
# run build
RUN echo "building, please be patient" \
&& source /opt/rh/devtoolset-8/enable \
&& cd /home/builder/src/packages/qemu-*/build \
&& time nice make -j \
&& true
# run install
RUN echo "installing" \
&& source /opt/rh/devtoolset-8/enable \
&& cd /home/builder/src/packages/qemu-*/build \
&& time nice make install \
&& true
# create a tarball that can be copied back to the host
RUN echo "creating tarball" \
&& cd / \
&& time nice tar -c --use-compress-program=zstd -f /home/builder/src/packages/qemu-user-${QEMU_VERSION}-centos7.tar.zst usr/local/packages/qemu-* \
&& true