Gcc 4.2 版本缺失
在我的带有 osx lion 和 XCode 4.1 的新 macbook pro 上,我遇到了一些 gcc 问题。
在 /usr/bin
中,我找不到 gcc-4.2
我只有以下版本:
i686-apple-darwin11-llvm-gcc-4.2
llvm-gcc
llvm-gcc-4.2
因此,当我尝试通过 port select - 选择 gcc42 时-set gcc gcc42
它返回给我以下错误: 为“gcc”选择“gcc42”失败:无法创建新链接“/opt/local/bin/gcc”:目标“/usr/bin/gcc-4.2”不存在
但是 < code>port select gcc 返回以下版本:
apple-gcc42
gcc42
llvm-gcc42 (active)
mp-gcc44
如何解决此问题?
谢谢!
on my new macbook pro with osx lion and XCode 4.1 I have some problems with gcc.
In /usr/bin
I cannot find gcc-4.2
I only have the following versions:
i686-apple-darwin11-llvm-gcc-4.2
llvm-gcc
llvm-gcc-4.2
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
However port select gcc
returns me the following versions:
apple-gcc42
gcc42
llvm-gcc42 (active)
mp-gcc44
How can I fix this problem?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我可以通过符号链接设法解决 Mountain Lion 中的这个问题:
希望这对某人有帮助
I could manage to solve this issue in Mountain Lion with a symbolic link:
Hope this help someone
应该有一个安装了 Xcode 4.1 的
/usr/bin/gcc-4.2
。然而,随着最近的 Xcode 4.2 更新,Apple 终于删除了修改后的标准gcc-4.2
。剩下的就是llvm-gcc42
(也符号链接到gcc
)和clang
(较新的非 gcc C 编译器)。 Apple 正在向clang
过渡;第一步是使用混合llvm-gcc42
。据报告,使用这两种新编译器时会出现一些问题。您应该利用这段时间弄清楚您是否遇到问题,如果有,请修复您的代码并向 Apple 报告错误。与此同时,如果您绝对需要旧的 gcc-4.2,则可以通过 MacPorts 构建一个类似于之前 Apple 修改的版本:但您将逆流而上。
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 standardgcc-4.2
. What remains is eitherllvm-gcc42
(also symlinked togcc
) andclang
, the newer non-gcc C compiler. Apple is making the transition toclang
; the first step is using the hybridllvm-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:but you'll be swimming against the tide.
使用 Xcode 4.3,您需要单独安装命令行工具。 XCode->首选项->下载,单击“组件”按钮,然后单击“命令行工具”选项旁边的安装。
With Xcode 4.3, you need to install the Command Line Tools separately. XCode -> Preferences -> Downloads, Click the Components button, and then click Install next to the "Command Line Tools" option.
我有同样的问题。
我通过执行符号链接修复了它。
像这样:
然后:
I had the same issue.
I fixed it by doing a symlink.
Like this :
then :
您可以考虑从其源代码编译更新的GCC(例如4.6.2)。 Apple 不再关心 GCC,但自 4.2 以来 GCC 已经取得了重大进展
,您可能可以使用 llvm-gcc42 作为 GCC 编译器。
You might consider compiling a newer GCC (e.g. 4.6.2) from its source code. Apple does not care much any more about GCC, but GCC has made significant progress since 4.2
And you probably could use your
llvm-gcc42
as a GCC compiler.我篡改了 makefile 的内部结构,发现一个调用的选项提供了太多的参数;将变量替换为在我的机器上调用的函数的实际结果(删除多余的参数)并再次运行
make
它有效。I tampered with the innards of the makefile and found out that one invoked option provided an argument too many; replaced the variable with the actual result of the function called on my machine (removing the excess argument) and did run
make
again it worked.