在64位环境下编译32位OS X二进制文件

6
在64位命令行环境下编译32位Intel OS X二进制文件需要哪些步骤?只需添加-m32标志吗?我没有使用Xcode,但如果需要,可以使用它来安装gcc可用的库。感谢您的建议。
1个回答

8

如果你正在使用苹果实现的GCC在Macintosh电脑上进行编译,其中一个额外的选项是可以传递"-arch"参数。

man页面上说:

-arch arch
   Compile for the specified target architecture arch.  
   The allowable values are i386, x86_64, ppc and ppc64.  
   Multiple options work, and direct the compiler to produce "universal" 
   binaries including object code for each architecture specified with -arch.  
   This option only works if assembler and libraries are available 
   for each architecture specified.  (APPLE ONLY)

“i386” 是否总是(我是说总是)指32位的英特尔? - Alex Reynolds
据我所知,除非AMD或其他我不知道的英特尔竞争对手为苹果电脑制造芯片,否则不会出现这种情况。 - Michael Dautermann
好的,我会试一试看能找到什么。谢谢。 - Alex Reynolds
请更新“man手册”的链接。 - Boris
1
完成 @Boris; 据我所知,gcc不再默认安装在Mac上。开源贡献者仍在为M1 Macs“努力工作” - Michael Dautermann
显示剩余2条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接