Skip to content

Commit 5003dd8

Browse files
authored
update infrastructure.rst/compilers (#1950)
1 parent a11ec37 commit 5003dd8

File tree

2 files changed

+120
-12
lines changed

2 files changed

+120
-12
lines changed

docs/glossary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ sidebar_position: 27
1515

1616
## ABI
1717

18-
**A**pplication **B**inary **I**nterface. ABI is a document that comprehensively defines the binary system interface between applications and the operating system on which they run. [Learn More](https://en.wikipedia.org/wiki/Application_binary_interface).
18+
**A**pplication **B**inary **I**nterface. ABI is a document that comprehensively defines the binary system interface between applications and the operating system on which they run. [Learn More at Wikipedia](https://en.wikipedia.org/wiki/Application_binary_interface) or [pypackaging-native](https://pypackaging-native.github.io/background/binary_interface).
1919

2020
<a id="term-CDT"></a>
2121

docs/maintainer/infrastructure.md

Lines changed: 119 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -457,36 +457,144 @@ take more serious actions, including archiving feedstocks or removing maintainer
457457

458458
conda-forge builds and maintains its own set of compilers for various languages
459459
and/or systems (e.g., `C`, `FORTRAN`, `C++`, `CUDA`, etc.). These are used
460-
in all of our CI builds to build both core dependencies (e.g., `Python`) and maintainer-contributed
461-
packages. While we do not have any formal policies or promises of support for these
460+
in all of our CI builds to build essentially all artefacts published by conda-forge.
461+
462+
This compiler infrastructure has a critical role beyond building everything, which
463+
is to ensure that packages stay compatible with each other. This is due to how compiled
464+
packages have a so-called [Application Binary Interface](../glossary.md#abi)
465+
(ABI), and how changes in the compiler infrastructure may break this ABI, leading
466+
to crashes, miscalculations, etc. Generally speaking, using a consistent compiler
467+
version greatly reduces the risk of ABI breaks.
468+
469+
Compilers generally strive to maintain ABI-compatibility across versions, meaning that
470+
combining artefacts for the same target produced by different versions of the same
471+
compiler will work together without issue. Due to the nature of the ABI (i.e. a vast
472+
interface between software and hardware, with innumerable corner cases), it still
473+
happens that unintentional changes for some specific aspect are introduced across
474+
compiler versions, though in practice this does not lead to wide-spread issues.
475+
476+
In contrast, when compilers do intentionally change the ABI (as MSVC did with each
477+
release before the `vc14` series currently covering VS2015-VS2022), _every_ compiled
478+
package needs to be rebuilt for that new ABI, and cannot be mixed with builds for the
479+
old ABI. While less likely nowadays, in principle it's also possible that a major
480+
infrastructural overhaul in the compiler stack similarly forces a complete rebuild.
481+
482+
Such large-scale changes – requiring +/- all of conda-forge to be rebuilt – take a
483+
lot of effort, though thankfully, in recent years such full rebuilds have not been
484+
necessary and we managed to do less disruptive compiler upgrades.
485+
486+
However, large-scale ABI breaks remain a possibility (e.g. MSVC is planning a vNext
487+
after `vc14`), and so we keep our policies for such a scenario in place.
488+
While we do not have any formal promises of support for a generation of ABI-compatible
462489
compilers, we have historically maintained them according to the following (non-binding)
463490
principles.
464491

465492
- The authoritative source of the current compilers and versions for various languages
466493
and platforms is the [conda_build_config.yaml](https://github.com/conda-forge/conda-forge-pinning-feedstock/blob/master/recipe/conda_build_config.yaml)
467494
in the [conda-forge/conda-forge-pinning-feedstock](https://github.com/conda-forge/conda-forge-pinning-feedstock)
468495
as described in [Globally pinned packages](pinning_deps.md#globally-pinned-packages).
469-
- We provide no support of any kind in terms of the long-term stability of these pinnings.
496+
- We provide no support of any kind in terms of the long-term stability/support of a given compiler generation.
470497
- We upgrade them in an ad-hoc manner on a periodic basis as we have the time and energy to do so.
471498
Note that because of the way we enforce runtime constraints, these compiler upgrades will not break
472499
existing packages. However, if you are using the compilers outside of `conda`, then you may find issues.
473-
- We generally provide notice in the form of an announcement when a compiler is going to be upgraded.
500+
- We generally provide notice in the form of an announcement when an ABI-incompatible compiler change is going to happen.
474501
Note that these changes take a bit of time to complete, so you will generally have time
475502
to prepare should you need to.
476503
- Some of the criteria we think about when considering a compiler migration include:
477504
- the degree of disruption to the ecosystem,
478505
- the amount of work for the `core` team,
479506
- the amount of time it will cost our (volunteer) feedstock maintainers.
480507

481-
We do use some unofficial names for our compiler stack internally. Note however that
482-
the existence of these names does not imply any level of support or stability for the compilers
508+
These compiler generations may or may not have some unofficial names for our
509+
internal use (e.g. `comp7`). We note again that the existence of these names
510+
does not imply any level of support or stability for the compilers
483511
that form the given stack.
484512

485-
- Our current compiler stack is referred to internally as `comp7`.
486-
- The previous compiler stack based in part on the various `toolchain_*` packages
487-
was sometimes referred to as `comp4`. On linux the `toolchain_*` compilers were
488-
GCC 4.8.2 as packaged in the devtoolset-2 software collection. On osx, we use clang from
489-
Apple's Xcode in the `toolchain_*` packages.
513+
For the cases that do not require a complete rebuild of conda-forge (i.e. if the ABI
514+
of a new compiler remains compatible, up to rare corner cases), we can just increase
515+
the version in our global pinning, and it will slowly roll out to the ecosystem as
516+
feedstocks get rerendered.
517+
518+
For such ABI-compatible upgrades, similar but looser principles apply:
519+
520+
- The pins are similarly defined in the global pinning, see [Globally Pinned Packages](pinning_deps.md#globally-pinned-packages).
521+
- We provide no support of any kind in terms of the long-term availability of a given compiler version.
522+
- We generally provide notice in the form of an announcement when a compiler is going to be upgraded.
523+
- Without promising any timelines, our compilers on Linux and OSX are normally
524+
very recent; on Windows, we generally use the last supported VS version.
525+
526+
Despite the lack of explicit support, we try to keep the compilers in their various versions
527+
working also outside of conda-forge, and even provide an easy way to install them
528+
(through the [compilers feedstock](https://github.com/conda-forge/compilers-feedstock)).
529+
530+
More specifically, each compiler uses an _activation_ package that makes the difference
531+
between it being merely present in a build environment, and it being used by default.
532+
These will be installed when using `{{ compiler('xyz') }}` in `meta.yaml`, where
533+
`'xyz'` is one of `'c', 'cxx', 'fortran', 'cuda', 'rust', 'go-cgo', 'go-nocgo'`.
534+
535+
Our default compiler stack is made up very differently on each platform; each platform
536+
has its own default compiler, with its own set of feedstocks that provide them. Due to historical
537+
reasons (the way compilers are integrated with their OS, and the amount of
538+
software written in them, etc.), the most impactful languages are C & C++ (though
539+
Fortran is considered part of the default, not least because GCC compiles all three).
540+
541+
Linux (GCC):
542+
543+
- [C, C++, Fortran] Activation: https://github.com/conda-forge/ctng-compiler-activation-feedstock/
544+
- [C, C++, Fortran] Implementation: https://github.com/conda-forge/ctng-compilers-feedstock
545+
- Note that when used in conjunction with CUDA, compiler versions are restricted by the
546+
maximum GCC version supported by nvcc (which is also reflected in the global pinning).
547+
548+
OSX (Clang):
549+
550+
- [C, C++] Activation: https://github.com/conda-forge/clang-compiler-activation-feedstock/
551+
- [C, C++] Required feedstocks:
552+
[llvmdev](https://github.com/conda-forge/llvmdev-feedstock),
553+
[clangdev](https://github.com/conda-forge/clangdev-feedstock),
554+
[compiler-rt](https://github.com/conda-forge/compiler-rt-feedstock),
555+
[libcxx](https://github.com/conda-forge/libcxx-feedstock),
556+
[openmp](https://github.com/conda-forge/openmp-feedstock),
557+
[lld](https://github.com/conda-forge/lld-feedstock),
558+
[cctools](https://github.com/conda-forge/cctools-and-ld64-feedstock)
559+
- [Fortran] Activation: https://github.com/conda-forge/gfortran_osx-64-feedstock/
560+
- [Fortran] Implementation: https://github.com/conda-forge/gfortran_impl_osx-64-feedstock/
561+
562+
Windows (MSVC):
563+
564+
- [C, C++] Activation: https://github.com/conda-forge/vc-feedstock
565+
(we cannot redistribute the actual MSVC compilers due to licensing constraints)
566+
- [Fortran] Activation & Implementation: https://github.com/conda-forge/flang-feedstock
567+
568+
There exists an alternative, MinGW-based, compiler stack on Windows, which is available
569+
with a `m2w64_` prefix (e.g. `{{ compiler('m2w64_c') }}`). However, it is falling out
570+
of use now that most projects will natively support compilation also with MSVC, in addition
571+
to several complications arising from mixing compiler stacks.
572+
573+
Additionally, there is a possibility to use `clang` as a compiler on Linux & Windows:
574+
575+
- Activation (Linux): https://github.com/conda-forge/ctng-compiler-activation-feedstock/
576+
- Activation (Windows): https://github.com/conda-forge/clang-win-activation-feedstock/
577+
578+
Aside from the main C/C++/Fortran compilers, these are the feedstocks for the other compilers:
579+
580+
- [CUDA] [CUDA 12.0+](https://github.com/conda-forge/cuda-nvcc-feedstock) & [CUDA <12](https://github.com/conda-forge/nvcc-feedstock) (legacy)
581+
- [Rust] [Activation](https://github.com/conda-forge/rust-activation-feedstock)
582+
and [Implementation](https://github.com/conda-forge/rust-feedstock)
583+
- [Go] [Activation](https://github.com/conda-forge/go-activation-feedstock)
584+
and [Implementation](https://github.com/conda-forge/go-feedstock)
585+
586+
To upgrade the compiler version of our default compilers in the global pinning for
587+
Linux or OSX, ensure that the respective above-mentioned feedstocks have been rebuilt
588+
for the new major version, that all interrelated versions are lifted at the same time,
589+
and obviously that the compilers work (e.g. by testing them on some feedstocks by
590+
specifying the new version through the feedstock-local `conda_build_config.yaml`).
591+
You should also check the compiler release notes for warnings about ABI incompatibilities,
592+
and mention any such notices in the discussion about the upgrade.
593+
594+
For Windows, we stay on older compilers for longer, because using a newer toolchain
595+
would force everyone wanting to locally develop with conda-forge artefacts to use
596+
a toolchain that's at least as new. You can find more details about this topic in this
597+
[issue about updating to the vc142 toolchain](https://github.com/conda-forge/conda-forge.github.io/issues/1732).
490598

491599
### CentOS `sysroot` for `linux-*` Platforms
492600

0 commit comments

Comments
 (0)