Clang和OS X Lion中的默认编译器 [英] Clang and the default compiler in OS X Lion

查看:227
本文介绍了Clang和OS X Lion中的默认编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在OS X Snow Leopard(10.6)中,我使用〜/ .bashrc 中的以下行强制使用clang而不是标准gcc进行编译:

In OS X Snow Leopard (10.6) I used the following lines in ~/.bashrc to force compilation with clang instead of standard gcc:

# Set Clang as the default compiler for the system
export CC=clang
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments



我也偶尔会使用下面的命令行llvm-gcc当clang将无法编译某些事情(PostgreSQL长期以来犯了这个错误):

I also (occasionally) had to use the following lines to use llvm-gcc when clang would fail to compile certain things (PostgreSQL was guilty of this for a long time):

# Set LLVM GCC as the default compiler for the system
export CPP='llvm-gcc-4.2'
export CC='llvm-gcc-4.2'
export CXX='llvm-g++'

在OS X Lion(10.7)上,这些行是否仍然需要?是llvm-gcc(或clang)系统的默认编译器吗?或者这些行仍然需要存在于我的〜/ .bashrc

On OS X Lion (10.7), are these lines still required? Is llvm-gcc (or clang) the default compiler for the system? Or will these lines still need to live in my ~/.bashrc?

推荐答案

gcc符合连接到Lion上的llvm-gcc-4.2。

gcc is symlinked to llvm-gcc-4.2 on Lion.

lrwxr-xr-x 1 root wheel 12 Jul 21 20:51 / usr / bin / gcc - > llvm-gcc-4.2

lrwxr-xr-x 1 root wheel 12 Jul 21 20:51 /usr/bin/gcc -> llvm-gcc-4.2

lrwxr-xr-x 1 root wheel 12 Jul 21 20:51 / usr / bin / g ++ - > llvm-g ++ - 4.2

lrwxr-xr-x 1 root wheel 12 Jul 21 20:51 /usr/bin/g++ -> llvm-g++-4.2

可以删除这些环境变量而没有太大的伤害。

You can probably remove those environment variables without much harm.

这篇关于Clang和OS X Lion中的默认编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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