-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[linuxbrew] gcc-13 doesn't work on an Ubuntu distribution which targets glibc 2.31 #135068
Comments
Try doing
Though, |
Yes. Otherwise gcc itself would not load |
That's not consistent with your
Could you update the output of |
I got the output when I was submitting the issue. homebrew glibc was installed, but was not detected by brew doctor. I dont know why |
Noting
homebrew curl should have been installed as a dependency of homebrew git, but was not detected by brew doctor too |
Try doing
We could probably stop making Also: Please don't use screenshots when sharing the output of commands in your terminal. They're often difficult to read and impossible to reuse (e.g. when looking up error messages). Instead, copy the text here and wrap them in three back-ticks (```) on the line before and on the line after to format them properly. |
I did use three back-ticks, but you didnt trust my post |
Were you able to reproduce this on another Ubuntu system? Idk if it matters but what’s your |
I don't have other Ubuntu systems
|
What version of Ubuntu are you running? I have access to VM’s of multiple Ubuntu versions: And I doubt it’s related, but Linux 5.4.18 was released in Feb 2020 so I would recommend upgrading and rebooting, sometimes that fixes random things. |
It's Ubuntu Kylin, an Chinese redistribution of Ubuntu. The error was:
It relates to the version of glibc, but not Ubuntu or kernel or something. It may happen on other systems which use old glibc (older than 2.35) |
Could you paste the output of |
Let me explain it again:
Notablely |
It's Kylin V10 SP1 as printed by |
@carlocab FYI,
Oh, sorry I must've missed that it solved the issue (since you didn't mark it as an answer). This seems odd to me, not sure why you had to run this command. Especially when |
Same issue here, on standard Ubuntu 20.04 server
The compile test:
|
@jnooree what’s your |
"ready to brew". |
Does running the command in Homebrew on Linux - Requirements help? |
If you mean |
Yes that’s the command I mean. Though I doubt it’s related. I suggested it because it’s one of the first few things I do when debugging an error I get with Homebrew. Sometimes running the commands in that page fixes things for me. If they’re already installed and up to date, then running the command doesn’t hurt anyways. |
I ran it but still got the same result. |
If it helps, I just tried in a dracula@ubuntu-22-04:~$ cat test.c
#include <stdio.h>
int main()
{
puts( "Hello, gcc-13!" );
}
dracula@ubuntu-22-04:~$ gcc-13 test.c
dracula@ubuntu-22-04:~$ ./a.out
Hello, gcc-13! dracula@ubuntu-22-04:~$ brew doctor
Your system is ready to brew. dracula@ubuntu-22-04:~$ brew config
HOMEBREW_VERSION: 4.0.28
ORIGIN: https://github.com/Homebrew/brew
HEAD: 2b4cfb033757b63ab0b128d01c58db76480956f9
Last commit: 7 days ago
Core tap JSON: 13 Jul 03:47 UTC
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: :0
HOMEBREW_EDITOR: /usr/bin/nano
HOMEBREW_MAKE_JOBS: 4
Homebrew Ruby: 2.6.10 => /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.10_1/bin/ruby
CPU: quad-core 64-bit skylake
Clang: N/A
Git: 2.34.1 => /bin/git
Curl: 7.81.0 => /bin/curl
Kernel: Linux 6.3.11-200.fc38.x86_64 x86_64 GNU/Linux
OS: Unknown
Host glibc: 2.35
/usr/bin/gcc: 11.3.0
/usr/bin/ruby: N/A
glibc: N/A
gcc@11: N/A
gcc: N/A
xorg: N/A Are you by any chance able to upgrade the Regardless, this behavior is not ideal since the requirement is "Glibc 2.13 or newer" but I don't know if this error is something that Homebrew can control. Looking at gcc.rb it's not immediately clear how the linked Maybe it just depends on the $ HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall -s gcc |
I'm using Ubuntu 20.04, not 22.04, and 20.04 ships with glibc 2.31 (as with the OP's). I'm not sure if it is a good idea to upgrade a system glibc to an unsupported version. |
Ok, I was able to reproduce this error in a VM and osalbahr@vclvm177-128:~$ sudo apt-get install build-essential procps curl file git
Reading package lists... Done
Building dependency tree
Reading state information... Done
file is already the newest version (1:5.38-4).
build-essential is already the newest version (12.8ubuntu1.1).
curl is already the newest version (7.68.0-1ubuntu2.18).
git is already the newest version (1:2.25.1-1ubuntu3.11).
procps is already the newest version (2:3.3.16-1ubuntu2.3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
osalbahr@vclvm177-128:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
osalbahr@vclvm177-128:~$ brew doctor
Your system is ready to brew.
osalbahr@vclvm177-128:~$ file test.c
test.c: empty
osalbahr@vclvm177-128:~$ gcc-13 test.c
/usr/bin/ld: /home/linuxbrew/.linuxbrew/Cellar/gcc/13.1.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/13/liblto_plugin.so: error loading plugin: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /home/linuxbrew/.linuxbrew/Cellar/gcc/13.1.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/13/liblto_plugin.so)
collect2: error: ld returned 1 exit status
osalbahr@vclvm177-128:~$ brew config
HOMEBREW_VERSION: 4.0.28
ORIGIN: https://github.com/Homebrew/brew
HEAD: 2b4cfb033757b63ab0b128d01c58db76480956f9
Last commit: 7 days ago
Core tap JSON: 13 Jul 04:07 UTC
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 4
Homebrew Ruby: 2.6.10 => /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.10_1/bin/ruby
CPU: quad-core 64-bit skylake
Clang: N/A
Git: 2.25.1 => /usr/bin/git
Curl: 7.68.0 => /usr/bin/curl
Kernel: Linux 5.4.0-99-generic x86_64 GNU/Linux
OS: Ubuntu 20.04.6 LTS (focal)
Host glibc: 2.31
/usr/bin/gcc: 9.4.0
/usr/bin/ruby: 2.7.0
glibc: N/A
gcc@11: N/A
gcc: N/A
xorg: N/A FYI, ==> ../configure --prefix=/home/linuxbrew/.linuxbrew/opt/gcc --libdir=/home/linuxbrew/.linuxbrew/opt/gcc/lib/gcc/current --disable-nls --enable-checking=release --with-gcc-major-version-only --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-13 --with-gmp=/home/linuxbrew/.linuxbrew/opt/gmp --with-mpfr=/home/linuxbrew/.linuxbrew/opt/mpfr --with-mpc=/home/linuxbrew/.linuxbrew/opt/libmpc --with-isl=/home/linuxbrew/.linuxbrew/opt/isl --with-zstd=/home/linuxbrew/.linuxbrew/opt/zstd --with-pkgversion=Homebrew GCC 13.1.0 --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --with-system-zlib --with-boot-l
==> make
Last 15 lines from /home/osalbahr/.cache/Homebrew/Logs/gcc/02.make:
../../gcc/ggc-common.cc:1286:7: note: in expansion of macro ‘SIZE_AMOUNT’
1286 | SIZE_AMOUNT (MALLINFO_FN ().arena));
| ^~~~~~~~~~~
../../gcc/ggc-common.cc:1286:20: note: in expansion of macro ‘MALLINFO_FN’
1286 | SIZE_AMOUNT (MALLINFO_FN ().arena));
| ^~~~~~~~~~~
make[3]: *** [Makefile:1162: ggc-common.o] Error 1
make[3]: *** Waiting for unfinished jobs....
rm gcc.pod
make[3]: Leaving directory '/tmp/gcc-20230713-2622-1k2rcl5/gcc-13.1.0/build/gcc'
make[2]: *** [Makefile:4983: all-stage1-gcc] Error 2
make[2]: Leaving directory '/tmp/gcc-20230713-2622-1k2rcl5/gcc-13.1.0/build'
make[1]: *** [Makefile:25987: stage1-bubble] Error 2
make[1]: Leaving directory '/tmp/gcc-20230713-2622-1k2rcl5/gcc-13.1.0/build'
make: *** [Makefile:1083: all] Error 2 |
To the best of my knowledge, choosing to install from source is a single contained action that does not affect future usage. Otherwise, any contributor would render their linuxbrew unusable even for just testing a version bump.
I just tried it, and it only tried to reinstall If anything, it might break things that depend on the |
Ok, I'll give it a try for a workaround... But this is something should be resolved by the upstream, IMHO. |
Me too. It doesn't build. |
If you want an alternative to Homebrew that does not need a high |
(Un?)suprisingly, homebrew clang does not have the same problem:
|
Thanks for suggestion, I'll take a look for it. |
That's.... interesting. Does this satisfy your use case? |
I actually don't use homebrew gcc for my dev workflow, so it doesn't matter for me. I spotted a problem, and just wanted to fix it anyways. |
Same tbh, I'm fine with the system's |
Oh. Good catch. FWIW, after using an dracula@ubuntu-20-04:~$ brew doctor
Your system is ready to brew.
dracula@ubuntu-20-04:~$ gcc-13 test.c
/usr/bin/ld: /home/linuxbrew/.linuxbrew/Cellar/gcc/13.1.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/13/liblto_plugin.so: error loading plugin: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /home/linuxbrew/.linuxbrew/Cellar/gcc/13.1.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/13/liblto_plugin.so)
collect2: error: ld returned 1 exit status
dracula@ubuntu-20-04:~$ brew config
HOMEBREW_VERSION: 4.0.28
ORIGIN: https://github.com/Homebrew/brew
HEAD: 2b4cfb033757b63ab0b128d01c58db76480956f9
Last commit: 7 days ago
Core tap JSON: 13 Jul 05:18 UTC
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: :0
HOMEBREW_EDITOR: /usr/bin/nano
HOMEBREW_MAKE_JOBS: 4
Homebrew Ruby: 2.6.10 => /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.10_1/bin/ruby
CPU: quad-core 64-bit skylake
Clang: N/A
Git: 2.25.1 => /bin/git
Curl: 7.68.0 => /bin/curl
Kernel: Linux 6.3.11-200.fc38.x86_64 x86_64 GNU/Linux
OS: Unknown
Host glibc: 2.31
/usr/bin/gcc: 9.4.0
/usr/bin/ruby: N/A
glibc: N/A
gcc@11: N/A
gcc: N/A
xorg: N/A
The error message is about missing a |
Also, in case someone wants another workaround that doesn't require installing from souce, it looks like the Container: dracula@ubuntu-20-04:~$ nix-shell -p gcc
[nix-shell:~]$ gcc test.c
[nix-shell:~]$ ./a.out
Hello, gcc! (nix)
[nix-shell:~]$ gcc --version
gcc (GCC) 12.3.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Also worked in the VM: osalbahr@vclvm177-128:~$ nix-shell -p gcc
[nix-shell:~]$ gcc test.c
[nix-shell:~]$ ./a.out
Hello again, gcc! (nix) But again, this is just a workaround. Ideally, "Glibc 2.13 or newer" should be enough for dracula@ubuntu-20-04:~$ nix-shell -p gcc13
[nix-shell:~]$ which -a gcc
/nix/store/rzhpy402dbc2kpk3xz87csnm0xiaw53b-gcc-wrapper-12.3.0/bin/gcc
/nix/store/6vwsydq4nzr1l8j7fyg5r61nknwq6w60-gcc-12.3.0/bin/gcc
/nix/store/iy7sgfhgdawp2privg2smaj911gx3mjd-gcc-wrapper-13.1.0/bin/gcc
/nix/store/1v2kvv6qya4ya7vd76qwfc3pj85bq182-gcc-13.1.0/bin/gcc
/usr/bin/gcc
/bin/gcc
[nix-shell:~]$ /nix/store/iy7sgfhgdawp2privg2smaj911gx3mjd-gcc-wrapper-13.1.0/bin/gcc test.c
[nix-shell:~]$ ./a.out
Hello, gcc! (nix)
[nix-shell:~]$ ldd a.out
linux-vdso.so.1 (0x00007ffee95f2000)
libc.so.6 => /nix/store/3n58xw4373jp0ljirf06d8077j15pc4j-glibc-2.37-8/lib/libc.so.6 (0x00007f0d1c79f000)
/nix/store/3n58xw4373jp0ljirf06d8077j15pc4j-glibc-2.37-8/lib/ld-linux-x86-64.so.2 => /nix/store/3n58xw4373jp0ljirf06d8077j15pc4j-glibc-2.37-8/lib64/ld-linux-x86-64.so.2 (0x00007f0d1c987000) |
This issue will be fixed by not making binutils key-only. That's all. |
Oh…. True, that’s much simpler. Though I don’t know if there are any notable drawbacks for having binutils not be keg-only for everyone. I’m assuming it became a keg because it could break the system. For example |
+1. I also don't think shadowing the host toolchain is a good idea. |
another workaround: disable lto. This may cause problems with the size and performance of the program, but it does pass compilation in my case. g++-13 -fno-lto a.cpp update: I copy a liblto_plugin.so from my system gcc-10 dir to homebrew gcc-13 dir. and pass the compile without -fno-lto. |
Interesting. I worry the directory might get overwritten in the next upgrade, though. You can perhaps simulate that via Not sure if it is a viable fix for Homebrew to already include that file, the inner workings of |
I am suprised that it can be considerred a solution. Anyway, I am closing this issue, as it's going off topic for me. |
brew gist-logs <formula>
link ORbrew config
ANDbrew doctor
outputVerification
brew doctor
output" saysYour system is ready to brew.
and am still able to reproduce my issue.brew update
and am still able to reproduce my issue.brew doctor
and that did not fix my problem.What were you trying to do (and why)?
What happened (include all command output)?
What did you expect to happen?
Print some link errors like
_main
is not foundStep-by-step reproduction instructions (by running
brew
commands)$ brew install gcc $ # follow instructions above
Comments
I assume that it was because homebrew
binutils
is key-only, so that homebrewgcc-13
cound not find/home/linuxbrew/.linuxbrew/bin/ld
and failed back to system/usr/bin/ld
. However/usr/bin/ld
somehow loaded homebrew gcc's lto plugin (may because I was running homebrew gcc), so that everything was massed up.The text was updated successfully, but these errors were encountered: