简体   繁体   English

如何使用xcodebuild正确构建armv7静态库

[英]How to correctly build armv7 static library using xcodebuild

I am trying to build a static library to target armv7. 我正在尝试建立一个针对armv7的静态库。

I am using the following command in a bash script: 我在bash脚本中使用以下命令:

$XCODEBUILD -project 'MyLibrary.xcodeproj' -target "MyLibrary" -configuration 'Release' -sdk 'iphoneos7.0' clean build ARCHS='armv7 armv7s' IPHONEOS_DEPLOYMENT_TARGET='5.0' TARGET_BUILD_DIR='./build-arm' BUILT_PRODUCTS_DIR='./build-arm' 

I cannot link to the resulting lib. 我无法链接到生成的库。 I get linker error: 我收到链接器错误:

file was built for archive which is not the architecture being linked (armv7s): ~/MyProject/MyProject/libMyLibrary.a 该文件是为存档而不是要链接的体系结构(armv7s)构建的:〜/ MyProject / MyProject / libMyLibrary.a

Is something wrong with the way I am building the binary? 我构建二进制文件的方式有问题吗?

Any help would be appreciated. 任何帮助,将不胜感激。

Update The target that I am trying to build (the application linking to the lib) has the following settings: 更新我尝试构建的目标(链接到lib的应用程序)具有以下设置:

在此处输入图片说明

检查“构建设置”(针对您要构建的目标!)-确保将“ Architectures和“ Valid Architectures设置为相同的值。

Try setting ONLY_ACTIVE_ARCHS=NO in your command. 尝试在命令中设置ONLY_ACTIVE_ARCHS = NO。

See this post as well 也看到这个帖子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM