3

I'm trying to create a simple static library and add it into another project. I found several tutorials explaining how to do this, and it seems like each one is a little different. The most recent one I found seems to be the simplest, so that is the one I recreated.

When I try to build the project I'm accessing the library from, I get an "Apple Mach-O Linker Warning - Ignoring [my .a file], missing required architecture i386 in file [my .a file](2 slices)", as well as "Apple Mach-O Linker Error" twice. I'm guessing the problem is that it's ignoring my .a file, and that's whats causing the errors, so fixing the warning should take care of the errors too. Some of the users in that thread seem to have posted about this issue there, but it doesn't look like there's been any response as to how to fix it. Does anyone know what this tutorial is leaving out that is causing these errors?

GeneralMike
  • 2,951
  • 3
  • 28
  • 56

2 Answers2

1

xcode 4.5 doesn't support armv6, remove it and the the library file will be created...

https://developer.apple.com/library/mac/#releasenotes/DeveloperTools/RN-Xcode/_index.html

General: iOS This version of Xcode does not generate armv6 binaries. 12282156 The minimum deployment target is iOS 4.3. 12282166 In this Xcode release, Auto Layout is turned on for new user interface documents (storyboards and nib files). Because Auto Layout requires iOS 6.0, using such user interface documents on earlier iOS releases results in a crash or other undefined behavior. 12289644 For your app to run on earlier iOS releases, turn off Auto Layout in its user interface documents.

Bennya
  • 554
  • 5
  • 10
  • Just to be clear, you mean to remove it from the "Valid Architectures" list on the Build Settings tab for my library's target, right? If so, than it's not there; IIRC I didn't make my library until this version of Xcode, so it must have omitted it on its own when it created the project. – GeneralMike Oct 03 '12 at 12:31
  • Exactly, its better to check then to depend "on should be" – Bennya Oct 04 '12 at 18:52
  • by the way, you also need to check that the library projects is a **dependency** of your project and that the **library is included**... – Bennya Oct 04 '12 at 18:54
0

In your static library code, go to the project's target. Build Settings -> Architectures -> Valid Architectures, open the value and hit the "+" button and add "i386".

Make sure you do a full clean (command + alt + shift + K) and rebuild.

Copy your library back into your main project and compile it.

Let me know if that works.

Simon Germain
  • 6,834
  • 1
  • 27
  • 42
  • No joy. i386 wasn't in there yet, but adding it and doing the clean + rebuild + re-import didn't help. I still have the same errors. Thanks though! – GeneralMike Oct 01 '12 at 18:45