2
votes

lipo -info libXxxx.a Architectures in the fat file: libXxxx.a are: armv7 i386 arm64

But compiler in the dependant project is giving linking error,

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_ClassXXXX", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Am I missing something? All the lib project's target have Architectures: Standard Architectures (armv7, arm64) and Valid Architectures arm64, armv7, armv7s

in my lipo command while making universal binary I am lipo-ing both from iphonesimulator and iphoneos folder.

2
as you are lipo-ing both for iphonesimulator and iphoneos folder to create a fat file is correct, but it does not have support for architecture x86_64, see the posted answerSanjay Mohnani

2 Answers

0
votes

Your main clue is that it says "symbol(s) not found for architecture x86_64" instead of "symbol(s) not found for architecture i386".

The fix is to tweak your build settings to allow a 32-bit build.

1) Select your project file in the Project Navigator (the left sidebar)

2) Select your project's target (first entry under TARGETS in the panel that just came up)

3) Find the "Architectures" setting (make sure "All" is selected if you can't find "Architectures")

4) Change it from "Standard Architectures" to "Universal" (or explicitly "32-bit" if you prefer)

You should be able to build after doing this.

0
votes

You need to create a universal binary including following architectures in your static library project. The architectures should be including 64-bit, armv7, armv7s, arm64.

Now when you do a lipo -info anyStaticLibrary.a on terminal - you should see armv7 armv7s i386 x86_64 arm64 architectures for your fat binary.

Also note that the project which uses the above static library can work fine with the default settings of the architectures.