Skip to content

Conversation

mgorny
Copy link

@mgorny mgorny commented Sep 15, 2025

PR Checklist:

  • note any issues closed by this PR with closing keywords [n/a]
  • if you are adding a new page under docs/ or community/, you have added it to the sidebar in the corresponding _sidebar.json file [n/a]
  • put any other relevant information below

This is an attempt to improve structure of the compiler section in the infrastructure page. Currently it consists of a single long block of text with a tiny subsection at the end, with different concepts being mixed together and different audiences being addressed somewhat simultaneously.

What I've done here is:

  1. Split it into multiple subsections focused on a single topic each.
  2. Let every section focus on a particular audience: feedstock maintainers, users, advanced users, compiler feedstock maintainers.
  3. Include more specific examples.
  4. Document {{ stdlib('c') }} macro.
  5. Split the list of compilers/platforms (which is useful for the more general audience) from the low-level technical details of compiler feedstocks.
  6. Added a few missing bits here and there.
  7. Cross-linked with other bits of documentation.

This is done from the perspective of someone who's relatively new to conda-forge, but not to the more general topic of packaging and compilers, so it's possible I'm missing something (from both perspectives).

For now, introduce a few sections as a proposed structure and move
the relevant paragraphs unchanged into them.

Signed-off-by: Michał Górny <[email protected]>
@mgorny mgorny requested a review from a team as a code owner September 15, 2025 14:01
Copy link

netlify bot commented Sep 15, 2025

Deploy Preview for conda-forge-previews ready!

Name Link
🔨 Latest commit d287915
🔍 Latest deploy log https://app.netlify.com/projects/conda-forge-previews/deploys/68f13409b59b34000814d2e1
😎 Deploy Preview https://deploy-preview-2596--conda-forge-previews.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 78
Accessibility: 96
Best Practices: 100
SEO: 89
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Member

@jaimergp jaimergp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments for now! The split is definitely an improvement. In further passes I'd like to start splitting this page a bit further.

Also pinging @h-vetinari and @isuruf for additional comments, if there are any.

Thanks!

Copy link
Member

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this

mgorny and others added 2 commits September 26, 2025 09:57
@mgorny
Copy link
Author

mgorny commented Sep 26, 2025

Okay, I think I've addressed all the remarks, but you'll probably have some ideas how to improve the wording :-).

As suggested by @isuruf.

Signed-off-by: Michał Górny <[email protected]>
Comment on lines 578 to 586
Alternatively, the specific compiler name can be used as an argument to
the `{{ compiler(...) }}` macro, e.g.:

```yaml
requirements:
build:
- {{ compiler('clang') }}
- {{ stdlib('c') }}
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL! Nice. Is this officially supported or more like a nice byproduct of how compiler() works (by adding the _{build_platform} subdir)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, found my answer in #2596 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's supported. If clang_compiler is set in cbc, it's used. Otherwise clang is used.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, found my answer in #2596 (comment)

I cannot find the source of that statement in that thread. If you're basing this on my comment about clang vs. clang-cl, then I was talking about the values of c_compiler: in CBC, not the keys used in the compiler() macro.

TBH, I think {{ compiler('clang') }} is highly confusing and we should not be supporting it at all in official docs. It works by accident because of the way that {{ compiler("foo") }} will work if you set foo_compiler: in CBC and the package-name constructed with <value_of_foo_compiler>_{{ target_platform }} happens to be legit.

Copy link
Member

@h-vetinari h-vetinari Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works by accident because of the way that

Actually, it's even worse than that. If you use {{ compiler("foo") }} and there's no foo_compiler: in CBC, conda-build will just construct foo_{{ target_platform }}, which is completely different from the way the compiler() macro usually works. Yes, it's long-standing behaviour, but it's confusing as heck, and we should not encourage it IMO.

Copy link
Member

@h-vetinari h-vetinari Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If people want a way to select the "official" compilers directly, then that's an OK solution for me. That way we could also do

clang_compiler:
  - clang     # [unix]
  - clang-cl  # [win]

to stay MSVC-compatible on windows by default. (and we might want to use clangxx on unix, so that it's similarly C++ capable, without having to resort to {{ compiler("clangxx") }})

Could you raise a PR to the pinning repo?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, is "you" me here? And if yes, then are we talking about just clang or more compilers?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had been addressing Isuru, who was in favour of enabling {{ compiler("gcc") }} and {{ compiler("clang") }}, and probably has opinions on whether we should default to clang or clang-cl on windows, and whether we should just use the C++ variant for both.

But if you, @mgorny, want to help unblock this, I suggest to open a PR to the pinning repo with the following

# enable `{{ compiler("gcc") }}` / `{{ compiler("clang") }}`; make them C++-capable by default
gcc_compiler:
  - gxx
clang_compiler:
  - clangxx   # [unix]
  # stay compatible with MSVC
  - clang-cl  # [win]

Hopefully @isuruf will have time to provide feedback in that PR directly

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've also applied the suggestions I've proposed above. I'll add compiler('clang') usage once/if the pinning PR is merged.

@jaimergp
Copy link
Member

jaimergp commented Oct 2, 2025

I'm very very happy with the results. I think most concerns were addressed, but I'll let this simmer a couple days more in case @isuruf or @h-vetinari have something else to say. Thanks for the awesome work, @mgorny!

Copy link
Member

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there was a misunderstanding about what I meant w.r.t. clang-cl.

Comment on lines 578 to 586
Alternatively, the specific compiler name can be used as an argument to
the `{{ compiler(...) }}` macro, e.g.:

```yaml
requirements:
build:
- {{ compiler('clang') }}
- {{ stdlib('c') }}
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, found my answer in #2596 (comment)

I cannot find the source of that statement in that thread. If you're basing this on my comment about clang vs. clang-cl, then I was talking about the values of c_compiler: in CBC, not the keys used in the compiler() macro.

TBH, I think {{ compiler('clang') }} is highly confusing and we should not be supporting it at all in official docs. It works by accident because of the way that {{ compiler("foo") }} will work if you set foo_compiler: in CBC and the package-name constructed with <value_of_foo_compiler>_{{ target_platform }} happens to be legit.

mgorny added a commit to mgorny/conda-forge-pinning-feedstock that referenced this pull request Oct 16, 2025
Add entries to enable explicit `compiler('clang')` and `compiler('gcc')`
macro usage.  As discussed in conda-forge/conda-forge.github.io#2596,
these currently work incidentally, but could be used as a convenient
method of forcing GCC or Clang for a particular package.

This involves a slight change in behavior — whereas previously
the implicit behavior would only activate a C compiler, it now
activates both C and C++ compilers.  Furthermore, `compiler('clang')`
defaults to using `clang-cl` on Windows, making the behavior more
consistent with the MSVC usage in the default compiler set.

There is currently one feedstock (conda-forge/python-poppler-feedstock)
that uses `compiler('clang')` and will need to be tested with
the change.  A quick search reveals no uses of `compiler('gcc')`.

Signed-off-by: Michał Górny <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants