简体   繁体   English

如何使用macports安装clang 3.1? (OSX,雪豹)

[英]How to install clang 3.1 using macports? (OSX, snow leopard)

I'd like to install the latest clang (3.1) compiler using macports (I use emacs rather than xcode, and the version of clang that comes with xcode is older anyway). 我想使用macports安装最新的clang(3.1)编译器(我使用的是emacs而不是xcode,而且xcode附带的clang版本无论如何都比较旧)。 macports seems to have the latest versions of gcc, but when I enter "port list clang" the only version that shows up is 2.9. macports似乎有最新版本的gcc,但是当我输入“port list clang”时,显示的唯一版本是2.9。 I use the C++11 features, so I want to use the latest version. 我使用C ++ 11的功能,所以我想使用最新版本。

I'm running snow leopard on an MBP. 我在MBP上跑豹雪豹。

Clang has several different versions available on MacPorts: Clang在MacPorts上有几个不同的版本:

$ port search clang

clang @2.9 (lang)
    C, C++, Objective C and Objective C++ compiler

clang-2.9 @2.9 (lang)
    C, C++, Objective C and Objective C++ compiler

clang-3.0 @3.0 (lang)
    C, C++, Objective C and Objective C++ compiler

clang-3.1 @3.1-r154872 (lang)
    C, C++, Objective C and Objective C++ compiler

clang-devel @3.0 (lang)
    C, C++, Objective C and Objective C++ compiler

clang_select @0.1 (sysutils)
    common files for selecting default clang version

Found 6 ports.

So if you just install the clang port, it'll install version 2.9. 所以如果你只是安装clang端口,它将安装2.9版本。 If you want 3.1, install the clang-3.1 port. 如果需要3.1,请安装clang-3.1端口。 You can also install clang_select , which is a utility that allows you to easily switch between multiple installations of Clang; 您还可以安装clang_select ,这是一个实用程序,允许您轻松切换Clang的多个安装; without it, you have to manually specify the version of the Clang binary you want each time. 没有它,您必须手动指定每次所需的Clang二进制文件的版本。

Just specify the version number: port list clang-3.1 只需指定版本号: port list clang-3.1

Worked fine for me. 为我工作得很好。 I'm on Lion, but I don't see why that would make a difference. 我在狮子会,但我不明白为什么会有所作为。

由于macports存储库似乎没有最新的clang,我建议从源代码构建clang ,然后继续创建一个新的macports包

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM