@@ -325,10 +325,12 @@ Cross-compilation terminology usually distinguishes between two types of machine
325
325
.. note ::
326
326
327
327
Some cross-compilation documentation might also distinguish between a third type of machine, the
328
- target machine. You can read more about it in `this Stack Overflow question
328
+ target machine. You can read more about it in `this Stack Overflow question
329
329
<https://stackoverflow.com/questions/47010422/cross-compilation-terminologies-build-host-and-target> `__.
330
330
For the purposes of conda-forge, we'll consider the target machine to be the same as the host.
331
331
332
+ .. _cross_compilation_howto :
333
+
332
334
How to enable cross-compilation
333
335
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
334
336
@@ -369,8 +371,8 @@ can aid in cross-compilation setups:
369
371
automatically created for you too.
370
372
- ``CC_FOR_BUILD ``: C compilers targeting the build platform.
371
373
- ``CXX_FOR_BUILD ``: C++ compilers targeting the build platform.
372
- - ``CROSSCOMPILING_EMULATOR ``: the emulator to use when emulating the target platform. This is
373
- usually set to the `` qemu `` binary for the host platform .
374
+ - ``CROSSCOMPILING_EMULATOR ``: Path to the `` qemu `` binary for the host platform (see
375
+ :ref: ` emulation `) .
374
376
375
377
This is all supported by two main conda-build features introduced in version 3:
376
378
@@ -438,7 +440,7 @@ In the build script, it would need to update ``cmake`` call and guard any tests
438
440
439
441
# Pass ``CMAKE_ARGS`` to ``cmake``
440
442
cmake ${CMAKE_ARGS} ..
441
-
443
+
442
444
# Skip ``ctest`` when cross-compiling
443
445
if [[ " ${CONDA_BUILD_CROSS_COMPILATION:- } " != " 1" || " ${CROSSCOMPILING_EMULATOR:- } " != " " ]]; then
444
446
ctest
@@ -507,11 +509,11 @@ In practical terms, for conda-forge, this results into two extra metadata bits t
507
509
wrapper for the ``crossenv `` Python interpreters with `some activation logic that adjust some of
508
510
the crossenv workarounds
509
511
<https://github.com/conda-forge/cross-python-feedstock/blob/main/recipe/activate-cross-python.sh> `__
510
- so they work better with the conda-build setup.
512
+ so they work better with the conda-build setup.
511
513
- Copying some Python-related packages from ``host `` to ``build `` with a ``[build_platform !=
512
514
target_platform] `` selector:
513
515
514
- - ``python `` itself, to support ``crossenv ``.
516
+ - ``python `` itself, to support ``crossenv ``.
515
517
- Non-pure Python packages (i.e. they ship compiled libraries) that need to be present while the
516
518
package is being built, like ``cython `` and ``numpy ``.
517
519
@@ -526,7 +528,7 @@ following changes before the builds scripts run:
526
528
is also included in ``$PYTHONPATH ``.
527
529
- A copy of all ``$PREFIX `` site-packages to ``$BUILD_PREFIX `` (except the compiled libraries).
528
530
529
- All in all, this results in a setup where ``conda-build `` can run a ``$BUILD_PREFIX ``-architecture
531
+ All in all, this results in a setup where ``conda-build `` can run a ``$BUILD_PREFIX ``-architecture
530
532
``python `` interpreter that can see the packages in ``$PREFIX `` (with the compiled bits provided by
531
533
their corresponding counterparts in ``$BUILD_PREFIX ``) and sufficiently mimic that target
532
534
architecture.
@@ -556,7 +558,7 @@ Ensure changes are applied by :ref:`rerendering <dev_update_rerender>` the feeds
556
558
Emulation examples
557
559
^^^^^^^^^^^^^^^^^^
558
560
559
- Configure ``conda-forge.yml `` to emulate ``linux-ppc64le ``, but use native runners for ``linux-64 ``
561
+ Configure ``conda-forge.yml `` to emulate ``linux-ppc64le ``, but use native runners for ``linux-64 ``
560
562
and ``linux-aarch64 ``. This works because ``linux-ppc64le `` is not natively supported by Azure, so
561
563
``conda-smithy `` will add QEMU steps to emulate it. However, ``linux-64 `` and ``linux-aarch64 `` are
562
564
natively supported by Azure and Travis CI, respectively, so no emulation is needed.
@@ -568,6 +570,15 @@ natively supported by Azure and Travis CI, respectively, so no emulation is need
568
570
linux_ppc64le : azure
569
571
linux_64 : azure
570
572
573
+ Use this variables in your builds scripts if needed:
574
+
575
+ - ``CONDA_BUILD_CROSS_COMPILATION ``: Set to ``1 `` when build and host platforms differ. This can
576
+ mean your are cross-compiling or emulating.
577
+ - ``CROSSCOMPILING_EMULATOR ``: Path to the ``qemu `` binary for the host platform.
578
+
579
+ See also :ref: `cross_compilation_howto ` for other variables you might find useful in your build
580
+ scripts.
581
+
571
582
Rust Nightly
572
583
------------
573
584
@@ -638,13 +649,13 @@ When should CDTs be used?
638
649
2. When a conda packaged library will not work properly.
639
650
For example: a new ``glibc `` package means we would have to edit the elf interpreter of
640
651
all the conda package binaries.
641
-
652
+
642
653
What's are some good examples?
643
654
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
644
655
645
656
1. The OpenCL loader (``ocl-icd `` together with ``ocl-icd-system ``) provides an OpenCL
646
657
loading library. The loader will look at OpenCL implementations given in
647
- ``$CONDA_PREFIX/etc/OpenCL/vendors ``.
658
+ ``$CONDA_PREFIX/etc/OpenCL/vendors ``.
648
659
For example: Pocl is a conda packaged implementation that runs OpenCL on the CPU. Vendor
649
660
specific implementations like the NVIDIA OpenCL or ROCm OpenCL are not conda packaged, so we
650
661
have to rely on the system. By installing ``ocl-icd-system `` we enable the loader to look at
0 commit comments