cabal install `gcc' 在 `C Compiler' 阶段失败

cabal install `gcc' failed in phase `C Compiler'

我想 parsec 用于个人项目。但是当我调用 cabal install parsec 时,我得到一个错误:

clang: error: unknown argument: '-no-pie'
gcc' failed in phase `C Compiler'. (Exit code: 1)

我在 OS X El Capitan,10.11.6。如果我没有正确理解上面的错误消息,gcc 似乎是原因。当我检查 gcc 的版本时,我得到

gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

此外,我已经阅读了这个 `gcc.exe' failed in phase `C Compiler'. (Exit code: 1) 并且在 stack setup--reinstall 之后, stack install parsec 工作得很好。但阴谋集团总是没有。你能帮帮我吗?

我在同一时间遇到了同样的问题:-)

我在 Whosebug 上找到的大多数答案即将更新 Xcode。

但是! 我从 2013 年就看到了这些建议,在那种情况下,我无法更新 Xcode,因为我有旧的 Macbook 和 OS X 10.11 就可以了,我试过: brew install gcc 下一步我想知道如何在 Xcode 上设置 Gnu C Compler,现在找到了方法。 使用您的收藏夹在终端中打开。编辑:

mate /Library/Frameworks/GHC.framework/Versions/8.4.2-x86_64/usr/lib/ghc-8.4.2/settings

并更改此:

, ("C compiler command","gcc")
, ("C compiler flags"," -fno-stack-protector")
, ("C compiler link flags"," ")
, ("C compiler supports -no-pie","YES")
, ("Haskell CPP command","gcc")

/usr/local/bin/gcc-8代替gcc & "NO"代替"YES»

希望对您有所帮助<3