[libc-commits] [libc] [libc][docs] Add doc for using containers to test on a different arch (PR #97431)
via libc-commits
libc-commits at lists.llvm.org
Tue Jul 2 09:10:52 PDT 2024
https://github.com/overmighty created https://github.com/llvm/llvm-project/pull/97431
None
>From 0b68ef11623105aa477c8f9e1a17993b08068714 Mon Sep 17 00:00:00 2001
From: OverMighty <its.overmighty at gmail.com>
Date: Tue, 2 Jul 2024 18:03:59 +0200
Subject: [PATCH] [libc][docs] Add doc for using containers to test on a
different arch
---
libc/docs/build_and_test.rst | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/libc/docs/build_and_test.rst b/libc/docs/build_and_test.rst
index 1571dded96673..629062cba57ac 100644
--- a/libc/docs/build_and_test.rst
+++ b/libc/docs/build_and_test.rst
@@ -79,3 +79,33 @@ Building with Bazel
$> bazel test --config=generic_clang @llvm-project//libc/...
#. The bazel target layout of `libc` is located at: `utils/bazel/llvm-project-overlay/libc/BUILD.bazel <https://github.com/llvm/llvm-project/tree/main/utils/bazel/llvm-project-overlay/libc/BUILD.bazel>`_.
+
+Building in a container for a different architecture
+====================================================
+
+`Podman <https://podman.io/>`_ can be used together with
+`QEMU <https://www.qemu.org/>`_ to run container images built for architectures
+other than the host's. This can be used to build and test the libc on other
+supported architectures for which you do not have access to hardware. It can
+also be used if the hardware is slower than emulation of its architecture on a
+more powerful machine under a different architecture.
+
+As an example, to build and test in a container for 32-bit Arm:
+
+#. To install the necessary packages on Arch Linux:
+
+ .. code-block:: sh
+
+ $> pacman -S podman qemu-user-static qemu-user-static-binfmt \
+ qemu-system-arm
+
+#. To run Bash interactively in an Ubuntu 22.04 container for 32-bit Arm and
+ bind-mount an existing checkout of llvm-project on the host:
+
+ .. code-block:: sh
+
+ $> podman run -it \
+ -v </host/path/to/llvm-project>/:</container/path/to/llvm-project> \
+ --arch arm docker.io/ubuntu:jammy bash
+
+#. Install necessary packages, invoke CMake, build, and run tests.
More information about the libc-commits
mailing list