Problems linking static libraries in Xcode 4

10,067

Please check this question and answer. I encountered same problem and fixed it.

Xcode4 Linking Problem. File was built for archive which is not the architecture being linked (arm6)

Share:
10,067
ed94133
Author by

ed94133

Updated on June 04, 2022

Comments

  • ed94133
    ed94133 almost 2 years

    All was right in the world until I upgraded to Xcode 4 a few days ago. Since then I've had endless problems getting things to work as they should. And I have a crucial update I need to release. I've tried every permutation of settings I can think of, restarted, reinstalled Xcode, reverted to old versions of my files, everything.

    My project links to three static libraries, contained in three other projects. I have used the standard processes to link libraries (drag the project files into mine, add their products as target dependencies, add the lib---.a files to the Link Binary With Libraries phase). And actually, I have no problem compiling with the Debug Build Configuration, either for the simulator or my test device.

    Where everything goes sideways is when I compile with the Release Build Configuration, or when I try to Archive. I've gotten many different errors depending on my settings, but most are variations on this:

    ld: warning: ignoring file [...]/Build/Products/Debug-iphonesimulator/libGDataTouchStaticLib.a, file was built for archive which is not the architecture being linked (armv6) Undefined symbols for architecture armv6:
    "_OBJC_CLASS_$_GDataSpreadsheetData", referenced from: objc-class-ref in ExportViewController.o

    I can't understand why it's even looking at Products in the Debug-iphonesimulator directory (I swear, everything I'm linking to reveals itself in the Finder to be in the proper Release-iphoneos directory).

    I have put a ridiculous number of hours into fixing this, really need help! Thank you!