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 gccs, one is clang, the other is gcc. The default is clang.
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?
Reproducing my directions I've been sharing with haskellers for the past few months via https://gist.github.com/cartazio/7131371
Type
ghc --print-libdirThe output will be a path like
/Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3Go to that directory and edit the
settingsfile.There'll be a line indicating the path to the C compiler. It'll probably say
/bin/gccChange that line to
/usr/local/bin/gcc-4.8(or whichevergccversion you brew installed, such as/usr/local/bin/gcc-4.2)
来源:https://stackoverflow.com/questions/20349104/using-gcc-instead-of-clang-in-ghci-or-ghc