macos 在 Mac OS X Lion 中使用 gcc 而不是 llvm-gcc

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8707367/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 08:44:36  来源:igfitidea点击:

Using gcc not llvm-gcc with Mac OS X Lion

macosgccosx-lionllvm

提问by prosseek

gccis symbolically linked to llvm-gccon Mac OS X Lion.

gccllvm-gcc在 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.2when gccis called?

如何设置使用gcc-4.2whengcc被调用?

采纳答案by prosseek

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

似乎有一种方法可以在 Xcode 4.2 中使用 gcc - http://caiustheory.com/install-gcc-421-apple-build-56663-with-xcode-42

回答by Ned Deily

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 llvmcode backend) and clang(clang front-end with llvmbackend). While it is possible to install legacy versions of vanillaGNU 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 gccanymore and that they want developers and users to move to clang.

从 Lion 中的 Xcode 4.2 开始,Apple 不再提供gcc-4.2Xcode 4.1 及更早版本中的先前版本。它现在只提供llvm-gcc(gcc front-end with llvmcode backend) 和clang(clang front-end with llvmbackend)。虽然可以从 MacPorts 等其他来源安装传统版本的vanillaGNU gcc-4.2(并且不会打扰/usr/bin),但 Apple 已明确表示他们将不再提供支持gcc,并且他们希望开发人员和用户能够移至clang.

回答by fikovnik

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

我在使用 llvm-gcc 和 clang os 编译东西(例如 condor)时遇到了一些问题,我必须获得原始的 gcc。

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

我使用自制软件https://raw.github.com/adamv/homebrew-alt/master/duplicates/gcc.rb安装了 4.6 版

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

回答by Craig B.

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.

我个人只是使​​用 Apple gcc,不管是否使用 llvm,来构建可用的最新 gcc。即使 /usr/bin/gcc 真的是 gcc 而不是一些 llvm 构建的包装器,它仍然是疯狂的旧。我在这里记录了我在构建过程中的经验。