Score:3

Problem with gcc installation from Homebrew

gq flag

I have a problem with my gcc installation from Homebrew.

homebrew install gcc produces

Warning: The post-install step did not complete successfully
You can try again using:
  brew postinstall gcc

brew postinstall gcc produces

==> Postinstalling gcc
Warning: The post-install step did not complete successfully
You can try again using:
  brew postinstall gcc

gcc --version seems to have gcc version 11.3:

gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0

gcc-12 --version gives this error:

-bash: /home/linuxbrew/.linuxbrew/bin/gcc-12: Bad address

Because of this, many packages that are depended on gcc cannot run properly. Also, tried to install packages in R also fail. I tried reinstalling through homebrew with no success. Similarly, running sudo apt-get install --reinstall gcc did not solve the problem.

Of note, I am running Ubuntu under WSL:

WSL version: 1.0.3.0
Kernel version: 5.15.79.1
WSLg version: 1.0.47
MSRDC version: 1.2.3575
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19044.2364

Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy

echo $PATH

/home/linuxbrew/.linuxbrew/opt/dpkg/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/home/osekulovic/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files (x86)/DNASTAR/Lasergene 17/SeqNinjaCL:/mnt/c/Program Files (x86)/DNASTAR/Lasergene 17/ArrayStar:/mnt/c/Program Files (x86)/DNASTAR/Lasergene 17:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files (x86)/Pandoc/:/mnt/c/Users/sekulo/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/sekulo/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin

Running which gcc produces

/usr/bin/gcc

Running which gcc-12 produces

/home/linuxbrew/.linuxbrew/bin/gcc-12

Any help is greatly appreciated. TP

ThePresident avatar
gq flag
Updated with Ubuntu and WSL versions.
cc flag
Please include the output of "echo $PATH" in your original posting. Also the output of "which gcc" gcc version 11.3 is the system default for gcc, and you should not change it (because many packages expect that version). The gcc your user linuxbrew may override the system default by a PATH change.
ThePresident avatar
gq flag
Updated. You're right, I ran 'brew upgrade' and gcc got updated to gcc-12 among other things. If I uninstall gcc from homebrew, many packages do not work even if the system has gcc-11 and gcc-12 installed properly.
cc flag
For the user linuxbrew, you may override the system gcc by putting a symbolic link in the user's bin directory (make it if not there). cd ~/bin ; ln -s /home/linuxbrew/.linuxbrew/bin/gcc-12 gcc Then which gcc for that user only should get the 12 version.
ThePresident avatar
gq flag
cd /usr/bin/ then ln -s /home/linuxbrew/.linuxbrew/bin/gcc-12 gcc produces the following: ln: failed to create symbolic link 'gcc': File exists
cc flag
Wrong location for cd. ~/bin is really /home/linuxbrew/bin, not /usr/bin. mkdir bin in your home if it does not exist.
ThePresident avatar
gq flag
Successfully done; ```which gcc``` produces ```usr/bin/gcc```, ```which gcc-12``` produces ```/home/linuxbrew/.linuxbrew/bin/gcc-12```; running ```gcc-12 --version``` has the same error: ```-bash: /home/linuxbrew/.linuxbrew/bin/gcc-12: Bad address```
Score:0
fr flag

I suspect the issue may be that you're missing some of the Homebrew requirements as documented under Homebrew on Linux - Requirements:

Requirements

Linux 3.2 or newer
Glibc 2.13 or newer
64-bit x86_64 CPU

To install build tools, paste at a terminal prompt:

Debian or Ubuntu

sudo apt-get install build-essential procps curl file git

This seemed to then allow the gcc post-install command to work:

$ brew postinstall gcc                                     
==> Postinstalling gcc
==> Creating the GCC specs file: /home/linuxbrew/.linuxbrew/Cellar/gcc/13.1.0/bin/../lib/gcc/current/gcc/x86_64-pc-linux-gnu/13/specs
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.