【问题标题】:Installing GCC 4.7.1 on OS X在 OS X 上安装 GCC 4.7.1
【发布时间】:2013-01-04 08:37:40
【问题描述】:

我正在尝试在我的 Mac 上安装 GCC 4.7.1,因为我想更新 XCode 中给出的 LLVM GCC 4.2。

我已经下载了GCC 4.7.1 并将gcc-4.7.1 文件夹放在~/Downloads 中,然后我按照此处给出的说明进行操作:http://gcc.gnu.org/install/ 并写了

cd ~/Desktop
mkdir objdir
cd objdir
~/Downloads/gcc-4.7.1/configure --with-gmp=/usr/local/include --with-mpfr=/usr/local/include --with-mpc=/usr/local/include

而且配置确实有问题。

然后我写了

make

一切顺利,直到我收到这条消息

rm -f stage_current
Comparing stages 2 and 3
warning: gcc/cc1-checksum.o differs
warning: gcc/cc1obj-checksum.o differs
warning: gcc/cc1plus-checksum.o differs
  Bootstrap comparison failure!
gcc/intl.o differs
make[2]: *** [compare] Error 1
make[1]: *** [stage3-bubble] Error 2
make: *** [all] Error 2

然后make check 给我这个消息

/bin/sh: line 0: cd: ./fixincludes: No such file or directory
make[1]: *** [check-fixincludes] Error 1
make: *** [do-check] Error 2

还有make install这个消息

/bin/sh /Users/fpiro07/Downloads/gcc-4.7.1/mkinstalldirs /usr/local /usr/local
/bin/sh: line 0: cd: ./fixincludes: No such file or directory
make[1]: *** [install-fixincludes] Error 1
make: *** [install] Error 2

如何解决这些问题并安装我的GCC 4.7.1?

【问题讨论】:

    标签: macos shell gcc installation gnu


    【解决方案1】:

    安装MacPorts 并运行:

    $ sudo port selfupdate
    $ sudo port install gcc47
    

    它将负责正确配置和安装 gcc(撰写本文时为 4.7.2)和所有依赖项。

    【讨论】:

    • 不起作用。我已经下载了 .pkg 文件并通过双击安装了它。之后我在终端中输入“sudo port selfupdate”,它显示“sudo: port: command not found”
    • 好的,安装完macports后需要重启终端!但它仍然不起作用,因为当我输入 g++ --version 我看到我仍然在版本 4.2.1 ...!
    • 您需要检查/opt/local/bin 是否在$PATH 中。查看 macports 文档了解详细信息。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-13
    • 2013-12-21
    • 2010-10-28
    相关资源
    最近更新 更多