GAS (GNU Assembler) 可以编译到 iPhone/iTouch 吗?
我正在使用非官方的 Open SDK 为 iDevice 市场编写一些应用程序,但在 Windows 上安装开放工具链而不是 Linux 上遇到困难(我会使用 Linux,但不能在我的工作计算机上),所以我正在对其进行编程GNU 汇编器 (GAS)。
GAS 是否可以将 iDevice 作为输出文件的格式?如果没有,是否有任何基于 Windows 或 Linux 的汇编程序(最好是开源的)可以汇编到 iPod touch 上?
I am programming some applications for the iDevice market using the unofficial Open SDK, but am having difficulty installing the open toolchain on Windows, rather than Linux (I would use Linux, but I cannot on my work computer), so I am programming it in GNU Assembler (GAS).
Is it possible for GAS to target an iDevice as a format for output files? If not, are there any Windows or Linux-based assemblers (preferably open-source) that can assemble to the iPod touch?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请注意,gcc 或gas 并不是生成iOS 应用程序包的最后一步。在官方的 Xcode 构建序列中,依次为链接、UniversalBinary 合并、打包和代码设计。因此,您可能至少需要一些在您选择的开发平台上运行的步骤的工具。
Note that gcc or gas is not the last step in producing an iOS app bundle. In the official Xcode build sequence, there follows linking, UniversalBinary merging, packaging and codesigning. So you might need tools for at least a few of these steps that run on your chosen development platform.
即使技术上可行,我也不愿意从事这样的事业。您可能会面临大量问题,不仅涉及协同设计,还涉及应用程序商店审批。苹果非常热衷于人们只使用他们的官方工具,并禁止任何交叉编译器等的使用。如果他们发现最轻微的迹象表明您的应用程序是按照您提议的方式创建的,他们很可能会拒绝它。
即使他们可能不会——我也不会冒这个风险。想象一下,开发工作流程,完成所有工作,解决所有协同设计和其他问题,然后苹果拒绝您的应用程序。
习惯使用 Mac 工作并不难。至少在冒险之前先尝试一下。
Even if it is technically possible, I'd rather not embark on such an enterprise. You may face massive problems, not only concerning codesigning but also app store approval. Apple is very keen on people using only their official tools and prohibits any use of cross compilers and the like. If they find the slightest hint that your app has been created in a way as you proposed, they may very well reject it.
Even if they maybe won't - that's a risk I wouldn't take. Imagine developing the workflow, doing all the work, solving all the codesigning and other problems and then apple rejecting your app.
Getting used to work with a Mac is not that hard. At least give it a try before taking chances.
从技术上讲,是的,您可以使用 GNU 工具链制作一个交叉汇编器,甚至是一个交叉编译器来针对 iPhone。神奇之处在于将正确的拱字符串传递给 binutils 的“配置”。它应该是
--target=arm-apple-darwin
加上一个我不记得告诉 binutils 默认使用哪个 ARM 命令集的参数。所以制作一个交叉汇编器是可能的,甚至没有那么难。但这只是一小步。您还需要一个可以处理 Mach-O 文件的链接器,但我不知道如何设置它。我知道有一个完整的工具链可以在 Linux 上交叉编译到 iPhone,使用原始的 Apple SDK,但带有自定义的交叉 gcc。不过苹果已经明确禁止使用交叉编译器,主要是禁止Flash到iPhone的交叉编译器。另外,您需要对应用程序进行代码签名,我不知道是否有 OSS 工具可以做到这一点。
正如其他人已经说过的,买一台 Mac Mini,也许是 eBay 上的二手的。如果没有 Mac,您将无法走得太远,即使您仍然想这样做,您也首先需要深入了解有关 iPhone 编译的知识,而您只能在 Mac 上获得这些知识。
此外,您当然不想没有良好的调试器、Instruments 和 Interface Builder,以便轻松调试、查找内存泄漏和构建 GUI。如果没有 Interface Builder,您将需要完全手动编写 GUI 代码,这将花费您更多的时间,而时间就是金钱。很多书籍和指南在很大程度上对你来说毫无用处。总而言之,如果您尝试通过交叉编译来破解应用程序,您的公司将花费更多的钱,而不是他们为您提供漂亮闪亮的 iMac plus 开发时间。
Technically, yes, you can make a cross-assembler and even a cross-compiler with the GNU toolchain to target the iPhone. The magic is passing the correct arch-string to binutils' "configure". It should be
--target=arm-apple-darwin
plus an argument that I don't remember to tell binutils which ARM comandset to use by default. So making a cross-assembler is possible and even nit that hard.But that would only be one small step. You would also need a linker that can handle Mach-O files and I've got no idea how to set that up. I know that there was a complete toolchain for cross-compiling to iPhone on Linux, using the original Apple SDK but with a custom cross-gcc. However, Apple has explicitely forbidden to use cross-compilers, mainly to ban the Flash-to-iPhone cross-compiler. Also, you need to code-sign the app and I've got no idea if there's an OSS tool that would be able to do that.
As others have already said, get a Mac Mini, maybe a used one from eBay. You won't get very far without a Mac, and even if you still wanted to you would first need intimate knowledge about compiling for iPhone, and you only get that knowledge on a Mac.
Also you certainly don't want to live without the good debugger, Instruments and Interface Builder for easy debugging, memory leak finding and GUI building. Without Interface Builder you would need to code the GUI completely manually and that will take you a lot more time, and time is money. A lot of books and howtos would be useless to you to a large degree. All in all, it will cost your company more money if you try to hack an app with cross-compiling than it would cost them to give you a nice shiny iMac plus development time.