首页 > 系统服务 > 详细

MAC上安装GCC失败

时间:2019-02-14 11:44:03      阅读:759      评论:0      收藏:0      [点我收藏+]

技术分享图片

问题

在用brew安装GCC时, 报了如下错误.

?  ~ brew install gcc
==> Installing dependencies for gcc: isl, mpfr and libmpc
==> Installing gcc dependency: isl
==> Downloading https://homebrew.bintray.com/bottles/isl-0.20.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring isl-0.20.mojave.bottle.tar.gz
??  /usr/local/Cellar/isl/0.20: 71 files, 3.9MB
==> Installing gcc dependency: mpfr
==> Downloading https://homebrew.bintray.com/bottles/mpfr-4.0.1.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mpfr-4.0.1.mojave.bottle.tar.gz
??  /usr/local/Cellar/mpfr/4.0.1: 28 files, 4.6MB
==> Installing gcc dependency: libmpc
==> Downloading https://homebrew.bintray.com/bottles/libmpc-1.1.0.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libmpc-1.1.0.mojave.bottle.tar.gz
??  /usr/local/Cellar/libmpc/1.1.0: 12 files, 354KB
==> Installing gcc
Warning: Building gcc from source:
  The bottle needs the Xcode CLT to be installed.
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: An exception occurred within a child process:
  CompilerSelectionError: gcc cannot be built with any available compilers.
Install GNU's GCC
  brew install gcc

原因是 在从App Store上下载Xcode后,默认是不会安装Command Line Tools的.

解决方法

这时需要先更新一下xcode

xcode-select --install

参考

MAC上安装GCC失败

原文:https://www.cnblogs.com/qyf404/p/how_install_gcc_in_mac.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!