使用gcc而不是ghci或ghc中的clang [英] Using gcc instead of clang in ghci or ghc

查看:174
本文介绍了使用gcc而不是ghci或ghc中的clang的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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 gccs, 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


  1. 类型 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