Fedora packages clang-format, an automatic C/C++ code reformatting tool used by various FOSS projects, including the kernel and Mesa. Some project's CI systems enforce developer use of clang-format to produce a consistent style across the code base. However, clang-format's output is not stable from version to version, as upstream clang-format tweaks affect the results. Projects therefore pin a single "blessed" version of clang-format that all contributors use. Other distributions like Debian package simultaneously multiple versions of LLVM (and hence multiple version suffixed clang-formats), so contributors can install whatever the agreed upon version is without needing the whole team to use the same distro. Unfortunately, Fedora only packages a single latest clang version... and as soon as the Fedora LLVM is newer than what the project was using, boom! formatting changes randomly and the developer can no longer contribute. Therefore, this is a request to package older clang-formats even on newer Fedoras. For my own use case, I need clang-format-16 on F39 (soon F40), since that's the version FEX-Emu pins. But F39 only has clang-format-17, which is incompatible. Is it reasonable to include the older binaries in the newer Fedoras? If not, what is a reasonable workaround (that doesn't require switching from Fedora to another distro)? Reproducible: Always
> Therefore, this is a request to package older clang-formats even on newer Fedoras. Notice this is already available on Fedora 40, where clang17-tools-extra provides /usr/bin/clang-format-17 and clang-tools-extra provides /usr/bin/clang-format from LLVM 18.1. > For my own use case, I need clang-format-16 on F39 (soon F40), since that's the version FEX-Emu pins. But F39 only has clang-format-17, which is incompatible. Could you provide more information on how this version is pinned, please? e.g. are you trying to install an RPM that requires on clang-format-16?
> Notice this is already available on Fedora 40, where clang17-tools-extra provides /usr/bin/clang-format-17 and clang-tools-extra provides /usr/bin/clang-format from LLVM 18.1. Great to know, thanks! > Could you provide more information on how this version is pinned, please? e.g. are you trying to install an RPM that requires on clang-format-16? Due to the unstable nature of clang-format output, an upstream project has to pin a particular version that all its developers use. The RPM doesn't involve clang-format in any way, this is just for upstream devs. I think projects pick the latest version they can get away with (say, packaged in a suitably old version of Debian), and then stay there as long as they can get away with. It looks like Mesa uses LLVM 15 and FEX uses LLVM 16. Bumping the version requires a flag day "reformat everything" commit which isn't too pleasant, so even if the whole team uses the latest Fedora, it would be inconvenient to have to track upstream LLVM. Tangential observation, but clang-format output seems to be much more stable for C code (like Mesa) than C++ code (like FEX). I guess that shouldn't be too surprising. --- In context of clang-format adoption for a third project, I saw someone suggest pulling binaries from https://github.com/llvm/llvm-project/releases/tag/llvmorg-16.0.4 and skipping the package management. This works as a stopgap but having packaged 'properly' would certainly be nicer! Especially since those bins are 800 MB compressed shipping the entire LLVM toolchain (-: --- Maybe enforcing clang-format use in CI wasn't such a great idea after all...
(In reply to Tulio Magno Quites Machado Filho from comment #1) > > Therefore, this is a request to package older clang-formats even on newer Fedoras. > > Notice this is already available on Fedora 40, where clang17-tools-extra > provides /usr/bin/clang-format-17 and clang-tools-extra provides > /usr/bin/clang-format from LLVM 18.1. > Tulio, would you accept a PR that rework the clang16 packaging to be more like clang17 (and thus clang16-tools-extra is shipped? I also have colleagues who need clang16 binaries that are currently unshipped (In reply to Alyssa Rosenzweig from comment #2) > Maybe enforcing clang-format use in CI wasn't such a great idea after all... Having dealth with this on Python projects, yeah, formatting and linting checks are ... very flaky
(In reply to Michel Lind from comment #3) > Tulio, would you accept a PR that rework the clang16 packaging to be more > like clang17 (and thus clang16-tools-extra is shipped? I believe I can do this. Thanks! Let me start changing llvm16 first. > I also have colleagues who need clang16 binaries that are currently unshipped Interesting. Michel, could you share which projects are depending on clang16 binaries, please? Alyssa and Michel, if we distribute the new clang16 binaries on Fedora 40, would it work for you? Or do you really need it in older versions? I'd like to avoid changing stable versions.
I proposed 2 PRs that implement this: https://src.fedoraproject.org/rpms/llvm16/pull-request/2 https://src.fedoraproject.org/rpms/clang16/pull-request/2 Builds are available in the following copr: https://copr.fedorainfracloud.org/coprs/tuliom/clang16-tools/ Feedback is welcome.
FEDORA-2024-9b524890ce (clang16-16.0.6-7.fc41 and llvm16-16.0.6-9.fc41) has been submitted as an update to Fedora 41. https://bodhi.fedoraproject.org/updates/FEDORA-2024-9b524890ce
FEDORA-2024-9b524890ce (clang16-16.0.6-7.fc41 and llvm16-16.0.6-9.fc41) has been pushed to the Fedora 41 stable repository. If problem still persists, please make note of it in this bug report.