如何使用 xcodebuild 构建特定的架构?
我有依赖于 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您希望 xcodebuild 使用
ARCHS
参数,则必须将ONLY_ACTIVE_ARCH
设置为NO
。通过传递这些参数,您可以强制采用正确的架构。请参阅此参考了解细节。
You have to set the
ONLY_ACTIVE_ARCH
toNO
if you wantxcodebuild
to use theARCHS
parameters. By passing these parameters, you can force the proper architecture.See this reference for details.
仅构建活动架构(ONLY_ACTIVE_ARCH)
是
- 为连接的设备构建具有单一架构的二进制文件否
- 为特定构建二进制文件-arch
(有效架构
又名VALID_ARCHS
)(如果已指定)或对于其他情况下的所有架构建议使用
Yes
用于调试(以节省构建时间),No
用于发布构建。注意:在模拟器上运行是安全的
要检查版本,请使用
lipo -info
[关于]Build Active Architecture Only(ONLY_ACTIVE_ARCH)
YES
- build binary with a single architecture for a connected deviceNO
- build binary for a specific-arch
(valid architectures
akaVALID_ARCHS
) if it was specified or for all the architectures in other casesThe recommendation is to use
Yes
for Debug (to save on build time) andNo
for Release build.Note: it is safe to run on simulator
To check the version use
lipo -info
[About]