Problem
Recent ran into an error using QEMU 8.x on Fedora 40 (via dnf install) and needed to upgrade to the latest QEMU (9.1.x at the time of writing). Here is the process I followed to get up to date.
Code
#!/bin/bash -l
set -eo pipefail
# Preflight checks
if [[ $LOG_LEVEL == "TRACE" ]]
then
set -x
fi
if [[ $(which python) ]]
then
echo "ERR: Python >= 3.11 required."
exit 1
fi
## Remove if exists
dnf remove -y qemu || true
dnf list --installed | grep qemu
if [[ $? != "1" ]]
then
echo "ERR: QEMU install still exits. It should not.
exit 1
fi
## Install Dependencies
sudo dnf install -y \
bison \
flex \
ninja-build
pip install --user \
sphinx==5.3.0 \
sphinx_rtd_theme==1.1.1
# https://www.qemu.org/download/
git clone https://gitlab.com/qemu-project/qemu.git
cd qemu
git submodule init
git submodule update --recursive
./configure
# The build process time depends on compute resources. It can take a long time on less than powerful machines.
make
...
9266/9270] Linking target tests/qtest/pnv-spi-seeprom-test
[9267/9270] Linking target tests/qtest/pnv-host-i2c-test
[9268/9270] Linking target tests/qtest/rtas-test
[9269/9270] Linking target tests/qtest/sifive-e-aon-watchdog-test
[9270/9270] Linking target tests/qtest/virtio-ccw-test
BUILD plugin execlog.o
LINK plugin libexeclog.so
BUILD plugin hotblocks.o
LINK plugin libhotblocks.so
BUILD plugin hotpages.o
LINK plugin libhotpages.so
BUILD plugin howvec.o
LINK plugin libhowvec.so
BUILD plugin lockstep.o
LINK plugin liblockstep.so
BUILD plugin hwprofile.o
LINK plugin libhwprofile.so
BUILD plugin cache.o
LINK plugin libcache.so
BUILD plugin drcov.o
LINK plugin libdrcov.so
BUILD plugin ips.o
LINK plugin libips.so
BUILD plugin stoptrigger.o
LINK plugin libstoptrigger.so
make[1]: Leaving directory '/home/david/Projects/github/qemu-project/qemu/build'
# Install on system
# Finish up
cd ./build
which qemu-aarch64
qemu-aarch64 --version
After QEMU 9.1.x was built successfully.