[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:12:19 PDT 2024


================
@@ -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:
----------------
overmighty wrote:

I picked 22.04 instead of the latest LTS because it has Clang 11, which is currently the minimum we support. Not sure if it's worth mentioning why 22.04 is picked in the example.

https://github.com/llvm/llvm-project/pull/97431


More information about the libc-commits mailing list