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: 847584 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp475948wrt; Thu, 5 Dec 2024 14:23:30 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWFwg5kyYP21/VCN7nNopInFPXPiRK6Db1m2AsgqUzxA0woPaNrgzTunOD4NTSoe60v1tT+bQ==@linaro.org X-Google-Smtp-Source: AGHT+IFHZseDMyy7uxwB7Mt34D3sg7imNtSimOm74jTOtcD0kjSffahXzdpyXS3iiab+qRV0/Tx4 X-Received: by 2002:a05:622a:109:b0:461:253e:cb8b with SMTP id d75a77b69052e-46734f8748amr17406571cf.35.1733437410269; Thu, 05 Dec 2024 14:23:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733437410; cv=none; d=google.com; s=arc-20240605; b=kQ8les7SSDofTB7cfGCFXLp2yFUy/vfrIl+3guMIgXURmA+PpzXur1rxK+sSkmkBqe K+jClKuTnu8jwszbNeYjqSAJ4tAFSRw/BqIUhQx3OzDFh0DAi6HJFxHMgdh2Nd+EBfpf BbldtyXHfak0WrzyLPpZ0L1eLfjeTYQMpvtuDSPHpDcfVdEWirFggmBzXNCc22soxBqz ntVRvcp/6EbsT9IwDr74UpYU1iYOsrHHMy1txkYJCKnVFQ1dcPNxg5bt65MDcWts6j73 E5f8UB9FpS1YVpr51elrqx3e5Je2oJwy4NcoB8+qWgjAtT5/BpSrhdSdZxNmsDDRceFz PLbA== 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=KcbaNjWF8lnwvj+PtEoJozlcQBiv6h5KPfhVvS5OAGE=; fh=O7N/1oB1M3FN7UbF/q0R+4lMttX3umDHGGieH0SYQPs=; b=QeroGKC/5h63oplwYYfcj/pvxUEI3N5tG9Jd57DfGqnY83DBr6Tdi+kIBpC7IWjpvw m/RaYaLk8s5CjVjKZQXRSB1vbrp7yQGf+diT/Jmosf1TxHZwaownPLKdcU91k1wuBiPh Q8KHTatW+JAg/mUEHBSj+9xl8c79EnLWdTao3fKIb4s7669kvn+saJ4il6/zDPXGyNTc iq0dFZ59t2YzMXj8kTQd0rPlove0k7H7NaKFknGi4AfiqICR7anqWJv8J6ezKX2+uAZL QX/R7jomfVKwBtyPMZzmiTVtn5XZdaBjtm8nDpt48PvgBf+tZAjA7LmrvVeQVtwdwWv9 6MoQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PsuQRmMp; 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 d75a77b69052e-467296ec270si26165961cf.193.2024.12.05.14.23.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Dec 2024 14:23:30 -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=PsuQRmMp; 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 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-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+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. 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