1

I am trying to recompile someone else's code. The code includes a reference to a third party library myLib.a, which has two slices:

Architectures in the fat file: myLib.a are: armv7 arm64 

I get this warning, following by a bunch of link errors:

ld: warning: ignoring file myLib.a, missing required architecture x86_64 in file myLib.a (2 slices)

Now, I know this library is not intended to work in a simulator. So I want to throw the simulator away from build. I don't really understand build targets, so I did this:

enter image description here

Still, same error. What am I doing wrong?

Xcode 7.3

Irina Rapoport
  • 1,404
  • 1
  • 20
  • 37
  • try adding armv7s or armv6s – vaibby Apr 01 '16 at 06:00
  • Tried adding armv7s. Now it says " file was built for archive which is not the architecture being linked (i386)". Hmm... what's going on? Why would adding armv7s have this effect? – Irina Rapoport Apr 01 '16 at 06:05
  • i think u r trying on simulator. try on device. or delete Derived Data and clean project – vaibby Apr 01 '16 at 06:07
  • Not sure what you mean when you say I am trying on simulator. I am doing Product > Clean, then Product > Build. Is it what you meant? This is a remote computer, macincloud.com, so trying it on device is not easy, but I certainly want to turn off the simulator. – Irina Rapoport Apr 01 '16 at 06:16
  • Tried deleting derived data, same result – Irina Rapoport Apr 01 '16 at 06:16
  • I answered this question here: https://stackoverflow.com/a/65307436/5303139 – JhonnyTawk Dec 15 '20 at 14:41

2 Answers2

3

I answered this question here: https://stackoverflow.com/a/65307436/5303139

Same anwser

For an iOS project, you have the following architectures: arm64 armv7 armv7s i386 x86_64

x86_64, i386 are used for the simulator.

What could be your problem is the framework you are using was build for iOS and not a simulator.

To fix this issue you can bypass the build framework and use lipo command lines.

First: lipo -info [The library.framework location]

Example Usage : lipo -info /Users/.../library.framework/LibrarySDK

Example output :

Architectures in the fat file: /Users/.../library.framework/LibrarySDK are: i386 x86_64 armv7 arm64 

You will get the list of architecture used for that framework.

Second: we need to strip the framework from the simulator architecture and make 2 versions of that framework (1 is used for iOS Device and 1 for the simulator)

using: lipo -remove [architecture] [location] -o [output_location]

Example: lipo -remove i386 /Users/.../SDK -o /Users/.../SDK_Output_Directory

Go to your chosen output directory to get the new generated SDK without the removed architecture to verify you can use the lipo -info command same as above

You can use the same lipo remove command on the newly created SDK but with another architecture lipo -remove x86_64 ... and you will get an SDK only for iOS devices

Third: Take that final SDK and rename it "SDK_Name_IOS" and use it.

Happy coding!!

JhonnyTawk
  • 834
  • 11
  • 23
2

You did set architect to armv7, arm64 so just change Build Active Architecture Only to YES in debug mode:

debug mode: YES

release mode: NO (default value)

So when debug you will build only for current device

larva
  • 4,687
  • 1
  • 24
  • 44