简体   繁体   中英

How to correctly build armv7 static library using xcodebuild

I am trying to build a static library to target armv7.

I am using the following command in a bash script:

$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

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:

在此处输入图片说明

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

Try setting ONLY_ACTIVE_ARCHS=NO in your command.

See this post as well

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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