From patchwork Fri Dec 6 19:28:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 847870 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp960009wrt; Fri, 6 Dec 2024 11:31:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUHInix6A5WyAxXuJNFV3WWw8cFJXThivTB5jXcsI4gj+wHzXJL4ondXEMkJEAKUBq5tuCKoA==@linaro.org X-Google-Smtp-Source: AGHT+IGmQP6ONiH8/5LLrK7ifqGtmO6enjyfeGdO1fqQxsISQnzOT4YfdjqaEOscSc5ufDUH2KqI X-Received: by 2002:ac8:5f0a:0:b0:45f:3b3:49e6 with SMTP id d75a77b69052e-46734dbc70amr59624251cf.41.1733513477770; Fri, 06 Dec 2024 11:31:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733513477; cv=none; d=google.com; s=arc-20240605; b=RGZ76Xt9d3s4O5t8AFV0P2PRR/ue+EyolQIGz4lbRLqcPqIqG9dEBMRqj8qdgYWNg1 mw/22oa5Zi6kUAmAJq1aHk1dYOyXqTDlOv5ReKP9qEPqv066cfLseh28/nTYYrPcWlSB 4nwsIz691DiMDcpMi9wEGEKF8jkpnHNIntHpISmsJkeaQTHRNKraE8+1AI0ZWacGZY6r LmIr6Z/HoWDOUhzAmnDwEP/TL4rI5yr5dBholu4xXrvt1bttSu55JgIktY6J8qqJ4WhR 9VOVf1N7bKi9OtupkDjwy7Dwt3y/9td/X+M+cpWGyd7uWSpM6JAfGOqQeBT2SO2ap3xv r5mQ== 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=uyWfmQhlxlmFXxA9Akl79dY7oHuR3OlLAm2AMpyXO98=; b=eWYGBp7QL8pQdwVuTe1OSEA3C7hhPUStasu6z06AIRFLDPW5/QwSESkCrUZrEv3x05 FnXXh8enFoh5SI+6T72up5xiwq/FN0/dP4kbZU0WoQfXqsVxZypzXvdhoo3XcONj85mv 8iHs56GLSQsuDihzu+YUFWdITsR20jYsKDaQTut3sJVivj5iHXgYU5HXKhiy6l9iUHWu yVfTIkwhzuTKmf/ZsScmRcs1iA9zT9WSfwtxphtzBQBULNEuilfFmXFt+n1TtO4rt4Ap tyOytMx/M5VKZE+WbozEcQfazEhCBzPNyGjQP6mCyOrE7NTGYZoeUPSHManfiHXQDlYS iMlQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GkOUllCK; 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-4672986d2b8si56916471cf.727.2024.12.06.11.31.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Dec 2024 11:31:17 -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=GkOUllCK; 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 1tJe1d-0003OX-DU; Fri, 06 Dec 2024 14:30:05 -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 1tJe0w-0002sw-1e for qemu-devel@nongnu.org; Fri, 06 Dec 2024 14:29:22 -0500 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tJe0r-0005G2-6f for qemu-devel@nongnu.org; Fri, 06 Dec 2024 14:29:20 -0500 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-724f42c1c38so2252422b3a.1 for ; Fri, 06 Dec 2024 11:29:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733513353; x=1734118153; 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=GkOUllCKNw+ZSOFey7MkwD+NR56Q7EHOKverAmVWvMehgMwHYAVhfrH1nJxcWZZffC Nn0ktfsqJ70jAverfHLxppf5XRFQZW/SBIYWpHPlYvVE3M1aJyySitxuNQwgOJGNAFkm lZtp1rDF+yREd6dZjGXX7i67Xb6ypH/1RpmmHAffShj7bSNmSLuBi2VW2kHCO6OH0tQy HlNvW+y+SmWnxnqRrteabt6Si7OWZ/xtTQ4tNU8rDbXcXeWUEo1NsNqk/T8VgvE//LDH rutr33oCi6YvQT4mrWLOnkCSk3Ju1gnMA+IkLDTnPXoTlI5hMTnrnUrnwTXf9QKtSMcN djDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733513353; x=1734118153; 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=rym3o+o/RHv4IRBWomhW1S1D+Q7hT6nQnIBwcHXmHMgNNK16RUPlCLRMeW78NRMqIn eKHUujmAiTbL7j5iFeCY3eX8M6tqmLUw4yYeyteWG2dy4GVdXDe5lgcCmS0EtQmX8ycm fJBggOL5adumc859oMGQX57mnrDx3togRQf455ft+8GUjoXwEUya3YH1KHhKygaNVSHE j3labJjc1zHuknCI8IOGJYq0JGQBGrE076prjHre5rHI1VFzBAhxhMEFRHZcH6E0/iJa WH2YtcRV+FBdiyi4MBCu3gZdjxsO/LciBeh9tPmGJvzl+6qDNAsUFvGH2VIG9zXHcxjA S4lw== X-Gm-Message-State: AOJu0YybwDRoh6FKQU/xdE007b1p45TMcZRriFUi6Mpo4DzOOQKQkjTP m8FuqKKsMhcW4sP1aDklv0+k03ZLzSufYFDZYAPjkBPHBC47NEhgHK5I3bk0Qei4t3MMgd4Bd8H TIvg= X-Gm-Gg: ASbGncvkopXiVN7pLvz8LWtjdjkDM9n0/4Q7orQSiFsjco9lX8BzgJKVcV831LYhVw/ ez35kzOZCbPaLbM0gwBStOH4uFW1RCEfXTGLUGUlwsX0l6w0SL23fa9LyD2pBul6lsj+uui9W41 Dc3RBe6XzXMlF+gHoYORVEAH/SFFNtX9+MR22QBIpS3/ZuaTzK2QqMM5IPCK9U1esDKU4orpDnQ 3sUSJtpRWY5BBfMl67rZjHXQhzyMmlBQJKIE06FbiuXRnGlmCm1SZYD2vNPkSYxD5+c3vJCzaP+ iyp1ZS06 X-Received: by 2002:a17:902:f611:b0:216:282d:c692 with SMTP id d9443c01a7336-216282dd85emr12524825ad.34.1733513353005; Fri, 06 Dec 2024 11:29:13 -0800 (PST) Received: from pc.. (216-180-64-156.dyn.novuscom.net. [216.180.64.156]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-215f8ef9fcdsm32110205ad.146.2024.12.06.11.29.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 11:29:12 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , qemu-block@nongnu.org, philmd@linaro.org, Paolo Bonzini , Fabiano Rosas , Vladimir Sementsov-Ogievskiy , =?utf-8?q?Daniel_?= =?utf-8?q?P=2E_Berrang=C3=A9?= , Markus Armbruster , qemu-arm@nongnu.org, Michael Roth , Peter Xu , gustavo.romero@linaro.org, Yuri Benditovich , Eric Blake , Andrew Melnychenko , Konstantin Kostiuk , Kevin Wolf , Thomas Huth , Jason Wang , manos.pitsidianakis@linaro.org, Pierrick Bouvier Subject: [PATCH v3 4/6] docs/devel: add information on how to setup build environments Date: Fri, 6 Dec 2024 11:28:58 -0800 Message-Id: <20241206192900.3893118-5-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241206192900.3893118-1-pierrick.bouvier@linaro.org> References: <20241206192900.3893118-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pf1-x42e.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