Homebrew 安装 gcc 时出现问题

Homebrew 安装 gcc 时出现问题

我在 Homebrew 安装 gcc 时遇到了问题。

homebrew install gcc生产

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

brew postinstall gcc生产

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

gcc --version似乎有 gcc 版本 11.3:

gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0

gcc-12 --version给出此错误:

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

因此,许多依赖于 gcc 的软件包无法正常运行。此外,尝试在 R 中安装软件包也失败了。我尝试通过 homebrew 重新安装,但没有成功。同样,运行sudo apt-get install --reinstall gcc也没有解决问题。

值得注意的是,我在 WSL 下运行 Ubuntu:

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

运行which gcc产生

/usr/bin/gcc

运行which gcc-12产生

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

非常感谢您的帮助。TP

答案1

我怀疑问题可能是你缺少一些 Homebrew 要求,如下所述Linux 上的 Homebrew - 要求

要求

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

要安装构建工具,请在终端提示符下粘贴:

Debian 或 Ubuntu

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

这似乎允许 gcc 后安装命令起作用:

$ 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

相关内容