2011-08-21 13 views
15

私はXcode 4.2をインストールしたライオン(10.7.1)システムを持っています。次のように私はhelloWorld.c簡単なCプログラムがあるとします。Lionの下でXcode 4.2にPPC/PPC64サポートを追加する方法を教えてください。

#include <stdio.h> 
main() { 
    printf("hello, world\n"); 
} 

この設定を使用して、私はPPCとPPC64アーキテクチャ、例えば上で使用するためにhelloWorld.cをコンパイルしようとしたいと思います

llvm-gcc-4.2: error trying to exec '/usr/bin/../llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2': execvp: No such file or directory 

どのように私は私のXcode 4のインストールにPowerPCのためのサポートを復元します:

$ gcc -arch ppc helloWorld.c -o helloWorld 

これは、次のエラーメッセージを表示しますか?

this previous Stack Overflow postに記載されている手順を試しましたが、これらの手順はLionのインストールでは機能しません。

私はXcode 3.2.6 installer located on Apple's dev siteを使用しています。

シンボリックリンクから、私は10.6インストールでは動作するが、10.7では動作しないと思われる。

いずれの場合でも、Xcode 3.2.6インストールのソースファイルとディレクトリの一部は、シンボリックリンクを作成するために存在しないか、Xcode 3インストールの別の場所にあります。 (たとえば、asバイナリをリンクする/Xcode3/usr/binディレクトリはありません)

LionシステムのPPCおよびPPC64バイナリをコンパイルするのに誰かがいましたか?

賞金を獲得するには、合理的に詳細な回答を書いてください。私のためだけでなく、後世のためにも。 :)

EDIT - 2011年8月31日

だから私はローランが指さし、さらに沿って得たが、これはPPCのサポートが働いて取得するのに十分ではなかったの修正を試してみました。

私はそれが必要なリソースを見つけるに沿っgccを手助けしようとするシンボリックリンクを追加しました:

$ sudo ln -s /Xcode3/usr/llvm-gcc-4.2/bin/powerpc-apple-darwin10-llvm-gcc-4.2 /usr/llvm-gcc-4.2/bin/powerpc-apple-darwin10-llvm-gcc-4.2 
$ sudo ln -s /Xcode3/usr/llvm-gcc-4.2/bin/powerpc-apple-darwin10-llvm-g++-4.2 /usr/llvm-gcc-4.2/bin/powerpc-apple-darwin10-llvm-g++-4.2 
$ sudo ln -s /Xcode3/usr/llvm-gcc-4.2/bin/powerpc-apple-darwin10-llvm-gcc-4.2 /usr/llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2 
$ sudo ln -s /Xcode3/usr/llvm-gcc-4.2/bin/powerpc-apple-darwin10-llvm-g++-4.2 /usr/llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-g++-4.2 

私は私のテストアプリケーションをコンパイルしようとしたとき、私はエラーの多くを得る:

$ gcc -arch ppc helloWorld.c -o helloWorld 
powerpc-apple-darwin11-llvm-gcc-4.2: 2: No such file or directory 
In file included from /usr/include/stdio.h:64, 
       from helloWorld.c:1: 
/usr/include/sys/cdefs.h:540:4: error: #error Unknown architecture 
In file included from /usr/include/sys/_types.h:33, 
       from /usr/include/_types.h:27, 
       from /usr/include/stdio.h:67, 
       from helloWorld.c:1: 
/usr/include/machine/_types.h:36:2: error: #error architecture not supported 
In file included from /usr/include/_types.h:27, 
       from /usr/include/stdio.h:67, 
       from helloWorld.c:1: 
/usr/include/sys/_types.h:94: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_blkcnt_t’ 
/usr/include/sys/_types.h:95: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_blksize_t’ 
/usr/include/sys/_types.h:96: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_dev_t’ 
/usr/include/sys/_types.h:99: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_gid_t’ 
/usr/include/sys/_types.h:100: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_id_t’ 
/usr/include/sys/_types.h:101: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_ino64_t’ 
/usr/include/sys/_types.h:103: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_ino_t’ 
/usr/include/sys/_types.h:107: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_mach_port_name_t’ 
/usr/include/sys/_types.h:108: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_mach_port_t’ 
/usr/include/sys/_types.h:109: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_mode_t’ 
/usr/include/sys/_types.h:110: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_off_t’ 
/usr/include/sys/_types.h:111: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_pid_t’ 
/usr/include/sys/_types.h:131: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_sigset_t’ 
/usr/include/sys/_types.h:132: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_suseconds_t’ 
/usr/include/sys/_types.h:133: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_uid_t’ 
/usr/include/sys/_types.h:134: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__darwin_useconds_t’ 
... 
/usr/include/secure/_stdio.h:62: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__DARWIN_LDBL_COMPAT’ 
/usr/include/secure/_stdio.h:67: error: expected declaration specifiers or ‘...’ before ‘size_t’ 
/usr/include/secure/_stdio.h:67: error: expected declaration specifiers or ‘...’ before ‘size_t’ 
/usr/include/secure/_stdio.h:68: error: expected declaration specifiers or ‘...’ before ‘va_list’ 
/usr/include/secure/_stdio.h:69: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__DARWIN_LDBL_COMPAT’ 
helloWorld.c:3: error: expected declaration specifiers before ‘main’ 
helloWorld.c:5: error: old-style parameter declarations in prototyped function definition 
/usr/include/stdio.h:252: error: parameter name omitted 
/usr/include/stdio.h:252: error: parameter name omitted 
helloWorld.c:5: error: expected ‘{’ at end of input 

Xcode3ヘッダーを指すようにコンパイルオプションを追加する必要がありますが、私は/Xcode3/usr/includeを探しています。

+0

コマンドラインでベースSDKおよび/またはGCCバージョン( "-sdk /Developer/SDKs/MacOSX10.5.sdk"、 "GCC_VERSION = 4.2")を指定できますか?これにより、LLVM/GCCブリッジの代わりにGCCが強制的に使用されます。 –

+0

私はコマンドラインを使用しています。 'export GCC_VERSION = 4.2;を指定する。 gcc -arch ppc -sdk /Developer/SDKs/MacOSX10.5.sdk helloWorld.c -o helloWorld'と同じエラーが返されます。 –

+0

私の間違いですが、GCC_VERSION = 4.2はxcodebuildを使用している場合にのみ動作します。コンパイラCC = gcc-4.2またはCC =/usr/bin/gcc-4.2を明示的に指定することはできますか? –

答えて

9

LionでXcode 3.2.6の古典的インストールを実行すると、Xcodeツールセットは無効になり、インストールされません。そのため、Xcode3/usr/binは存在しません。

以下の記事を読むことをお勧めします(さらに先に進む前に両方の記事を読んでください)。インストーラを騙してすべてをインストールするというトリックを説明しています。

その後、あなたはXcodeでPPCのサポートを復元するためthe trick from the SO entryを適用することができます。

注:私は上記の手順をテストしていませんが、そのフィードバックをお寄せいただき誠にありがとうございます。それが役に立てば幸い。

編集04 9月2011:私はいくつかの実験をするためにライオンマシンに手を差し伸べて、結果を得ました。私はそれらを集めたon my blog

+0

これは有望そうです。何かを見つけたらフォローアップします。 –

+1

フォローアップするだけで、最終的には動作しませんでしたが、以前よりもさらに進化しました。ありがとう、しかし! –

+0

私はいくつかの実験を行い、いくつかの結果を得ました。私の答えの編集を見てください。 –

関連する問題