MacOSX上的g ++不支持-arch ppc64 [英] g++ on MacOSX doesn't work with -arch ppc64

查看:116
本文介绍了MacOSX上的g ++不支持-arch ppc64的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用g ++在MacOSX上构建一个Universal二进制文件。但是,它并不真正起作用。我试过了这个简单的虚拟代码:

I am trying to build a Universal binary on MacOSX with g++. However, it doesn't really work. I have tried with this simple dummy code:

#include <iostream>
using namespace std;
int main() {
    cout << "Hello" << endl;
}

这很好:

This works fine:

% g++ test.cpp -arch i386 -arch ppc -arch x86_64 -o test
% file test
test: Mach-O universal binary with 3 architectures
test (for architecture i386):   Mach-O executable i386
test (for architecture ppc7400):    Mach-O executable ppc
test (for architecture x86_64): Mach-O 64-bit executable x86_64

然而,这并不是:

However, this does not:

% g++ test.cpp -arch i386 -arch ppc -arch x86_64 -arch ppc64 -o test
In file included from test.cpp:1:
/usr/include/c++/4.2.1/iostream:44:28: error: bits/c++config.h: No such file or directory
In file included from /usr/include/c++/4.2.1/ios:43,
                 from /usr/include/c++/4.2.1/ostream:45,
                 from /usr/include/c++/4.2.1/iostream:45,
                 from test.cpp:1:
/usr/include/c++/4.2.1/iosfwd:45:29: error: bits/c++locale.h: No such file or directory
/usr/include/c++/4.2.1/iosfwd:46:25: error: bits/c++io.h: No such file or directory
In file included from /usr/include/c++/4.2.1/bits/ios_base.h:45,
                 from /usr/include/c++/4.2.1/ios:48,
                 from /usr/include/c++/4.2.1/ostream:45,
                 from /usr/include/c++/4.2.1/iostream:45,
                 from test.cpp:1:
/usr/include/c++/4.2.1/ext/atomicity.h:39:23: error: bits/gthr.h: No such file or directory
/usr/include/c++/4.2.1/ext/atomicity.h:40:30: error: bits/atomic_word.h: No such file or directory
...

任何想法这是为什么?

我在MacOSX 10.6上。我已经安装了Xcode 3.2.2及其附带的所有SDK。 GCC 4.2是默认设置。 GCC 4.0产生了一些不同的错误,虽然表现类似。

I am on MacOSX 10.6. I have installed Xcode 3.2.2 with all SDKs it comes with. GCC 4.2 is the default. GCC 4.0 produces some different errors, though behaves similar.

推荐答案

ppc64支持在Snow Leopard中被丢弃。如果您构建并链接到Mac OS X 10.5 SDK,则仍然可以使用ppc64。

ppc64 support was dropped in Snow Leopard. You can still use ppc64 if you build and link against the Mac OS X 10.5 SDK.

请在命令行尝试以下命令:

Try the following command at the command line:

g++ test.cpp -arch i386 -arch ppc -arch x86_64 -arch ppc64 -mmacosx-version-min=10.5 -isysroot/Developer/SDKs/MacOSX10.5.sdk -DMACOSX_DEPLOYMENT_TARGET=10.5 -o test

或者对于10.4 SDK使用:

Or for the 10.4 SDK use:

g++-4.0 test.cpp -arch i386 -arch ppc -arch x86_64 -arch ppc64 -mmacosx-version-min=10.4 -isysroot/Developer/SDKs/MacOSX10.4u.sdk -DMACOSX_DEPLOYMENT_TARGET=10.4 -o test

请注意,如果您想使用10.4 SDK,你将不得不使用gcc 4.0(或g ++ 4.0)。 Apple的GCC 4.2不支持10.4 SDK。

Note, if you want to use the 10.4 SDK, you will have to use gcc 4.0 (or g++4.0 ). Apple's GCC 4.2 doesn't support the 10.4 SDK.

这篇关于MacOSX上的g ++不支持-arch ppc64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