KEMBAR78
Check host libstdc++ for brew `gcc` dependency by cho-m · Pull Request #20682 · Homebrew/brew · GitHub
Skip to content

Conversation

cho-m
Copy link
Member

@cho-m cho-m commented Sep 12, 2025

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

For most formulae, the bottles need a minimum libstdc++ rather than a minimum GCC version. This is particularly important when building on Ubuntu where the default compiler version is older than libstdc++.

So, checking the host libstdc++ version is a more accurate way to determine whether brew GCC is needed at runtime. This can be improved in the future to check symbol versions (e.g. GLIBCXX, CXXABI, GLIBC) which can allow some bottles to be installed even with older glibc/libstdc++.


This splits non-CI changes from #20609


Will add snippets of brew config on various Docker images below:

  • rockylinux:9 (no system gcc)
    OS: Rocky Linux 9.3 (Blue Onyx)
    Host glibc: 2.34
    Host libstdc++: 6.0.29
    /usr/bin/gcc: N/A
    
  • rockylinux:9 (with system gcc)
    OS: Rocky Linux 9.3 (Blue Onyx)
    Host glibc: 2.34
    Host libstdc++: 6.0.29
    /usr/bin/gcc: 11.5.0
    
  • ubuntu:16.04 (no system gcc)
    OS: Ubuntu 16.04.7 LTS
    Host glibc: 2.23
    Host libstdc++: 6.0.21
    /usr/bin/gcc: N/A
    
  • ubuntu:16.04 (with system gcc)
    OS: Ubuntu 16.04.7 LTS
    Host glibc: 2.23
    Host libstdc++: 6.0.21
    /usr/bin/gcc: 5.4.0
    

For most formulae, the bottles need a minimum libstdc++ rather than a
minimum GCC version. This is particularly important when building on
Ubuntu where the default compiler version is older than libstdc++.

So, checking the host libstdc++ version is a more accurate way to
determine whether brew GCC is needed at runtime. This can be improved in
the future to check symbol versions (e.g. GLIBCXX, CXXABI, GLIBC) which
can allow some bottles to be installed even with older glibc/libstdc++.
@cho-m cho-m mentioned this pull request Sep 12, 2025
7 tasks
@cho-m cho-m marked this pull request as ready for review September 12, 2025 18:36
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Looks good, thanks! Aim to ship this soon?

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Sep 12, 2025
@MikeMcQuaid
Copy link
Member

Misread that it's no longer draft, woohoo. Thanks @cho-m, shipping.

Merged via the queue into main with commit 47b7bf3 Sep 12, 2025
36 checks passed
@MikeMcQuaid MikeMcQuaid deleted the libstdcxx branch September 12, 2025 19:34
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