Skip to content

Use libstdc++ from system toolchain for AlmaLinux#8405

Closed
neildhar wants to merge 1 commit into
triton-lang:mainfrom
neildhar:downgrade-almalinux-libstdcxx
Closed

Use libstdc++ from system toolchain for AlmaLinux#8405
neildhar wants to merge 1 commit into
triton-lang:mainfrom
neildhar:downgrade-almalinux-libstdcxx

Conversation

@neildhar
Copy link
Copy Markdown
Collaborator

@neildhar neildhar commented Oct 8, 2025

The AlmaLinux build currently builds against libstdc++ from GCC 14,
because installing clang also pulls in GCC 14, and clang automatically
picks the newest libstdc++ on the system.

Instead, pointing clang to the system GCC installation should link
against the corresponding libstdc++. This improves the portability of
the generated binaries. The AlmaLinux binaries should now be compatible
with a superset of the systems that the Ubuntu binaries are compatible
with.

We can then separately evaluate removing the Ubuntu build if this works
for all users.
(I assume these have to be separate changes anyway for CI)

New contributor declaration

  • I am not making a trivial change, such as fixing a typo in a comment.

  • I have written a PR description following these
    rules.

  • I have run pre-commit run --from-ref origin/main --to-ref HEAD.

  • Select one of the following.

    • I have added tests.
      • /test for lit tests
      • /unittest for C++ tests
      • /python/test for end-to-end tests
    • This PR does not need a test because it is a CI change.
  • Select one of the following.

    • I have not added any lit tests.
    • The lit tests I have added follow these best practices,
      including the "tests should be minimal" section. (Usually running Python code
      and using the instructions it generates is not minimal.)

@neildhar neildhar force-pushed the downgrade-almalinux-libstdcxx branch from 60c6790 to 1bfc57e Compare October 8, 2025 16:58
@neildhar neildhar marked this pull request as ready for review October 8, 2025 17:14
@neildhar neildhar requested a review from ptillet as a code owner October 8, 2025 17:14
@neildhar neildhar force-pushed the downgrade-almalinux-libstdcxx branch 2 times, most recently from f1a3998 to e3d74fa Compare October 9, 2025 22:44
@neildhar neildhar mentioned this pull request Oct 13, 2025
7 tasks
@neildhar neildhar force-pushed the downgrade-almalinux-libstdcxx branch from e3d74fa to 01280a7 Compare October 31, 2025 15:33
@ThomasRaoux
Copy link
Copy Markdown
Collaborator

mixing clang and gcc used to have catastrophic problems as they have different lambda ABI.
There is a risk that changing the toolschain for one of the distribution would cause significant problems

@neildhar
Copy link
Copy Markdown
Collaborator Author

@ThomasRaoux The lambda ABI is a good point, I don't know how common it is to create such a dependency in practice. I had assumed the Triton build is already counting on gcc/clang ABI compatibility since we do not require TRITON_BUILD_WITH_CLANG_LLD when consuming the prebuilt binaries, so by default we would likely use GCC for building the rest of Triton on linux.

I can think of a few paths forward, but I'll defer to you on:

  1. Whether you believe this problem (of improving the binary compatibility of the distribution) is worth investing in solving
  2. Whether you're okay with the risk of temporarily disrupting developers who currently rely on the AlmaLinux LLVM distribution if something doesn't work

@ThomasRaoux
Copy link
Copy Markdown
Collaborator

@ThomasRaoux The lambda ABI is a good point, I don't know how common it is to create such a dependency in practice. I had assumed the Triton build is already counting on gcc/clang ABI compatibility since we do not require TRITON_BUILD_WITH_CLANG_LLD when consuming the prebuilt binaries, so by default we would likely use GCC for building the rest of Triton on linux.

Well we fixed some of those problems in LLVM in the past (by removing lambda from headers) but of course it could happen again, we don't really have any protection for that.

I can think of a few paths forward, but I'll defer to you on:

  1. Whether you believe this problem (of improving the binary compatibility of the distribution) is worth investing in solving

I don't

  1. Whether you're okay with the risk of temporarily disrupting developers who currently rely on the AlmaLinux LLVM distribution if something doesn't work

doesn't affect me directly as we don't use this build but it does feel like it could be a bad experience for some community members and overall increase the surface area where we'll get bugs. This is my main concern.

Is there no way to use a different clang to solve the libc problem?

@neildhar
Copy link
Copy Markdown
Collaborator Author

Is there no way to use a different clang to solve the libc problem?

The initial approach I had taken was to try and point clang to the older libstdc++. That didn't quite work but I don't remember why. That would be a more incremental and palatable solution, I will take another crack at it and see if I can get it to work without adding complexity.

@ThomasRaoux
Copy link
Copy Markdown
Collaborator

Is there no way to use a different clang to solve the libc problem?

The initial approach I had taken was to try and point clang to the older libstdc++. That didn't quite work but I don't remember why. That would be a more incremental and palatable solution, I will take another crack at it and see if I can get it to work without adding complexity.

Thanks, that would be much better if it can work.

@neildhar neildhar force-pushed the downgrade-almalinux-libstdcxx branch from 01280a7 to f9be81b Compare October 31, 2025 21:31
@neildhar neildhar changed the title Use system toolchain for AlmaLinux build Use libstdc++ from system toolchain for AlmaLinux Oct 31, 2025
@neildhar
Copy link
Copy Markdown
Collaborator Author

@ThomasRaoux It turned out to work quite straightforwardly (at least in a docker container locally). However, I recognise there are still potential risks (e.g. if LLVM headers depend on the STL version in some way). So I understand if you'd still prefer to keep things as is.

@neildhar
Copy link
Copy Markdown
Collaborator Author

neildhar commented Dec 8, 2025

@ThomasRaoux do you still have reservations about this change?

If so, I will close it.

The AlmaLinux build currently builds against libstdc++ from GCC 14,
because installing clang also pulls in GCC 14, and clang automatically
picks the newest libstdc++ on the system.

Instead, pointing clang to the system GCC installation should link
against the corresponding libstdc++. This improves the portability of
the generated binaries. The AlmaLinux binaries should now be compatible
with a superset of the systems that the Ubuntu binaries are compatible
with.

We can then separately evaluate removing the Ubuntu build if this works
for all users.
(I assume these have to be separate changes anyway for CI)
@neildhar neildhar force-pushed the downgrade-almalinux-libstdcxx branch from f9be81b to 2ae240c Compare December 8, 2025 21:06
@neildhar neildhar closed this Jan 22, 2026
@neildhar neildhar deleted the downgrade-almalinux-libstdcxx branch March 12, 2026 14:58
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.

2 participants