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

六眼飞鱼酱① 提交于 2020-01-02 05:15:33

问题


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 seems to have the latest versions of gcc, but when I enter "port list clang" the only version that shows up is 2.9. I use the C++11 features, so I want to use the latest version.

I'm running snow leopard on an MBP.


回答1:


Clang has several different versions available on 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. If you want 3.1, install the clang-3.1 port. You can also install clang_select, which is a utility that allows you to easily switch between multiple installations of Clang; without it, you have to manually specify the version of the Clang binary you want each time.




回答2:


Just specify the version number: port list clang-3.1

Worked fine for me. I'm on Lion, but I don't see why that would make a difference.




回答3:


Since the macports repository appears to not have the latest clang, I suggest building clang from source and then proceeding to make a new macports package.



来源:https://stackoverflow.com/questions/10368617/how-to-install-clang-3-1-using-macports-osx-snow-leopard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!