Skip to content

[Build] Fix llvm package to use correct glibc version checks#8391

Closed
HollowMan6 wants to merge 2 commits into
triton-lang:mainfrom
HollowMan6:llvm_builds
Closed

[Build] Fix llvm package to use correct glibc version checks#8391
HollowMan6 wants to merge 2 commits into
triton-lang:mainfrom
HollowMan6:llvm_builds

Conversation

@HollowMan6
Copy link
Copy Markdown

@HollowMan6 HollowMan6 commented Oct 7, 2025

Resolves #7088, #6747

Currently, we will get the following error when we try to build on a system with glic version 2.31:

: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by ./lld)
: /lib64/libc.so.6: version `GLIBC_2.32' not found (required by ./lld)
: /lib64/libc.so.6: version `GLIBC_2.33' not found (required by ./lld)

The reason is that llvm-f6ded0be-ubuntu-x64 requires at least glibc 2.34 now, but the glibc version checks still thinks the minimum glibc version it requires is 2.29. So this PR fixes glibc version checks according to binary inspection:

  • llvm-f6ded0be-ubuntu-x64 requires at least glibc 2.34
  • llvm-f6ded0be-almalinux-x64 requires at least glibc 2.27
  • llvm-f6ded0be-centos-x64 requires at least glibc 2.16

Also, we should fall back to user-configured LLVM from source build if all the glib version doesn't satisfy the needs here.

Command used to check glibc required version:
objdump -T ./bin/lld | grep GLIBC_ | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -Vu

llvm-f6ded0be-ubuntu-x64/bin> objdump -T ./lld  | grep GLIBC_ | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -Vu
2.2.5
2.3
2.3.4
2.6
2.14
2.15
2.16
2.27
2.29
2.32
2.33
2.34

llvm-f6ded0be-almalinux-x64/bin> objdump -T ./lld  | grep GLIBC_ | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -Vu
2.2.5
2.3
2.3.4
2.6
2.12
2.14
2.15
2.16
2.27

llvm-f6ded0be-centos-x64/bin> objdump -T ./lld  | grep GLIBC_ | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -Vu
2.2.5
2.3
2.3.4
2.4
2.6
2.12
2.14
2.15
2.16

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 This is a fix related to build.
  • 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.)

@HollowMan6 HollowMan6 requested a review from ptillet as a code owner October 7, 2025 20:07
Comment thread setup.py Outdated
@HollowMan6 HollowMan6 requested a review from Jokeren October 8, 2025 09:38
Comment thread setup.py
Comment thread cmake/llvm-vglibc/update.sh
@HollowMan6 HollowMan6 requested a review from Jokeren October 8, 2025 12:24
@HollowMan6
Copy link
Copy Markdown
Author

Updated the cmake/llvm-vglibc/update.sh script, it now only extracts bin/lld from the tarball to inspect glib version, so that both time and space for running the script are saved.

$ cmake/llvm-vglibc/update.sh 
LLVM revision: f6ded0be
Downloading and analyzing LLVM builds...
=========================================

Processing: ubuntu-x64
-------------------
Downloading from: https://oaitriton.blob.core.windows.net/public/llvm-builds/llvm-f6ded0be-ubuntu-x64.tar.gz
Download complete. Extracting bin/lld...
Extraction complete. Analyzing binary...
Checking binary: lld
Detected minimum GLIBC version: 2.34
Updated: triton/cmake/llvm-vglibc/ubuntu-x64.txt

Processing: almalinux-x64
-------------------
Downloading from: https://oaitriton.blob.core.windows.net/public/llvm-builds/llvm-f6ded0be-almalinux-x64.tar.gz
Download complete. Extracting bin/lld...
Extraction complete. Analyzing binary...
Checking binary: lld
Detected minimum GLIBC version: 2.27
Updated: triton/cmake/llvm-vglibc/almalinux-x64.txt

Processing: centos-x64
-------------------
Downloading from: https://oaitriton.blob.core.windows.net/public/llvm-builds/llvm-f6ded0be-centos-x64.tar.gz
Download complete. Extracting bin/lld...
Extraction complete. Analyzing binary...
Checking binary: lld
Detected minimum GLIBC version: 2.16
Updated: triton/cmake/llvm-vglibc/centos-x64.txt

=========================================
Update complete!

Current LLVM glibc version requirements:
  ubuntu-x64          : 2.34
  almalinux-x64       : 2.27
  centos-x64          : 2.16
Cleaning up temporary files...

@Jokeren
Copy link
Copy Markdown
Contributor

Jokeren commented Oct 8, 2025

Let me run the CI and see if anything wrong

@Jokeren
Copy link
Copy Markdown
Contributor

Jokeren commented Oct 8, 2025

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment thread setup.py
@ThomasRaoux
Copy link
Copy Markdown
Collaborator

can't we know the glibc version based on the linux distribution version? We could add that to the package name.
I'm concerned about auto detecting the glibc and doing llvm local build based on build machine libc as it may not be the right thing to do when cross compiling

@neildhar
Copy link
Copy Markdown
Collaborator

neildhar commented Oct 8, 2025

I've given some thought to this problem, so I'll share my thoughts here. (but feel free to disregard them)

