Skip to content

Commit 73766bb

Browse files
committed
add emulation docs
1 parent a072524 commit 73766bb

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

sphinx/src/maintainer/knowledge_base.rst

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,8 @@ The rule of the thumb is:
387387
- If it needs to be available on the target host, it goes in ``host``.
388388
- If both conditions are true, it belongs in both.
389389

390-
However, there are some exceptions to this rule; most notably Python cross-compilation (see below).
390+
However, there are some exceptions to this rule; most notably Python cross-compilation
391+
(:ref:`see below <python_cross_compilation>`).
391392

392393
Cross-compilation examples
393394
^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -484,6 +485,8 @@ but merely to provide a starting point with some guidelines. Please look at `oth
484485

485486
.. _other recipes for more examples: https://github.com/search?q=org%3Aconda-forge+path%3Arecipe%2Fmeta.yaml+%22%5Bbuild_platform+%21%3D+target_platform%5D%22&type=code
486487

488+
.. _python_cross_compilation:
489+
487490
Details about cross-compiled Python packages
488491
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
489492

@@ -526,6 +529,43 @@ All in all, this results in a setup where ``conda-build`` can run a ``$BUILD_PRE
526529
their corresponding counterparts in ``$BUILD_PREFIX``) and sufficiently mimic that target
527530
architecture.
528531

532+
.. _emulation:
533+
534+
Emulated builds
535+
---------------
536+
537+
When cross-compilation is not possible, one can resort to emulation. This is a technique that uses
538+
a virtual machine (`QEMU <https://www.qemu.org/>`__) to emulate the target platform, which has a
539+
significant overhead. However, ``conda-build`` will see the target platform as native, so very
540+
little changes are usually needed in the recipe.
541+
542+
To enable emulated builds, you must use the :ref:`provider` mapping in ``conda-forge.yml``.
543+
This key maps a ``build_platform`` to a ``provider`` that will be used to emulate the platform.
544+
``conda-smithy`` will know how to detect whether the provider supports that platform natively or
545+
requires emulation, and will adjust the appropriate CI steps to ensure that QEMU runs the process.
546+
Ensure changes are applied by :ref:`rerendering <dev_update_rerender>` the feedstock.
547+
548+
.. warning::
549+
550+
Emulated builds are very slow and incur an additional strain on conda-forge CI resources.
551+
Whenever possible, please consider cross-compilation instead. Only use emulated builds as a last
552+
resort.
553+
554+
Emulation examples
555+
^^^^^^^^^^^^^^^^^^
556+
557+
Configure ``conda-forge.yml`` to emulate ``linux-ppc64le``, but use native runners for ``linux-64``
558+
and ``linux-aarch64``. This works because ``linux-ppc64le`` is not natively supported by Azure, so
559+
``conda-smithy`` will add QEMU steps to emulate it. However, ``linux-64`` and ``linux-aarch64`` are
560+
natively supported by Azure and Travis CI, respectively, so no emulation is needed.
561+
562+
.. code-block:: yaml
563+
564+
provider:
565+
linux_aarch64: travis
566+
linux_ppc64le: azure
567+
linux_64: azure
568+
529569
Rust Nightly
530570
------------
531571

0 commit comments

Comments
 (0)