0

I'm trying to include a static library in an iOS project. I imported the .a file and every .h related but then I'm getting this error :

ld: warning: ignoring file /Users/alexis/Library/Developer/Xcode/DerivedData/PlazappPartnerWorkspace-            cdrmloavlcqouugawmtqywiinqne/Build/Products/Debug-iphoneos/libPlazappPartnerLib.a, file was built for archive which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_LauncherViewController", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I guess there's a problem of architecture type but I don't understand why nor how to solve it. Can someone explain it to me and tell me how to solve it? Thanks!

1 Answer 1

1

It seems your library was built to run in the device (arm architecture) and you try to use it in the simulator (i386 architecture). Check your library build settings. They should match with your project build settings.

Or even better, create a fat library for development purposes. lipo command is your friend.

To verify the current architectures present in your library: (in Terminal)


    cd <path to library folder> # in you case: /Users/alexis/Library/Developer/Xcode/DerivedData/PlazappPartnerWorkspace-            cdrmloavlcqouugawmtqywiinqne/Build/Products/Debug-iphoneos
    lipo -info libPlazappPartnerLib.a

The output should look like:

Architectures in the fat file: libPlazappPartnerLib.a are: armv6 armv7

They should match with the target device or simulator you are building for.

Sign up to request clarification or add additional context in comments.

3 Comments

I already checked every settings and tried with both .a files located in iphoneos and in iphonesimulator but that didn't change anything.
Check the architectures for the library mentioned in the error message (see my updated answer). Also, check the search library paths. If you have several copies around, Xcode may pick the wrong one if the wrong path is set.
I checked the architectures with lipo like you said. I probably made a mistake before, it works now. Thanks for your help!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.