qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Alexandre Iooss" <erdnaxe@crans.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Mahmoud Mandour" <ma.mandourr@gmail.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>
Subject: [PATCH v2 08/11] docs/devel: update build environment setup documentation
Date: Thu,  4 Dec 2025 19:48:59 +0000	[thread overview]
Message-ID: <20251204194902.1340008-9-alex.bennee@linaro.org> (raw)
In-Reply-To: <20251204194902.1340008-1-alex.bennee@linaro.org>

Bring `libvirt-ci` front and centre when discussing dependencies for
QEMU. While we are at it:

  - drop links to additional instructions (libvirt is more upto date)
  - compress pkg installs into a table
  - call out distro/upstream dep difference in a proper note

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 docs/devel/build-environment.rst | 145 ++++++++++++++++++++-----------
 1 file changed, 96 insertions(+), 49 deletions(-)

diff --git a/docs/devel/build-environment.rst b/docs/devel/build-environment.rst
index 661f6ea8504..61b2dc0d1bc 100644
--- a/docs/devel/build-environment.rst
+++ b/docs/devel/build-environment.rst
@@ -4,55 +4,103 @@
 Setup build environment
 =======================
 
-QEMU uses a lot of dependencies on the host system. glib2 is used everywhere in
-the code base, and most of the other dependencies are optional.
-
-We present here simple instructions to enable native builds on most popular
-systems.
-
-You can find additional instructions on `QEMU wiki <https://wiki.qemu.org/>`_:
-
-- `Linux <https://wiki.qemu.org/Hosts/Linux>`_
-- `MacOS <https://wiki.qemu.org/Hosts/Mac>`_
-- `Windows <https://wiki.qemu.org/Hosts/W32>`_
-- `BSD <https://wiki.qemu.org/Hosts/BSD>`_
-
-Note: Installing dependencies using your package manager build dependencies may
-miss out on deps that have been newly introduced in qemu.git. In more, it misses
-deps the distribution has decided to exclude.
-
-Linux
------
-
-Fedora
-++++++
-
-::
-
-    sudo dnf update && sudo dnf builddep qemu
-
-Debian/Ubuntu
-+++++++++++++
-
-You first need to enable `Sources List <https://wiki.debian.org/SourcesList>`_.
-Then, use apt to install dependencies:
-
-::
-
-    sudo apt update && sudo apt build-dep qemu
-
-MacOS
------
-
-You first need to install `Homebrew <https://brew.sh/>`_. Then, use it to
-install dependencies:
-
-::
-
-    brew update && brew install $(brew deps --include-build qemu)
+QEMU uses a lot of dependencies on the host system a large number of
+which are optional. At a minimum we expect to have a system C library
+(usually glibc but others can work), the glib2 library (used heavily
+in the code base) and a few other core libraries for interfacing with
+code modules and system build descriptions.
+
+We use the ``libvirt-ci`` project to handle the mapping of
+dependencies to a wide variety output formats including system install
+scripts. For example:
+
+.. code-block:: bash
+
+  # THIS FILE WAS AUTO-GENERATED
+  #
+  #  $ lcitool buildenvscript debian-13 ./tests/lcitool/projects/qemu-minimal.yml
+  #
+  # https://gitlab.com/libvirt/libvirt-ci
+
+  function install_buildenv() {
+      export DEBIAN_FRONTEND=noninteractive
+      apt-get update
+      apt-get dist-upgrade -y
+      apt-get install --no-install-recommends -y \
+              bash \
+              bc \
+              bison \
+              bzip2 \
+              ca-certificates \
+              ccache \
+              findutils \
+              flex \
+              gcc \
+              git \
+              libc6-dev \
+              libfdt-dev \
+              libffi-dev \
+              libglib2.0-dev \
+              libpixman-1-dev \
+              locales \
+              make \
+              meson \
+              ninja-build \
+              pkgconf \
+              python3 \
+              python3-venv \
+              sed \
+              tar
+      sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen
+      dpkg-reconfigure locales
+      rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED
+      dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt
+      mkdir -p /usr/libexec/ccache-wrappers
+      ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc
+      ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
+  }
+
+  export CCACHE_WRAPPERSDIR="/usr/libexec/ccache-wrappers"
+  export LANG="en_US.UTF-8"
+  export MAKE="/usr/bin/make"
+  export NINJA="/usr/bin/ninja"
+  export PYTHON="/usr/bin/python3"
+
+If you instead select the ``qemu.yml`` project file you will get all
+the dependencies that the project can use.
+
+Using you system package manager
+--------------------------------
+
+.. note::
+
+   Installing dependencies using your package manager build dependencies may
+   miss out on deps that have been newly introduced in qemu.git. It
+   also misses deps the distribution has decided to exclude.
+
+Systems with Package Managers
++++++++++++++++++++++++++++++
+
+.. list-table:: Package Manager Commands
+  :widths: 10 50 40
+  :header-rows: 1
+
+  * - System
+    - Command
+    - Notes
+  * - Fedora
+    - ``sudo dnf update && sudo dnf builddep qemu``
+    -
+  * - Debian/Ubuntu
+    - ``sudo apt update && sudo apt build-dep qemu``
+    - Must enable `Sources List
+      <https://wiki.debian.org/SourcesList>`_ first
+  * - MacOS
+    - ``brew update && brew install $(brew deps --include-build qemu)``
+    - Using `Homebrew <https://brew.sh/>`_.
 
 Windows
