如何使用 xcodebuild 构建特定的架构?

发布于 2024-11-09 22:33:14 字数 517 浏览 6 评论 0原文

我有依赖于 32 位 指针的遗留代码,并且希望使用 xCodeBuild命令行构建该代码。由于某种原因这不起作用。这是我使用的命令:

xcodebuild -configuration Debug -arch i386 
  -workspace MyProject.xcworkspace -scheme MyLib

这是我得到的输出

[BEROR]No architectures to compile for 
  (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).

显然,它正在尝试构建 x86_64 代码,但由于我只从 VALID_ARCHS 启用了 i386 xCode 项目设置。

有没有办法让它明白我不需要 64 位库?

I have legacy code that relies on pointers being 32-bit and want to use xCodeBuild to build that code from command line. This doesn't work for some reason. Here's the command I use:

xcodebuild -configuration Debug -arch i386 
  -workspace MyProject.xcworkspace -scheme MyLib

here's the output I get

[BEROR]No architectures to compile for 
  (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).

Clearly it's trying to build x86_64 code and failing miserably since I only enabled i386 from VALID_ARCHS in xCode project settings.

Is there a way to make it understand I don't want a 64-bit library?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

深海夜未眠 2024-11-16 22:33:18

如果您希望 xcodebuild 使用 ARCHS 参数,则必须将 ONLY_ACTIVE_ARCH 设置为 NO。通过传递这些参数,您可以强制采用正确的架构。

xcodebuild ARCHS=i386 ONLY_ACTIVE_ARCH=NO -configuration Debug -workspace MyProject.xcworkspace -scheme MyLib

请参阅此参考了解细节。

You have to set the ONLY_ACTIVE_ARCH to NO if you want xcodebuild to use the ARCHS parameters. By passing these parameters, you can force the proper architecture.

xcodebuild ARCHS=i386 ONLY_ACTIVE_ARCH=NO -configuration Debug -workspace MyProject.xcworkspace -scheme MyLib

See this reference for details.

默嘫て 2024-11-16 22:33:18

仅构建活动架构(ONLY_ACTIVE_ARCH)

xcodebuild ONLY_ACTIVE_ARCH...
//or
Build Settings -> Build Active Architecture Only -> ONLY_ACTIVE_ARCH

- 为连接的设备构建具有单一架构的二进制文件

- 为特定构建二进制文件-arch有效架构又名VALID_ARCHS)(如果已指定)或对于其他情况下的所有架构

建议使用Yes 用于调试(以节省构建时间),No 用于发布构建。

输入图片此处描述

注意:在模拟器上运行是安全的

要检查版本,请使用 lipo -info[关于]

Build Active Architecture Only(ONLY_ACTIVE_ARCH)

xcodebuild ONLY_ACTIVE_ARCH...
//or
Build Settings -> Build Active Architecture Only -> ONLY_ACTIVE_ARCH

YES - build binary with a single architecture for a connected device

NO - build binary for a specific -arch(valid architectures aka VALID_ARCHS) if it was specified or for all the architectures in other cases

The recommendation is to use Yes for Debug (to save on build time) and No for Release build.

enter image description here

Note: it is safe to run on simulator

To check the version use lipo -info[About]

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文