2

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:

enter image description here

Nick
  • 19,198
  • 51
  • 185
  • 312

2 Answers2

3

Check Build Settings (for the target you are trying to build!) - make sure that both Architectures and Valid Architectures are set to the same values.

Kendall Helmstetter Gelner
  • 74,769
  • 26
  • 128
  • 150
  • Thanks for the suggestion. Architectures was set to Standard(Including 64)armv7, armv7s, arm64. I tried setting this and Valid Architectures to only include armv7 and armv7s but the problem persists. – Nick Dec 16 '13 at 20:17
  • You want them the same, not different. Did you try also setting "Valid Architectures" to include arm64? Alternately, did you try setting both to not include arm64? – Kendall Helmstetter Gelner Dec 16 '13 at 20:28
  • I updated with a screen shot showing my settings. This is what you were suggesting right? – Nick Dec 16 '13 at 20:40
  • 1
    I was editing the build settings for the application which is linking to my static lib. I made the same edits to the static lib's settings and it worked. Thanks a lot for the the help! – Nick Dec 16 '13 at 20:43
  • Aha! That is why I included "for the target you are trying to build", because it's easy to forget you are editing a different target than what you are building! – Kendall Helmstetter Gelner Dec 17 '13 at 21:36
1

Try setting ONLY_ACTIVE_ARCHS=NO in your command.

See this post as well

Community
  • 1
  • 1
foggzilla
  • 1,705
  • 11
  • 15