使用gcc而不是ghci或ghc中的clang [英] Using gcc instead of clang in ghci or ghc
问题描述
在Mac OS X 10.9上,与 Xcode
捆绑在一起的默认c编译器是 clang
。我用 homebrew
安装了 gcc-4.9
。现在我有两个不同的 gcc
s,一个是 clang
,另一个是 gcc
。默认是 clang
。
On Mac OSX 10.9, the default c compiler bundled with Xcode
is clang
. I installed gcc-4.9
with homebrew
. Now I have two different gcc
s, one is clang
, the other is gcc
. The default is clang
.
我想要使用 gcc
使用 ghc
编译Haskell文件时,当我启动 ghci 时我也想要
gcc
/ code>。如何做这个改变?
I want to use gcc
when compiling Haskell files with ghc
, and I want also gcc
when I launch ghci
. How to do this change?
推荐答案
重现我的指示过去几个月,我一直与haskellers共享 https://gist.github.com/cartazio/7131371
Reproducing my directions I've been sharing with haskellers for the past few months via https://gist.github.com/cartazio/7131371
-
类型
ghc --print-libdir
输出将是一个像 /Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3
转到该目录并编辑设置
文件。
Go to that directory and edit the settings
file.
将会有一行指示C编译器的路径。它可能会说 / bin / gcc
There'll be a line indicating the path to the C compiler. It'll probably say /bin/gcc
将该行更改为 /usr/local/bin/gcc-4.8
(或者您安装了brew的任何 gcc
版本,例如 / usr / local / bin / gcc-4.2
)
Change that line to /usr/local/bin/gcc-4.8
(or whichever gcc
version you brew installed, such as /usr/local/bin/gcc-4.2
)
这篇关于使用gcc而不是ghci或ghc中的clang的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!