[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 34/37] docs/devel: add information on how to setup build envir
From: |
Alex Bennée |
Subject: |
[PATCH v2 34/37] docs/devel: add information on how to setup build environments |
Date: |
Tue, 14 Jan 2025 11:38:18 +0000 |
From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
MacOS and Linux are straightforward, but Windows needs a bit more
details.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20241209183104.365796-5-pierrick.bouvier@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
docs/about/build-platforms.rst | 4 +-
docs/devel/build-environment.rst | 118 +++++++++++++++++++++++++++++++
docs/devel/index-build.rst | 1 +
3 files changed, 122 insertions(+), 1 deletion(-)
create mode 100644 docs/devel/build-environment.rst
diff --git a/docs/about/build-platforms.rst b/docs/about/build-platforms.rst
index d8b0445157..482b09819c 100644
--- a/docs/about/build-platforms.rst
+++ b/docs/about/build-platforms.rst
@@ -29,6 +29,9 @@ The `Repology`_ site is a useful resource to identify
currently shipped versions of software in various operating systems,
though it does not cover all distros listed below.
+You can find how to install build dependencies for different systems on the
+:ref:`setup-build-env` page.
+
Supported host architectures
----------------------------
@@ -130,7 +133,6 @@ Optional build dependencies
cross compilation using ``docker`` or ``podman``, or to use pre-built
binaries distributed with QEMU.
-
Windows
-------
diff --git a/docs/devel/build-environment.rst b/docs/devel/build-environment.rst
new file mode 100644
index 0000000000..f133ef2e01
--- /dev/null
+++ b/docs/devel/build-environment.rst
@@ -0,0 +1,118 @@
+
+.. _setup-build-env:
+
+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)
+
+Windows
+-------
+
+You first need to install `MSYS2 <https://www.msys2.org/>`_.
+MSYS2 offers `different environments
<https://www.msys2.org/docs/environments/>`_.
+x86_64 environments are based on GCC, while aarch64 is based on Clang.
+
+We recommend to use MINGW64 for windows-x86_64 and CLANGARM64 for
windows-aarch64
+(only available on windows-aarch64 hosts).
+
+Then, you can open a windows shell, and enter msys2 env using:
+
+::
+
+ c:/msys64/msys2_shell.cmd -defterm -here -no-start -mingw64
+ # Replace -ucrt64 by -clangarm64 or -ucrt64 for other environments.
+
+MSYS2 package manager does not offer a built-in way to install build
+dependencies. You can start with this list of packages using pacman:
+
+Note: Dependencies need to be installed again if you use a different MSYS2
+environment.
+
+::
+
+ # update MSYS2 itself, you need to reopen your shell at the end.
+ pacman -Syu
+ pacman -S \
+ base-devel binutils bison diffutils flex git grep make sed \
+ ${MINGW_PACKAGE_PREFIX}-toolchain \
+ ${MINGW_PACKAGE_PREFIX}-glib2 \
+ ${MINGW_PACKAGE_PREFIX}-gtk3 \
+ ${MINGW_PACKAGE_PREFIX}-libnfs \
+ ${MINGW_PACKAGE_PREFIX}-libssh \
+ ${MINGW_PACKAGE_PREFIX}-ninja \
+ ${MINGW_PACKAGE_PREFIX}-pixman \
+ ${MINGW_PACKAGE_PREFIX}-pkgconf \
+ ${MINGW_PACKAGE_PREFIX}-python \
+ ${MINGW_PACKAGE_PREFIX}-SDL2 \
+ ${MINGW_PACKAGE_PREFIX}-zstd
+
+If you want to install all dependencies, it's possible to use recipe used to
+build QEMU in MSYS2 itself.
+
+::
+
+ pacman -S wget
+ wget
https://raw.githubusercontent.com/msys2/MINGW-packages/refs/heads/master/mingw-w64-qemu/PKGBUILD
+ # Some packages may be missing for your environment, installation will
still
+ # be done though.
+ makepkg -s 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.
+
+Meson detects x86_64 processes emulated, so you need to manually set the cpu,
+and force a cross compilation (with empty prefix).
+
+::
+
+ ./configure --cpu=x86_64 --cross-prefix=
+
diff --git a/docs/devel/index-build.rst b/docs/devel/index-build.rst
index 0023953be3..0745c81a26 100644
--- a/docs/devel/index-build.rst
+++ b/docs/devel/index-build.rst
@@ -8,6 +8,7 @@ some of the basics if you are adding new files and targets to
the build.
:maxdepth: 3
build-system
+ build-environment
kconfig
docs
qapi-code-gen
--
2.39.5
- [PATCH v2 03/37] semihosting/syscalls: Include missing 'exec/cpu-defs.h' header, (continued)
- [PATCH v2 03/37] semihosting/syscalls: Include missing 'exec/cpu-defs.h' header, Alex Bennée, 2025/01/14
- [PATCH v2 02/37] semihosting/uaccess: Briefly document returned values, Alex Bennée, 2025/01/14
- [PATCH v2 01/37] semihosting: add guest_error logging for failed opens, Alex Bennée, 2025/01/14
- [PATCH v2 07/37] semihosting/meson: Build config.o and console.o once, Alex Bennée, 2025/01/14
- [PATCH v2 08/37] system/vl: more error exit into config enumeration code, Alex Bennée, 2025/01/14
- [PATCH v2 05/37] semihosting/arm-compat: Include missing 'cpu.h' header, Alex Bennée, 2025/01/14
- [PATCH v2 12/37] contrib/plugins/howvec: ensure we don't regress if this plugin is extended, Alex Bennée, 2025/01/14
- [PATCH v2 17/37] contrib/plugins/hotblocks: fix 32-bit build, Alex Bennée, 2025/01/14
- [PATCH v2 15/37] contrib/plugins/stoptrigger: fix 32-bit build, Alex Bennée, 2025/01/14
- [PATCH v2 09/37] system: squash usb_parse into a single function, Alex Bennée, 2025/01/14
- [PATCH v2 34/37] docs/devel: add information on how to setup build environments,
Alex Bennée <=
- [PATCH v2 06/37] semihosting/console: Avoid including 'cpu.h', Alex Bennée, 2025/01/14
- [PATCH v2 25/37] plugins: enable linking with clang/lld, Alex Bennée, 2025/01/14
- [PATCH v2 26/37] plugins: fix kdoc annotation, Alex Bennée, 2025/01/14
- [PATCH v2 35/37] docs: add a codebase section, Alex Bennée, 2025/01/14
- [PATCH v2 10/37] system: propagate Error to gdbserver_start (and other device setups), Alex Bennée, 2025/01/14
- [PATCH v2 14/37] tests/tcg/plugins/mem: fix 32-bit build, Alex Bennée, 2025/01/14
- [PATCH v2 36/37] docs: add a glossary, Alex Bennée, 2025/01/14