File was created for an archive that is not related to architecture (i386)

I need to create a static library. I want to use in my iPhone and ipad application. When I try to run the simulator, I get error binding. I am new to iOS development. kind help;

ld: warning: ignoring the file /Users/valuelabs/Desktop/DruvaProject/libraries/libnetUtils.a, the file was created for an archive that is not related to architecture (i386) Undefined characters for architecture i386:
"_OBJC_CLASS _ $ _ netUtils" referenced: objc-class-ref in ViewController.o ld: character not found for i386 architecture clang: error: linker command failed with exit code 1 (use -v to see the call)

I tried to add i386 in Architecture. but no luck

+65
ios iphone ipad
May 29 '12 at 16:35
source share
9 answers

After you encounter the same problem and follow all the accepted answers for updating build settings, clearing the linker search path, etc. Finally, I found an answer that worked for me.

Before creating, make sure you select the correct type (iPhone Simulator) instead of your iOS device. Then rebuild. Otherwise, you are trying to use the library created for the iOS device (arm processor) on the simulator on your mac (i386). It should be obvious, but it wasn’t.

Before:

iOS device settings

After:

iPhone 5.1 Simulator Settings

Now go to the "Products" group in the "Navigator"> right-click your static library (.a file)> Show in Finder, you will notice that it is in the Debug-iphonesimulator folder instead of Debug-iphoneos. I did not pay attention to the folder name initially, otherwise I might have thought of this before.

Hope this helps.

+65
Jan 03 '13 at 17:11
source share

Sometimes these types of errors annoy you!

Removing the source data for me:

Repair steps

1) In XCODE> Windows> Project> Select a project> Delete Derived Data> Close XCODE and open it again> If you get a MAC-O-Linker error message with an error> Refere this link> Clear and re-create.

+41
Jun 08 '15 at 5:36
source share

Your libnetUtils.a is created for a different architecture than your goal.

Check your libnetUtils build settings. The architectures for which it is being built and the list of supported architectures should be a (weak) superset of your target architecture. The difficulty here is that the resulting architecture is distributed according to various parameters: "Architecture", "Only build active architecture" and "Real architectures".

"Only built-in active architecture" makes this particularly confusing. For example, suppose you are building for a simulator. If “Build active architecture only” for Debug is set to NO, it will build all the architectures listed in “Architectures” and “Real architectures” (possibly armv7, etc.). But if libnetUtils has this setting set to Yes (Debug: Yes), it only builds for i386. Therefore, when your linker tries to link armv7 with the i386, it fails.

+24
Feb 06 '13 at 1:28
source share

If I get a warning about ignoring the file, I would lipo -info in the ignored file to find it as below,

 lipo -info libnetUtils.a 

This will print either i386, armv6, armv7, armv7s, x86_64, etc. In general, this architecture should fit your target build platform. For example.

  • i386 = ios simulator or 32-bit build on mac os x
  • armv6 armv7 arm7s = ios device
  • x86_64 = 64-bit on mac os x

Depending on the discrepancy, either you need to rebuild your library for the target platform, or change the target platform.

Note. For bold binaries, lipo -info print a combination of the above architectures.

+19
May 19 '14 at 6:22
source share

I don't know if my advice is correct, but try checking this out:

  • Choose your project
  • Select Build Settings
  • Check out the architecture:
    • Valid architectures must be "armv6 armv7"
    • Supported platforms should be "iphonesimulator iphoneos" (maybe an iPad, I don't know)
    • The base SDK is your iOS SDK (I have iOS 5.0).

Do not judge me if I am an obvious captain :)

+9
May 29 '12 at 16:50
source share

This means that the library you are trying to use has not been compiled for the iOS simulator (i386 characters for Mac). Running it on the device itself should work fine, though.

+5
May 29 '12 at 16:37
source share

Had the same problem and tried various solutions from the page to no avail. I still had a message stating that my library was not created for arm64.

Finally, as I resolved it:

  • opened the project.pbxproj file for the library in a text editor
  • searched for VALID_ARCHS
  • there were 4 entries, 2 of which did not contain arm64
  • I manually added arm64 to the chain (VALID_ARCHS = "arm64 i386 armv7 armv7s")
  • rebuild lib and everything was fine

It seems that the build settings displayed by Xcode are incomplete and do not correspond exactly to the project file.

+1
Oct 02 '14 at 14:41
source share

This problem does not occur when running the application on the device. You can verify it by running the code on your iOS device.

0
Jan 24 '17 at 15:38
source share

I also had armv7s architecture. I deleted it and made sure that only armv6 and armv7 were introduced. He is working now

-2
Feb 05 '13 at 15:32
source share



All Articles