From patchwork Thu Dec 5 22:22:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 13896049 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 67ECBE7716E for ; Thu, 5 Dec 2024 22:23:30 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tJKFR-0004gb-BI; Thu, 05 Dec 2024 17:23:01 -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 1tJKFO-0004cV-37 for qemu-devel@nongnu.org; Thu, 05 Dec 2024 17:22:58 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tJKFK-000819-OR for qemu-devel@nongnu.org; Thu, 05 Dec 2024 17:22:57 -0500 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-215810fff52so16134415ad.1 for ; Thu, 05 Dec 2024 14:22:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733437373; x=1734042173; 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=KcbaNjWF8lnwvj+PtEoJozlcQBiv6h5KPfhVvS5OAGE=; b=PsuQRmMpRlTNNg4NYZ7kCNZd/OOjP08dobI8ari99+Bcmbn2uFaTnqWlg877vwH4rr Klw7boFFsogDmH50arvX1YZR5IPQk6NgEULhy8Y9LVQVQ+f+Wp8QbNGVJ0IMuWuedNcx unIGiqARuG9g20MK4epsio2MbTLbFhIS5TbmjhpoAsCUp82NkyMcRE0OBGfJ/JWCUlPG SH1qlsZojCnibHqqmBG5XKVxlitJC2xxWeP/9VzgSbH6Z397eT2ZKBr0hUDD2m+2Gcuw R9X6mRH6YW+CA+ck6h1qaKOfXyW8JVqqG8m6R/2hH0vKuNuEaW2ybqJLP3s0y5uyYbgX kA5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733437373; x=1734042173; 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=KcbaNjWF8lnwvj+PtEoJozlcQBiv6h5KPfhVvS5OAGE=; b=IGR9c28jU5780YAZ7sBvOzKJx2JNZ3zui3lTPRQyO8gUyag0wX95/sIrzj5De45yqP XFuGJsRCgWsvJS2aaCqQXGtCZvlTgjfCe97maLDHnHkGS1HqN8K86+YhlGKWCcSHZvgJ GXc7p0cR1aZ2HM7YzySVMDBMyQqcvqbc6+QHj5D3BboYwqeqO4Hp4o2/GZbhtQDPNt23 jBHvU6iFy3f65hHdWo/V0Dr+balp7V4J9ry3w7wJG92Sxwhm1b2Cjf013L+RaJIhb2gB gaVqd5UhYK8OGAEgmgFcScOSwHb3hnRkZDokNopao1bwQnXFXVDWrEx06tAAUuDd1h3a aodA== X-Gm-Message-State: AOJu0YxBZkulm9XDK+prMa+KnitSXu2EkKiGUguamo6DIk2kDeuZmmVd w3Lo1D1TTlkWKAWWE/4JKTEfwpPAi3g77qjh6IYFI+AG9Jg4+wEB16A6qyZsoT1cE3cfvRIuHs7 oMQI= X-Gm-Gg: ASbGncslDULMa/bgwGhlKQ2d+fL0VYjAKztQsxy6utvXcc01Q2CGc1iIklExLPhrTbV 7tlQivDuH9jgQunKMwwdkoI8KQWtK+QftTirNOU+1AuR7gbhdjQWzcTC+5eMUWW0Ljg55q813hL D2r4Wq7aCnYYefyJYYEbN5wIjkxJFHVrvR99gPfiGs4M88E/GNsw0tTMIJyljNNBjuzt7idHE3H elMMacr4wvCqb3VA/7KsxZZ2hbz9o+xch1SGr7IotD2j/vdwZ9z4US2ZEYGaDbLJeuwi+jb5bwa rttLczh1 X-Google-Smtp-Source: AGHT+IHIbtAAqdAFW+Oy5fuBgsr/s1pWnvnmvxuaSKy/z0uO/rzsU77P4JYdSX7D+Q1C5liHGAtQqQ== X-Received: by 2002:a17:903:41c9:b0:215:620f:8de4 with SMTP id d9443c01a7336-21614d1a449mr7912055ad.2.1733437373275; Thu, 05 Dec 2024 14:22:53 -0800 (PST) Received: from pc.. (216-180-64-156.dyn.novuscom.net. [216.180.64.156]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-215f8f0b571sm17310435ad.183.2024.12.05.14.22.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2024 14:22:52 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Kevin Wolf , Richard Henderson , Vladimir Sementsov-Ogievskiy , gustavo.romero@linaro.org, Andrew Melnychenko , Peter Maydell , qemu-arm@nongnu.org, alex.bennee@linaro.org, Konstantin Kostiuk , Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Xu , Markus Armbruster , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Yuri Benditovich , Jason Wang , Michael Roth , Paolo Bonzini , Thomas Huth , manos.pitsidianakis@linaro.org, qemu-block@nongnu.org, Pierrick Bouvier Subject: [PATCH v2 4/6] docs/devel: add information on how to setup build environments Date: Thu, 5 Dec 2024 14:22:39 -0800 Message-Id: <20241205222241.3789437-5-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241205222241.3789437-1-pierrick.bouvier@linaro.org> References: <20241205222241.3789437-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x62b.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. 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