Using gcc instead of clang in ghci or ghc

On Mac OSX 10.9, the default Xcode compiler is clang . I installed gcc-4.9 using homebrew . Now I have two different gcc s, one is clang , the other is gcc . The default is clang .

I want to use gcc when compiling Haskell files with ghc , and also want gcc when running ghci . How to do it?

+6
source share
1 answer

Reproducing my directions that I have shared with haskellers over the past few months through https://gist.github.com/cartazio/7131371

  • Type ghc --print-libdir

    The output will be like /Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3

  • Go to this directory and edit the settings file.

  • A line appears indicating the path to the C compiler. It will probably say /bin/gcc

  • Change this line to /usr/local/bin/gcc-4.8 (or depending on which gcc version you are brew for example /usr/local/bin/gcc-4.2 )

+10
source

Source: https://habr.com/ru/post/959229/


All Articles