如何在Lion下将PPC / PPC64支持添加回Xcode 4.2? [英] How do I add PPC/PPC64 support back to Xcode 4.2 under Lion?

查看:150
本文介绍了如何在Lion下将PPC / PPC64支持添加回Xcode 4.2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台安装了Xcode 4.2的Lion(10.7.1)系统。假设我有一个简单的C程序 helloWorld.c ,如下所示:

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

使用这个设置,我想尝试编译 helloWorld.c 用于PPC和PPC64体系结构,例如:

  $ gcc -arch ppc helloWorld.c -o helloWorld 

这会给出以下错误信息:

  llvm-gcc-4.2:尝试执行错误'/usr/bin/../llvm-gcc-4.2/bin/ powerpc-apple-darwin11-llvm-gcc-4.2':execvp:没有这样的文件或目录

我是否将PowerPC的支持恢复到Xcode 4安装?

我尝试了这个先前的堆栈溢出文章,但这些说明不适用于我的Lion安装。



我使用位于Apple开发站点的Xcode 3.2.6安装程序



从符号链接中,我怀疑这些说明适用于10.6安装,但不是10.7。

在任何情况下,Xcode 3.2.6安装的一些源文件和目录不存在用于从Xcode 3创建符号链接或位于其他地方安装。 (例如,没有 / Xcode3 / usr / bin 目录,将链接为二进制文件。)



任何人都有幸从Lion系统编译PPC和PPC64二进制文件吗?

赏金,请写一个合理的详细答案。为了我自己,也为了后世。 : 尝试了Laurent指出并进一步改进的修改,但这不足以让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:没有这样的文件或目录
从/ usr / include /stdio.h:64,
from helloWorld.c:1:
/usr/include/sys/cdefs.h:540:4:error:#error未知架构
从/usr/include/sys/_types.h包含的文件中:33,来自/usr/include/_types.h:27的
,来自/usr/include/stdio.h:67的
,来自helloWorld.c的
:1:
/usr/include/machine/_types.h:36:2:错误:不支持#error体系结构
在/usr/include/_types.h:27包含的文件中,/ usr / include中的
/stdio.h:67,$ helloWorld.c中的
:1:
/usr/include/sys/_types.h:94:error:expected'=',',',';', '__darwin_blkcnt_t'
/usr/include/sys/_types.h:95:error:expected'=',',',';','asm'或'__attribute__'之前的'asm'或'__attribute__' '__darwin_blksize_t'
/usr/include/sys/_types.h:96之前'__darwin_dev_t'$ b $之前错误:预计'=',',';','asm'或'__attribute__' b /usr/include/sys/_types.h:99:e在'__darwin_gid_t'
/usr/include/sys/_types.h:100之前预计'=',',',';','asm'或'__attribute__':error:expected'=', '''',';','asm'或'__attribute__'在'__darwin_id_t'之前
/usr/include/sys/_types.h:101:error:expected'=',',',';' ,'asm'或'__attribute__''__darwin_ino64_t'
/usr/include/sys/_types.h:103'error:expected'=',',',';','asm'或'__attribute__ '__darwin_ino_t'
/usr/include/sys/_types.h:107:error:expected'=',',';','asm'或'__attribute__'before'__darwin_mach_port_name_t'
/usr/include/sys/_types.h:108:error'expected'=',',';','asm'或'__attribute__''__darwin_mach_port_t'
/ usr / include / sys / _types.h:109:error:expected'=',',',';','asm'或'__attribute__'before'__darwin_mode_t'
/usr/include/sys/_types.h:110 :呃在'__darwin_off_t'
/usr/include/sys/_types.h:111:error:expected'='之前,预计'=',',',';','asm'或'__attribute__' ''',';','asm'或'__attribute__'在'__darwin_pid_t'之前
/usr/include/sys/_types.h:131:error:expected'=',',',';' ,'asm'或'__attribute__'之前'__darwin_sigset_t'
/usr/include/sys/_types.h:132:错误:expected'=',',',';','asm'或'__attribute__ '__darwin_suseconds_t'
/usr/include/sys/_types.h:133:error'expected'=',',';','asm'或'__attribute__'before'__darwin_uid_t'
/usr/include/sys/_types.h:134:error'expected'=',',';','asm'或'__attribute__'before'__darwin_useconds_t'
...
/usr/include/secure/_stdio.h:62:error'expected'=',',',';','asm'或'__attribute__''__DARWIN_LDBL_COMPAT'
/ usr / include /安全/ _s tdio.h:67:错误:预期声明说明符或'...'在'size_t'之前
/usr/include/secure/_stdio.h:67:错误:预期声明说明符或'...'之前'size_t'
/usr/include/secure/_stdio.h:68:错误:期望的声明说明符或'...'在'va_list'之前
/usr/include/secure/_stdio.h: 69:error:expected'=',',',';','asm'或'__attribute__'before'__DARWIN_LDBL_COMPAT'
helloWorld.c:3:错误:'main'之前的预期声明说明符
helloWorld.c:5:错误:原型函数定义中的旧式参数声明
/usr/include/stdio.h:252:错误:参数名省略
/usr/include/stdio.h :252:错误:省略参数名称
helloWorld.c:5:错误:预期'{'在输入结束处

