问题描述
在使用osx lion和XCode 4.1的新Macbook pro上,我的gcc出现了一些问题.
on my new macbook pro with osx lion and XCode 4.1 I have some problems with gcc.
在/usr/bin
中我找不到gcc-4.2
我只有以下版本:
i686-apple-darwin11-llvm-gcc-4.2
llvm-gcc
llvm-gcc-4.2
结果,当我尝试通过port select --set gcc gcc42
选择gcc42时,它返回以下错误:Selecting 'gcc42' for 'gcc' failed: could not create new link "/opt/local/bin/gcc": target "/usr/bin/gcc-4.2" doesn't exist
As a result when I try to select gcc42 by means of port select --set gcc gcc42
it returns me the following error:Selecting 'gcc42' for 'gcc' failed: could not create new link "/opt/local/bin/gcc": target "/usr/bin/gcc-4.2" doesn't exist
但是port select gcc
返回以下版本:
apple-gcc42
gcc42
llvm-gcc42 (active)
mp-gcc44
如何解决此问题?
谢谢!
推荐答案
应该有一个安装了Xcode 4.1的/usr/bin/gcc-4.2
.但是,随着最近的Xcode 4.2更新,Apple终于删除了其修改后的标准gcc-4.2
.剩下的要么是llvm-gcc42
(也链接到gcc
)和clang
,这是较新的非gcc C编译器.苹果正在过渡到clang
;第一步是使用混合llvm-gcc42
.使用这两种新的编译器,都有一些已报告的问题.您应该利用这段时间弄清楚它们是否有问题,如果有,请修复您的代码并将错误报告给Apple.同时,如果您绝对必须拥有旧的gcc-4.2,则可以通过MacPorts构建类似于先前Apple修改过的gcc-4.2:
There should be a /usr/bin/gcc-4.2
with Xcode 4.1 installed. However, with the recent Xcode 4.2 update, Apple has finally removed their modified standard gcc-4.2
. What remains is either llvm-gcc42
(also symlinked to gcc
) and clang
, the newer non-gcc C compiler. Apple is making the transition to clang
; the first step is using the hybrid llvm-gcc42
. There have been some reported problems using either of the new compilers. You should be using this time to figure out if you have problems with them and, if so, fix your code and report bugs to Apple. In the meantime, if you absolutely have to have the old gcc-4.2, it is possible to build one similar to the previous Apple-modified one via MacPorts:
port install apple-gcc42
但是你会顺应潮流.
这篇关于GCC 4.2版本缺失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!