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: 848456 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp2270694wrt; Mon, 9 Dec 2024 10:32:49 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVuTON4QBQXSRBbxr0cXWgGwIodwFcdgc+6JSe3sCBijMOPzwXKYjE26THR92/vfzV6xLDY5A==@linaro.org X-Google-Smtp-Source: AGHT+IF/DSdUmQDq2Q6XG2cr9drgrXVbjh/5fUUH5OXf2Hll5xlka6K8zu0MY7DKHsfDodEqGHl5 X-Received: by 2002:a05:6214:20c3:b0:6d8:861f:add0 with SMTP id 6a1803df08f44-6d8e71726cbmr236223106d6.31.1733769169118; Mon, 09 Dec 2024 10:32:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733769169; cv=none; d=google.com; s=arc-20240605; b=EzcmDP1dqIQsP+kxGOFprjg2Hoi8urkFDurtZM2EuGoevDMGXxWBmQ4Cm+BHuWBHtK LvWwnFWuS8df0R+Mz5fIyoz9BdQ7APgA3JD9WzBtQFFu4BaVh4LFnksKVqDUs6UAHYxx 81uUHZX7t8tNQBhsrkZG95Uz7/fON5zVA4OHDNGJ2Ji5WEfi/a/RsafuPCxxMOl9OAd9 W3LWbWZYzIMiZYNmY0niZYKSxBmCYW7XVj+pFVa1CLuAjpWWtFcftHML528fo0V+NJW0 EFsMSSsCv0IMhNkp3PVXuTcZLzkeTJpcQrqK07vE8HpfjFuSukHKXCjm4aCKDlkz4OOZ II5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CBM/p49u2jieahHwz0ZRKkSAG9NHcl7RjE84D7tGV3Y=; fh=rVDaemcMUP3khI1q0dJJHJjileR9P6Mcf3yQorCvDFU=; b=YcyNz/SlfHshiFOasVr9fWFKjN0cXBMgFehb3eIflW2BqVqUwBwfM9jK1ogAsmmAd6 F9EIczomKO7M5WZRJDq4ESvPZ4PZSjxCAQnJHDKA9VVb9RfbWcPoirVmT4diJa9mAQlv fY9IBkZW6MHToQ91NH6SK+1Jt2USBzHx9nYKh3+Zu87BW/QlV2s+aekfEsn4LSgFjVdJ KE32qyGFn4KqQcDSdy6d1eCGUhlfuCEvcegkXnJKRdsbX2eAqMNW3sjqXBiat9uVfVT7 +6DpPPSTlGSjoocejGS0UQ+XK6QRluqtU8Dt5U0x9T68EVw6hRevh60N57OFX2FDUlWx g5CA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hpxrpztw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d8f7b91460si73017596d6.411.2024.12.09.10.32.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Dec 2024 10:32:49 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hpxrpztw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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