也许有一些编译选项需要添加到Xcode3头文件中,但是我正在寻找 / Xcode3 / usr / include ,并且没有太多如果您在Lion上执行Xcode 3.2.6的经典安装,则Xcode工具集将被禁用,并且未安装。

。这就是为什么 Xcode3 / usr / bin 不存在的原因。

我建议你阅读以下文章(在进一步阅读之前阅读他们两个)。他们描述了一种欺骗安装程序来安装所有软件的技巧。



然后,您可以应用来自SO条目的技巧用于恢复Xcode中的PPC支持。



注意:我没有测试过上述步骤,但我很乐意听到您对此的反馈。希望它有帮助。



编辑2011年9月4日:我已经设法让我的手在狮子机器上进行一些实验并获得一些结果。我收集了他们在我的博客上。


I have a Lion (10.7.1) system on which I installed Xcode 4.2. Suppose I have a simple C program helloWorld.c as follows:

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

Using this setup, I would like to try to compile helloWorld.c for use on PPC and PPC64 architectures, e.g.:

$ gcc -arch ppc helloWorld.c -o helloWorld

This gives the following error message:

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

How do I restore support for PowerPC to my Xcode 4 installation?

I have tried the instructions outlined in this previous Stack Overflow post, but these instructions do not work for my Lion installation.

I am using the Xcode 3.2.6 installer located on Apple's dev site.

From the symbolic links, I suspect those instructions work for a 10.6 installation, but not 10.7.

In any case, some of the source files and directories from the Xcode 3.2.6 installation do not exist to make symbolic links from, or are located elsewhere in the Xcode 3 install. (For example, there is no /Xcode3/usr/bin directory from which to link the as binary.)

Has anyone had luck with compiling PPC and PPC64 binaries from a Lion system?

To be awarded the bounty, please write a reasonably detailed answer. For myself, but also for posterity. :)

EDIT - 31 Aug 2011

So I tried the modifications that Laurent pointed to and got further along, but this was not enough to get PPC support working.

I added symbolic links to try to help gcc along in finding the resources it needs:

$ 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

When I tried to compile my test app, I get a lot of errors:

$ 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

Perhaps there compilation options I should add to point to Xcode3 headers, but I'm looking in /Xcode3/usr/include and there's not really much there.

解决方案

If you perform a classical install of Xcode 3.2.6 on Lion, the Xcode toolset is disabled and is not installed. That's why the Xcode3/usr/bin does not exists.

I suggest you to read the following posts (read both of them before going further). They describe a trick to fool the installer into installing everything.

Then, you can apply the trick from the SO entry for restoring PPC support in Xcode.

Note: I have not tested the steps above, but I will be glad to hear your feedback on it. Hope it helps.

Edit 04 Sep. 2011: I have managed to get my hands on a Lion machine to make some experiments and got some results. I have gathered them on my blog.

这篇关于如何在Lion下将PPC / PPC64支持添加回Xcode 4.2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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