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

查看:37
本文介绍了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

当 clang 无法编译某些东西时,我也(偶尔)不得不使用以下几行来使用 llvm-gcc(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 根轮 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 根轮 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天全站免登陆