Gcc 4.2 版本缺失

发布于 2024-12-13 10:06:51 字数 538 浏览 2 评论 0原文

在我的带有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

不弃不离 2024-12-20 10:06:51

我可以通过符号链接设法解决 Mountain Lion 中的这个问题:

sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2

希望这对某人有帮助

I could manage to solve this issue in Mountain Lion with a symbolic link:

sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2

Hope this help someone

探春 2024-12-20 10:06:51

应该有一个安装了 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 修改的版本:

port install apple-gcc42

但您将逆流而上。

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

but you'll be swimming against the tide.

淡写薰衣草的香 2024-12-20 10:06:51

使用 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.

遮了一弯 2024-12-20 10:06:51

我有同样的问题。

我通过执行符号链接修复了它。

像这样:

cd /usr/bin

然后:

sudo ln -s llvm-gcc-4.2 gcc-4.2

I had the same issue.

I fixed it by doing a symlink.

Like this :

cd /usr/bin

then :

sudo ln -s llvm-gcc-4.2 gcc-4.2
爱殇璃 2024-12-20 10:06:51

您可以考虑从其源代码编译更新的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.

夜巴黎 2024-12-20 10:06:51

我篡改了 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文