I got a few static libraries I want to use in my iphone app. When I try to run the simulator I get linking errrors. I am new to iOS development, and I ran into this problem when linking against libraries I built previously;
file was built for archive which is not the architecture being linked (i386)
Which means all the functions I reference from those libraries gives me this:
undefined symbols for architectyre i386
I am not sure what to configure to make this right. The static libraries are build for armv7, supporteed platforms armv6 armv7.
I sorted a very similar error with a static library I was building for iPad. I believe my solution was to add "i386" to the Architectures setting for the project (Click on the Project -> Build Settings -> Architectures --or was it Valid Architectures?-- and click the '+' icon, type "i386" in the highlighted line). Anywho that should get you close.
Oh, one more caveat, I've read that we should set "Build Active Architecture Only" to "No" as well. It was already set for me, but that's something you might want to check.
After struggling with this same problem and following all the accepted answers of updating build settings, clearing the linker search path, etc.. I finally discovered an answer that worked for me.
Before building, make sure you select right type (iPhone Simulator) instead of iOS Device. Then rebuild. Otherwise, you're trying to use a library built for an iOS device (arm processor) on a simulator (i386). Should've been obvious, but wasn't.
Before:
After:
Now, look in the Products group in the Navigator > right click your static library (.a file) > Show in Finder, you'll notice that its in a Debug-iphonesimulator folder instead of Debug-iphoneos. I didn't pay any attention to the folder name originally, or I might have thought of this sooner.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With