Skip to content

Commit aa338f8

Browse files
committed
update windows compiler docs
1 parent 36f536e commit aa338f8

File tree

1 file changed

+49
-27
lines changed

1 file changed

+49
-27
lines changed

docs/maintainer/knowledge_base.md

Lines changed: 49 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -191,19 +191,12 @@ While you can obtain these tools by installing the right version of the full
191191
[Visual Studio](https://visualstudio.microsoft.com/) development
192192
environment, you can save a lot of time and bandwidth by installing standalone
193193
"build tools" packages. You can get them from [Visual Studio
194-
Subscriptions](https://visualstudio.microsoft.com/vs/older-downloads/#visual-studio-2019-and-other-products).
194+
Subscriptions](https://visualstudio.microsoft.com/vs/older-downloads/#visual-studio-2022-and-other-products).
195195
To download build tools, you'll need a Microsoft account. Once on the
196196
Visual Studio Subscriptions page, you may also need to join the Dev Essentials
197197
program. Once that's done, you can click the "Download" tab and search for
198-
"Build Tools for Visual Studio 2022". Until conda-forge has completely
199-
[migrated to Visual Studio 2022](https://github.com/conda-forge/conda-forge.github.io/issues/2138),
200-
you may still need to install "Build Tools for Visual Studio 2019" to locally
201-
build a feedstock. Depending on your needs and available hard drive space, you
202-
can either directly install VC-2019 using the
203-
[Visual Studio Build Tools 2019 installer](https://aka.ms/vs/16/release/vs_BuildTools.exe),
204-
or you can install both VC-2022 and VC-2019 using the
205-
[Visual Studio Build Tools 2022 installer](https://aka.ms/vs/17/release/vs_BuildTools.exe),
206-
making sure to check the optional box for "MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.29)".
198+
"Build Tools for Visual Studio 2022". You can directly install VC-2022 using the
199+
[Visual Studio Build Tools 2022 installer](https://aka.ms/vs/17/release/vs_BuildTools.exe).
207200

208201
If you need more information. Please refer [the Python wiki page on Windows compilers](https://wiki.python.org/moin/WindowsCompilers).
209202

@@ -248,25 +241,50 @@ The following feedstocks are examples of this build structure deployed:
248241

249242
<a id="building-for-different-vc-versions"></a>
250243

251-
#### Building for different VC versions
244+
#### Versions of Microsoft Visual C++ (MSVC)
252245

253-
On Windows, different Visual C versions have different ABI and therefore a package needs to be built for different
254-
Visual C versions. Packages are tied to the VC version that they were built with and some packages have specific
255-
requirements of the VC version. For example, python 2.7 requires `vc 9` and python 3.5 requires `vc 14`.
246+
Up until Visual Studio (VS) 2013, the MSVC compiler changed ABI on every major release,
247+
meaning packages that communicated through a C/C++ API had to be built with a consistent
248+
version. This meant for example that python 2.7 required `vs2008` for the duration of its lifetime.
256249

257-
With `conda-build 3.x`, `vc` can be used as a selector when using the `compiler` jinja syntax.
250+
Since VS2015, the ABI has been kept stable though, meaning that packages do not have to be
251+
built with the same MSVC version. This allows us to avoid complicated migrations for ~all
252+
compiled packages, or getting stuck on old compiler versions.
258253

259-
```yaml
260-
requirements:
261-
build:
262-
- {{ compiler('cxx') }}
263-
```
254+
Speaking of versions, the situation with MSVC can be very confusing. The Visual Studio year is
255+
often used as a shorthand for the compiler generation, but what's really relevant is the
256+
toolchain version, which, since VS2015 has been 14.x, and which is referred to as `vc`.
257+
258+
| VS Year | VS Version | Compiler Version | Toolchain Version | Runtime Version |
259+
|--------|--------|--------|--------|--------|
260+
| 2015 | 14.0 | 19.0 | 14.0 | 14.0.zzzzz |
261+
| 2017 | 15.x | 19.1y | 14.1 | 14.1y.zzzzz |
262+
| 2019 | 16.x | 19.2x | 14.2 | 14.2x.zzzzz |
263+
| 2022 | 17.x | 19.3x | 14.3 | 14.3x.zzzzz |
264264

265-
To skip building with a particular `vc` version, add a skip statement.
265+
In the table above, `x` and `y` on the same line are referring to the same digit, though there
266+
are various deviations from this schema. For example, the minor versions for the 2022 line went
267+
beyond 9, so 17.14 corresponds to compiler 19.44 (30+14) and runtime 14.44.
268+
269+
We are always able to use the newest runtime in an environment, so we always satisfy the respective
270+
lower bound imposed by the compiler version. However, there are other situations where the toolchain
271+
version becomes "viral", in the sense that certain artefacts like static libraries have to be
272+
consumed by a toolchain that's at least as new as the one that produced it. We therefore try to
273+
not raise our default compiler version too quickly.
274+
275+
As of June 2025, we are now on the most recent VS2022 (because VS2019 had reached end-of-life already
276+
in mid 2024), though the next major version of Visual Studio is already on the horizon. It will
277+
still be ABI-compatible, such that we will not have to rebuild everything. In other words, the
278+
toolchain version will remain `14.x`.
279+
280+
If the day ever comes where MSVC breaks the ABI again (codename "vNext"), then we will have to rebuild
281+
all compiled packages in conda-forge on windows. After such a migration has taken place, you can then
282+
choose to skip building for one or the other by using `vc` in a selector, e.g.
266283

267284
```yaml
268285
build:
269-
skip: true # [win and vc<14]
286+
# to demonstrate mechanism: only build vNext
287+
skip: true # [win and vc<15]
270288
271289
requirements:
272290
build:
@@ -275,19 +293,23 @@ requirements:
275293

276294
<a id="using-vs2022"></a>
277295

278-
#### Using vs2022
296+
#### Using newer MSVC versions
297+
298+
Given that conda-forge is currently (June 2025) on the latest VS line, it's currently not possible
299+
to use even newer versions. However, we expect a new Visual Studio major version within the next year
300+
or so, and once it becomes available in the runner-images for Azure Pipelines and then in conda-forge,
301+
it will be possible to opt into newer compilers (e.g. for C++23 support) as follows.
279302

280303
In `recipe/conda_build_config.yaml` file:
281304

282305
```yaml
306+
# note: future VS version is speculative!
283307
c_compiler: # [win]
284-
- vs2022 # [win]
308+
- vs2026 # [win]
285309
cxx_compiler: # [win]
286-
- vs2022 # [win]
310+
- vs2026 # [win]
287311
```
288312

289-
You can look at the changes in [this PR](https://github.com/conda-forge/vcpkg-tool-feedstock/pull/41/files).
290-
291313
After making these changes don't forget to rerender with `conda-smithy` (to rerender manually use `conda smithy rerender` from the command line).
292314

293315
<a id="cmd-batch-syntax"></a>

0 commit comments

Comments
 (0)