5

I have an issue when trying to use an external lib : I can't compile the project as it throws an exception as below.

ld: warning: ignoring file /Users/renaudcousin/Documents/XCode/WORK/StimShopPOC/StimShopPOC/libStimshop_SDK.a, missing required architecture x86_64 in file /Users/renaudcousin/Documents/XCode/WORK/StimShopPOC/StimShopPOC/libStimshop_SDK.a (3 slices) Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_StimshopSDK", referenced from: objc-class-ref in ViewController.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)`

I tried lots of solutions found on stackoverflow (but for XCode 5.1 and not as well explained) without any change ...

I also found this topic XCode 6.1 Missing required architecture X86_64 in file that exactly correspond to my problem and when looking at my lib's architecture with lipo -info command, it seems it's missing i386 and x86_64. How could I add them to my library architectures to be able compile ?

Community
  • 1
  • 1
Renaud Cousin
  • 114
  • 1
  • 1
  • 6

4 Answers4

11

This means your .a library doesn't contain the x86_64 architecture (You can run lipo -info /path/to/your/lib.a to verify it). If you don't have the source code of the library, you have to modify your own project. In the build settings, change the valid architectures to armv7 and i386, or change Architectures to armv7 only. However, by doing so, your project won't be compiled to the arm64 architecture, which is required when uploading to the App Store after Feb 2015, according to Apple's announcement.

If your library doesn't contain x86_64 architecture, it is likely that it doesn't contain arm64 either. So you should avoid using old libraries.

Henry H Miao
  • 3,420
  • 4
  • 20
  • 26
  • I know, I already test the `lipo -info` command and it miss `i386` and `x86_64` architectures. But I can't avoid using this lib, it's a request from my managers to create a prototype app ! – Renaud Cousin Nov 28 '14 at 10:19
  • Also tried to set `valid architecture` to `armv7` and `i386`, or `architecture` to `armv7` but it only change my problem as my lib doesn't include `i386` architecture. – Renaud Cousin Nov 28 '14 at 10:28
  • If the .a file doesn't include both i386 and x86_64 architecture, it cannot be linked to the app that used by iPhone simulator. In this case, whatever you do, you'll get compiler errors when you try to compile for the simulator. The only thing you can do is to ask for a x86 version, or debug your app in your real device. – Henry H Miao Nov 28 '14 at 11:34
  • You should notice that iPhone simulator uses the x86 architecture, not the arm one. – Henry H Miao Nov 28 '14 at 11:37
  • Yes, thanks. This is what I saw. But I for now I'm trying to compile directly on a device and always get some errors from architecture ... I'm waiting the lib's developer for a new version. Thanks all for your replies :) – Renaud Cousin Nov 28 '14 at 13:08
7

If a library doesn't have the X86_64 architecture you can build it if you've picked a connected device rather than a simulator for your build target.

Basically, you can still build and develop but you can't use the simulator.

Chris
  • 955
  • 15
  • 20
3

Click on your project > build setting > architecture. Change architecture as armv7 and delete others like armv6,etc, Then it will work :- Image where change is required

shubham mishra
  • 971
  • 1
  • 13
  • 32
1

In the project that builds libStimshop_SDK.a, be sure the "Architectures" setting is set to $(ARCHS_STANDARD) and that it includes 64-bit settings in the compiler settings. Be sure the "Valid Architectures" setting includes 64-bit as well.

Walt Sellers
  • 3,806
  • 30
  • 35
  • I already tried that but it doesn't change anything. Also tried `ARCHS_STANDART_INCLUDING_64_BITS` and adding `armv7s` – Renaud Cousin Nov 28 '14 at 10:16
  • Is libStimshop_SDK.a being built as a subproject so it builds when the app builds? If not, you'll have to create a "fat" binary as detailed here: http://stackoverflow.com/questions/19010870/fat-libraries-in-xcode-5 NOTE: the two projects need to have configurations with the same names. – Walt Sellers Nov 28 '14 at 10:45