homebrew-core: brew install gcc: postinstall broken (gcc-13)

brew gist-logs <formula> link OR brew config AND brew doctor output

$ brew config
HOMEBREW_VERSION: 4.1.2
ORIGIN: https://github.com/Homebrew/brew
HEAD: 3db1acf3e38e270af4e1c3f214622bbfb18f830e
Last commit: 2 days ago
Core tap JSON: 29 Jul 14:51 UTC
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: /usr/bin/env vim
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_LOGS: /home/linuxbrew/.logs/Homebrew
HOMEBREW_MAKE_JOBS: 48
HOMEBREW_TEMP: /home/linuxbrew/.temp
Homebrew Ruby: 2.6.10 => /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.10_1/bin/ruby
CPU: 48-core 64-bit broadwell
Clang: N/A
Git: 2.39.3 => /bin/git
Curl: 7.61.1 => /bin/curl
Kernel: Linux 4.18.0-477.15.1.el8_8.x86_64 x86_64 GNU/Linux
OS: Red Hat Enterprise Linux release 8.8 (Ootpa) (Ootpa)
Host glibc: 2.28
/usr/bin/gcc: 8.5.0
/usr/bin/ruby: N/A
glibc: N/A
gcc@11: N/A
gcc: N/A
xorg: N/A
$ brew dr
Your system is ready to brew.


### Verification

- [X] My "`brew doctor` output" says `Your system is ready to brew.` and am still able to reproduce my issue.
- [X] I ran `brew update` and am still able to reproduce my issue.
- [X] I have resolved all warnings from `brew doctor` and that did not fix my problem.
- [X] I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.

### What were you trying to do (and why)?

```$ brew install gcc``` because that is suggested by the output after installing homebrew (linuxbrew).

### What happened (include all command output)?

$ brew postinstall --debug gcc /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading gcc from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading glibc from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading linux-headers@5.15 from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading gcc from API /usr/bin/env /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/shared/git --version /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading gmp from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading m4 from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading isl from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading libmpc from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading mpfr from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading zstd from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading lz4 from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading xz from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading cmake from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading openssl@3 from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading ca-certificates from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading ncurses from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading pkg-config from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading gpatch from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading zlib from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading binutils from API /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaAPILoader): loading bison from API ==> Postinstalling gcc /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FromPathLoader): loading /home/linuxbrew/.linuxbrew/opt/gcc/.brew/gcc.rb Warning: The post-install step did not complete successfully You can try again using: brew postinstall gcc ==> An exception occurred within a child process: ErrorDuringExecution: Failure while executing; /home/linuxbrew/.linuxbrew/Cellar/gcc/13.1.0/bin/gcc-13 -print-libgcc-file-name was terminated by uncaught signal SEGV. Here’s the output:

/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/utils/popen.rb:12:in popen_read' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/utils/popen.rb:16:in safe_popen_read’ /home/linuxbrew/.linuxbrew/opt/gcc/.brew/gcc.rb:151:in post_install' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:1255:in block (2 levels) in run_post_install’ /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:1055:in with_logging' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:1254:in block in run_post_install’ /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/kernel.rb:499:in with_env' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:1250:in run_post_install’ /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/postinstall.rb:24:in `<main>’


### What did you expect to happen?

clean installation of gcc

### Step-by-step reproduction instructions (by running `brew` commands)

```shell
$ brew install gcc```

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 47 (23 by maintainers)

Most upvoted comments

I wasn’t sure, so I checked and it is indeed RHEL 9.2. I haven’t done too much testing on it, but the install of gcc at least worked

@cloudvii27, thanks so much for that information. That’s good news; however, now I have to convince our IT to upgrade to RHEL 9.

@cloudvii27, I have mostly given up on using Linuxbrew in RHEL8. I’ll keep using Homebrew on my Macs, of course, on which the Framework works very well. I don’t expect the maintainers of Linuxbrew, to whom I already owe a lot of respect for what they do, to put in a whole lot of effort into this as seemingly those of us who want to use Linuxbrew in RHEL8 are surely a minority, a small minority.

I’m currently exploring other options for RHEL8 such as the Nix package manager; however, that appears to be quite some effort for what I need. I think the best bet for the use cases at my company, is to use a Conda env. We already use Conda envs for our production bioinformatics pipelines. We do switch into Conda using pyenv which is currently now installed via Linuxbrew. I’ll probably install pyenv or possibly just Conda without using a package manager.

If I do get some sort of idea about the problem popping into my head, and I somehow stumble upon a fix, I’ll post a comment here about the solution.

Which is weird since my system glibc is 2.17 and homebrew’s version is 2.35, so I don’t know where log2@GLIBC_2.29 is coming from.

@lewis6991 Looking at the output, I am assuming you are building from source due to using non-default prefix. You will know if you run brew doctor(and brew config output would be useful too). If that’s the case, the error probably means compiling that formula from source wanted to use a glibc that you do not have, but it should work fine at runtime regardless since Homebrew requires glibc >= 2.13. Btw, do you get an error when using gcc too? I am curious if the error is related

Regardless, my advice, as a workaround, is to use the same prefix on an Ubuntu machine (virtualized or bare metal) then rsync -au the Homebrew directory over to your current machine (or your favorite sync method). So far this workaround has been working fine for me on Rocky Linux 8.8 (and earlier this year with CentOS 7)

@osalbahr,

glibc v2.28 should be fine. brew dr does not complain about it.

You’re right, v2.28 is higher than Homebrew’s requirement. Though to rule it out, I’d try to link binutils and see if that fixes it. I don’t know if brew doctor checks the glibc version to begin with.

Update: After reading thoroughly through #135068 to which you link above, maybe you’re onto something. glibc was installed to my linuxbrew, glibc@2.35_1; however, as can be seen in my brew config output above it’s reported as N/A. I’ll tinker with some things this weekend. Thanks.

I’m not sure what the N/A means. That might just be a minor bug in brew config itself and if so then the config output is not related. Having old glibc is an edge case that is best-effort maintained by Homebrew afaik.

All I know is that:

  1. brew postinstall gcc fails in systems where glibc is “too old” (I don’t know the specific version where the gcc postinstall fails)
  2. The old host glibc can be worked around by linking binutils (since it’s keg only)

Does anyone know if this is due to the known patchelf issue or is this something else? I had assumed that the patchelf issue had been fixed.

To the best of my knowledge, yes the patchelf issue was fixed, but not 100% sure. Though I’d assume the error message due to the patchelf issue was different than the error that happens when the host glibc is old.