--------
++++++++
 
 You first need to install `MSYS2 <https://www.msys2.org/>`_.
 MSYS2 offers `different environments <https://www.msys2.org/docs/environments/>`_.
@@ -104,7 +152,7 @@ build QEMU in MSYS2 itself.
     makepkg --syncdeps --nobuild PKGBUILD || true
 
 Build on windows-aarch64
-++++++++++++++++++++++++
+~~~~~~~~~~~~~~~~~~~~~~~~
 
 When trying to cross compile meson for x86_64 using UCRT64 or MINGW64 env,
 configure will run into an error because the cpu detected is not correct.
@@ -115,4 +163,3 @@ and force a cross compilation (with empty prefix).
 ::
 
     ./configure --cpu=x86_64 --cross-prefix=
-
-- 
2.47.3



  parent reply	other threads:[~2025-12-04 19:49 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-04 19:48 [PATCH v2 00/11] Final fixes for 10.2 (build, docs, dockerfiles, plugins) Alex Bennée
2025-12-04 19:48 ` [PATCH v2 01/11] gitlab: drop --disable-pie from aarch64-all-linux-static build Alex Bennée
2025-12-05  7:53   ` Thomas Huth
2025-12-04 19:48 ` [PATCH v2 02/11] gitlab: drop explicit pxe-test from the build-tci job Alex Bennée
2025-12-05  7:54   ` Thomas Huth
2025-12-04 19:48 ` [PATCH v2 03/11] tests/tcg: honour the available QEMU binaries when running check-tcg Alex Bennée
2025-12-04 19:48 ` [PATCH v2 04/11] tests/lcitool: add bzip2 to the minimal dependency list Alex Bennée
2025-12-05  6:14   ` Thomas Huth
2025-12-04 19:48 ` [PATCH v2 05/11] tests/lcitool: add nettle to the minimal deps Alex Bennée
2025-12-05  6:37   ` Thomas Huth
2025-12-05 12:48     ` Alex Bennée
2025-12-08  9:11       ` Daniel P. Berrangé
2025-12-08  9:17         ` Thomas Huth
2025-12-04 19:48 ` [PATCH v2 06/11] tests/docker: transition debian-all-test-cross to lcitool Alex Bennée
2025-12-04 19:48 ` [PATCH v2 07/11] tests/docker: drop --disable-[tools|system] from all-test-cross Alex Bennée
2025-12-05  6:40   ` Thomas Huth
2025-12-04 19:48 ` Alex Bennée [this message]
2025-12-04 19:49 ` [PATCH v2 09/11] docs/devel: Correct typo Alex Bennée
2025-12-08  9:21   ` Philippe Mathieu-Daudé
2025-12-04 19:49 ` [PATCH v2 10/11] MAINTAINERS: update the custom runner entries Alex Bennée
2025-12-05  6:09   ` Thomas Huth
2025-12-08  9:20   ` Philippe Mathieu-Daudé
2025-12-04 19:49 ` [PATCH v2 11/11] plugins/core: allow reading of registers during discon events Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251204194902.1340008-9-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=erdnaxe@crans.org \
    --cc=ma.mandourr@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).