ignoring file [path] missing required architecture i386 in file

24,218

Solution 1

This warning means that you're trying to use library made for Device (ARM) with your Simulator (i386).

You can use this terminal command to create a universal library:

lipo -create lib_arm.a lib_i386.a -output lib_universal.a

More info about lipo command here.

Solution 2

Change your target's "Build Settings > Build Active Architectures Only" to "No"

This is doing the same thing as Dmitry Zhukov's answer but doing it thru Xcode instead of going around its back.

Solution 3

If you are working with a 3rd party code, keep in mind that some SDKs may not work on the simulator. The same build error I have encountered vanished, when I ran the project on the device.

Share:
24,218

Related videos on Youtube

U_D
Author by

U_D

SOreadytohelp

Updated on June 15, 2020

Comments

  • U_D
    U_D almost 4 years

    I'm quite new to Xcode and Iphone development and ran into the following problem:

    I opened a new project and added *.h and a *.a files (which I recived from a certain device vendor). I get the following warning:

    ld: warning: ignoring file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a, missing required architecture i386 in file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a (2 slices)

    If I ignore the warning, and try to instanciate the class that is given to me in the header file, I get these errors:

    ld: warning: ignoring file [Path/FileName.a], missing required architecture i386 in file [Path/FileName.a] (2 slices)

    Undefined symbols for architecture i386:

    "_OBJC_CLASS_$_HRMonitor", referenced from:

    objc-class-ref in ViewController.o

    ld: symbol(s) not found for architecture i386

    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    I've checked the Framework Search Pathes (as mantioned in many other posts) and it clear.

    More info:

    1. I'm Using Xcode 4.6.1
    2. The files are currently located at project's root folder.
    3. I'm using a Single View Application tamplate.

    Appreciate any help

  • Dmitry Zhukov
    Dmitry Zhukov about 11 years
    I'm glad this helped you :)
  • Dani
    Dani over 10 years
    I guess the libraries need to exist for both armv7 and i386, right ?
  • shim
    shim over 10 years
    Got "can't open input file: lib_arm.a (No such file or directory)" Is there a specific spot where you're supposed to run this command?
  • Dmitry Zhukov
    Dmitry Zhukov over 10 years
    @shim, you should change directory to the one, where your static libs (arm and i386) are, like this: $ cd /libs/ $ lipo -create name_of_your_arm_lib.a name_of_your_386_lib.a -output lib_universal.a
  • tommy
    tommy over 10 years
    @ Dmitry Zhukov can you show me how can I know the directory of my static libs , because i met the same error like Shim
  • Dmitry Zhukov
    Dmitry Zhukov over 10 years
    @tommy lipo makes universal lib from libs with specific arch_types (or vice versa) and lib_arm.a here is just a placeholder. You can use your_lib_name.a if specific libs are located in same folder, or you can just use path_to_your_lib/your_lib.a. Hope this helps.
  • Ans
    Ans about 10 years
    My bad .. I was trying to run on simulator instead of device. Didn't change anything and just run my application over my iPad and everything is good.
  • Jorgen
    Jorgen about 10 years
    I have a BluetoothManager.framework in my app, with the two .h files included. App runs well on iPad but I get the i386 error when I try it on the simulator. Can't finsd a way around.
  • Abhishek Sharma
    Abhishek Sharma almost 6 years
    @Jorgen did you find any solution for same.? I have case where I have .framework and facing same issue.