Using gcc not llvm-gcc with Mac OS X Lion

无人久伴 提交于 2019-12-03 09:38:43

问题


gcc is symbolically linked to llvm-gcc on Mac OS X Lion.

prosseek ~> ls -alF /usr/bin/gcc
lrwxr-xr-x  1 root  wheel  12 Nov 12 14:39 /usr/bin/gcc@ -> llvm-gcc-4.2

How can I setup to use gcc-4.2 when gcc is called?


回答1:


As of Xcode 4.2 in Lion, Apple no longer ships its previous version of gcc-4.2, which was in Xcode 4.1 and earlier versions. It now only ships llvm-gcc (gcc front-end with llvm code backend) and clang (clang front-end with llvm backend). While it is possible to install legacy versions of vanilla GNU gcc-4.2 from other sources, like MacPorts, (and without disturbing /usr/bin), Apple has made it clear that they aren't going to be supporting gcc anymore and that they want developers and users to move to clang.




回答2:


There seems to be a way to use gcc with Xcode 4.2 - http://caiustheory.com/install-gcc-421-apple-build-56663-with-xcode-42




回答3:


I experienced some problems in compiling stuff (condor for instance) with both llvm-gcc and clang os I had to get the original gcc.

I installed the version 4.6 using homebrew https://raw.github.com/adamv/homebrew-alt/master/duplicates/gcc.rb

brew install https://raw.github.com/adamv/homebrew-alt/master/duplicates/gcc.rb



回答4:


I personally just use the Apple gcc, llvm or not, to build the latest gcc available. Even if /usr/bin/gcc were really gcc and not a wrapper over some llvm build, it's still crazy old. I documented my experience with the build process here.



来源:https://stackoverflow.com/questions/8707367/using-gcc-not-llvm-gcc-with-mac-os-x-lion

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