[libc-commits] [libc] f1a8f94 - [libc][docs] Add doc for using containers to test on a different arch (#97431)

via libc-commits libc-commits at lists.llvm.org
Wed Jul 3 08:07:54 PDT 2024


Author: OverMighty
Date: 2024-07-03T11:07:49-04:00
New Revision: f1a8f94bba8b090a0d667065e4b8b4fc66b6a5cc

URL: https://github.com/llvm/llvm-project/commit/f1a8f94bba8b090a0d667065e4b8b4fc66b6a5cc
DIFF: https://github.com/llvm/llvm-project/commit/f1a8f94bba8b090a0d667065e4b8b4fc66b6a5cc.diff

LOG: [libc][docs] Add doc for using containers to test on a different arch (#97431)

Added: 
    

Modified: 
    libc/docs/build_and_test.rst

Removed: 
    


################################################################################
diff  --git a/libc/docs/build_and_test.rst b/libc/docs/build_and_test.rst
index 1571dded96673..22b09b07d9612 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 
diff erent 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 
diff erent 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