From patchwork Mon Dec 9 18:31:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 13900193 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 63E42E7717D for ; Mon, 9 Dec 2024 18:32:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKiXU-0002Yf-Cl; Mon, 09 Dec 2024 13:31:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tKiXO-0002Vi-Up for qemu-devel@nongnu.org; Mon, 09 Dec 2024 13:31:20 -0500 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKiXL-0006uz-Gs for qemu-devel@nongnu.org; Mon, 09 Dec 2024 13:31:18 -0500 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-7259d6ae0c8so3963313b3a.0 for ; Mon, 09 Dec 2024 10:31:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733769074; x=1734373874; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CBM/p49u2jieahHwz0ZRKkSAG9NHcl7RjE84D7tGV3Y=; b=hpxrpztwav6FAa2osibZzFxDG4EiXbUtzyN1SRBZyBAaAe70jWVJFODhycMiahluJa DswKVJ4TbgAQ+KEpVW+F+K7lZvFT+IthMLfYxgqP9edfEXPECu0GnCOD28tkPx790O0b ceJlq4KLg1dCH7ARBjaBzVJlCM3FwQQHcQBiOtGCBgm5o4T0+DTw57e3mymluiogb3wH pb8XTUwLIKXPsjDNd6GP3U1ZVkVa9YGbYtrCSE6HRtvs2Y1gZW5W5mBeBvw3MJMf1d/r 1fz4MF4eq5ddeDRZICX/0Rk+6bmIdKX5osaJp5J7VlSFEiEILjJSfrUbNq9cv4I9Oy3X Up0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733769074; x=1734373874; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CBM/p49u2jieahHwz0ZRKkSAG9NHcl7RjE84D7tGV3Y=; b=kZbkR2hmyLisf9njWbQWFFAsplYZIBYqwtm/uAM7m+5D+V9Ya3lwUtYT1OrcakG3yc 7Q269qVGdm34EI9jGSKRNj6pU/Ktm3UP4jEacFv9an1N4+8z18EHvmo+DvnrQ4aApq4D KFNrK0qQ93nE96RET94vkIBNHfCtjRdSf+qH1pien2+JxGEevgY+BtgKrkDAJFOkRW7j KqLZQimJWGJn9vXLKLSrddGqLnwGGrehTeUXAMAXYLbRyNfBhAqpo1ADiaea2Qwcjeyt Cs0WT1YVtDpsc/tic24OLMBnkZd30tTE7n0Xld8wMwOio7c+CQlGvHZQcF5Qes6arkKq ou9A== X-Gm-Message-State: AOJu0Yyr+GC9yoQTd5bXtFjgMlsgtXGasWphxdQyXmjeWA2Z7KX/woMW ywfRAuQl7fZ5KLLagWylQTpQjoRIh8972vifj3Os5/DzEwyRRJm7QJqF5S1e/fgbWwiPpZeWQaI gT6U= X-Gm-Gg: ASbGnct4ZcZqpv6O/vFGwk4cuk//Cmbm0ietMe3tPTumP2QK0CX6uFF0zZt2nI7ST+2 EXREzRykggmC4ILGYZDHfeGE/EwgzK+a34iUxudfOLWNCkF4znFqZuDRBCcWhuxiL5J3ysUrIQ1 NNuJMOhAeboCOOEj3HZe5gYhnkaggogJV14+Ucq08KzSY//qZ/NNkSdy11dfnc6tNH9Fi3Ak06A Skymgevby7MTbPSv1eVVImEhQ9FHW3aIdvM2mDOQM5g7lbYS0HD+ReTih2OgLCP2192R/n0xFbD IqOd+Yy+Lqzx X-Google-Smtp-Source: AGHT+IG4xVqZ5JAJVqvox16c4c22BfLKT+SrLm8O6qDi0i0+gSqm+GrVLMSA/VkkSOW5NViTFLxw9w== X-Received: by 2002:a05:6a20:c78c:b0:1e0:d848:9e83 with SMTP id adf61e73a8af0-1e1870cc3c8mr23445354637.25.1733769072320; Mon, 09 Dec 2024 10:31:12 -0800 (PST) Received: from pc.. (216-180-64-156.dyn.novuscom.net. [216.180.64.156]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-725e2388d37sm3322821b3a.73.2024.12.09.10.31.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2024 10:31:11 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: manos.pitsidianakis@linaro.org, Andrew Melnychenko , Thomas Huth , Michael Roth , qemu-block@nongnu.org, Jason Wang , =?utf-8?q?Daniel_P?= =?utf-8?q?=2E_Berrang=C3=A9?= , Yuri Benditovich , Kevin Wolf , Peter Xu , qemu-arm@nongnu.org, Peter Maydell , philmd@linaro.org, Fabiano Rosas , Konstantin Kostiuk , Eric Blake , Paolo Bonzini , Vladimir Sementsov-Ogievskiy , Markus Armbruster , gustavo.romero@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Pierrick Bouvier Subject: [PATCH v4 4/6] docs/devel: add information on how to setup build environments Date: Mon, 9 Dec 2024 10:31:02 -0800 Message-Id: <20241209183104.365796-5-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241209183104.365796-1-pierrick.bouvier@linaro.org> References: <20241209183104.365796-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pf1-x42a.google.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_SBL_A=0.1 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org MacOS and Linux are straightforward, but Windows needs a bit more details. Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier --- 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 d8b0445157f..482b09819c1 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 00000000000..f133ef2e012 --- /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 `_: + +- `Linux `_ +- `MacOS `_ +- `Windows `_ +- `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 `_. +Then, use apt to install dependencies: + +:: + + sudo apt update && sudo apt build-dep qemu + +MacOS +----- + +You first need to install `Homebrew `_. Then, use it to +install dependencies: + +:: + + brew update && brew install $(brew deps --include-build qemu) + +Windows +------- + +You first need to install `MSYS2 `_. +MSYS2 offers `different 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 0023953be36..0745c81a264 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