To summarise the builds:

  1. The Ubuntu build uses a relatively new libc, and libstdc++ from GCC 12
  2. The AlmaLinux build uses a relatively old libc, but libstdc++ from GCC 14 (ignoring the quirks of the mixed static/dynamic libstdc++ on AlmaLinux/CentOS/RHEL)
  3. The CentOS build uses an old libc, and old libstdc++, but uses the pre-C++ 11 std::string ABI. (I believe it should just be deleted because this is very uncommon now Remove CentOS 7 build #8191)

Both libc and libstdc++ on the system need to be newer in order to build. But it's slightly awkward because the Ubuntu build has a new libc and an old libstdc++, while the AlmaLinux build has the opposite.

My thinking on a solution would be to downgrade the libstdc++ used for the AlmaLinux build (which is a simple change #8405), so it is compatible with a superset of the systems that the Ubuntu build is compatible with. And then make the AlmaLinux LLVM binaries the only version Triton distributes. Those binaries should work on almost every system, eliminating the need for checks.

@HollowMan6
Copy link
Copy Markdown
Author

can't we know the glibc version based on the linux distribution version?

I don't think we already have such of list available somewhere, and maintaining it can also be time-consuming, as the list won't be exhaustive and can be outdated after a while at any time.

I'm concerned about auto detecting the glibc and doing llvm local build based on build machine libc as it may not be the right thing to do when cross compiling

I think the original code already has support for setting TRITON_LLVM_SYSTEM_SUFFIX env var, which will skip the auto detecting glibc logic and should be suitable for such kind of use case.

My thinking on a solution would be to downgrade the libstdc++ used for the AlmaLinux build, so it is compatible with a superset of the systems that the Ubuntu build is compatible with. And then make the AlmaLinux LLVM binaries the only version Triton distributes. Those binaries should work on almost every system, eliminating the need for checks.

That could be another solution, but it will introduce breaking (building environments) changes for Linux distributions that use newer glibc versions, so I guess we will need to be careful if we decide to go this way, so that nothing is broken.

I'm using SUSE Linux Enterprise Server 15 SP5, and AlmaLinux LLVM binaries work for me.

@neildhar
Copy link
Copy Markdown
Collaborator

neildhar commented Oct 8, 2025

it will introduce breaking (building environments) changes for Linux distributions that use newer glibc versions

Both glibc and libstdc++ maintain backward ABI compatibility. We already rely on that since we don't enforce exact matches, so it makes sense to me to target the oldest possible version of both. Fortunately LLVM coding standards require maintaining compatibility with even older compilers than we are considering here.

Are you referring to something else?

@HollowMan6
Copy link
Copy Markdown
Author

I just addressed the previously identified issue.

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@HollowMan6
Copy link
Copy Markdown
Author

HollowMan6 commented Oct 8, 2025

It makes sense to me to target the oldest possible version of both. Fortunately LLVM coding standards require maintaining compatibility with even older compilers than we are considering here.

I'm not sure about that for 100%, also if similar things, just like you mentioned in #8191, happen for AlmaLinux in the future, we will still need to revert back to using Ubuntu builds. (The CentOS-based LLVM build doesn't work on my side with SUSE Linux Enterprise Server 15 SP5). So it might still be a good idea to also have the option to base the builds on something new so that we have some kind of backup. But anyway, this is up to the maintainer's decision, and I'm OK with any possible solution.

@HollowMan6
Copy link
Copy Markdown
Author

Conflict is now resolved after merged #8191

cc: @Jokeren

Currently, we will get the following error when we try to build on a system with glic version 2.31:

```log
: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by ./lld)
: /lib64/libc.so.6: version `GLIBC_2.32' not found (required by ./lld)
: /lib64/libc.so.6: version `GLIBC_2.33' not found (required by ./lld)
```

The reason is that llvm-f6ded0be-ubuntu-x64 requires at least glibc 2.34 now, but the glibc version checks still think the minimum glibc version it requires is 2.29. So this PR updates by using a flexible way to set version numbers and fixes glibc version checks according to binary inspection:
- llvm-f6ded0be-ubuntu-x64 requires at least glibc 2.34
- llvm-f6ded0be-almalinux-x64 requires at least glibc 2.27
- llvm-f6ded0be-centos-x64 requires at least glibc 2.16

Also, we should fall back to user-configured LLVM from source build if all the glib versions don't satisfy the needs here.

Command used to check the glibc required version:
`objdump -T ./bin/lld  | grep GLIBC_ | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -Vu`

```logs
llvm-f6ded0be-ubuntu-x64/bin> objdump -T ./lld  | grep GLIBC_ | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -Vu
2.2.5
2.3
2.3.4
2.6
2.14
2.15
2.16
2.27
2.29
2.32
2.33
2.34

llvm-f6ded0be-almalinux-x64/bin> objdump -T ./lld  | grep GLIBC_ | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -Vu
2.2.5
2.3
2.3.4
2.6
2.12
2.14
2.15
2.16
2.27

llvm-f6ded0be-centos-x64/bin> objdump -T ./lld  | grep GLIBC_ | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -Vu
2.2.5
2.3
2.3.4
2.4
2.6
2.12
2.14
2.15
2.16
```

Signed-off-by: Hollow Man <hollowman@opensuse.org>
@HollowMan6
Copy link
Copy Markdown
Author

ping @Jokeren

Copilot AI review requested due to automatic review settings January 7, 2026 01:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes glibc version checking logic for LLVM package selection to resolve build failures on systems with glibc < 2.34. The fix ensures that the correct pre-compiled LLVM package variant is selected based on the system's actual glibc version.

Key changes:

  • Updated glibc version requirements for LLVM packages based on binary inspection (ubuntu-x64 requires 2.34, almalinux-x64 requires 2.27)
  • Introduced a dynamic configuration system that reads glibc requirements from text files instead of hardcoded values
  • Added a bash script to automatically update glibc version requirements when new LLVM builds are available

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
setup.py Replaces hardcoded glibc version checks with dynamic config file reading; updates x64 Linux package selection logic to iterate through available configs and select the most appropriate LLVM build
cmake/llvm-vglibc/update.sh Adds automation script to download LLVM pre-compiled builds, inspect binaries for glibc dependencies, and generate version requirement files
cmake/llvm-vglibc/ubuntu-x64.txt Specifies minimum glibc version 2.34 for ubuntu-x64 LLVM builds
cmake/llvm-vglibc/almalinux-x64.txt Specifies minimum glibc version 2.27 for almalinux-x64 LLVM builds

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread setup.py
Comment thread setup.py
@HollowMan6 HollowMan6 closed this by deleting the head repository Jan 23, 2026
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.

unable to build triton

5 participants