Question

I have created a static library and added an aggregated target to build a .framework static framework so I can release to the users.

I have to use PLCrashReporter to this static library so I downloaded the latest version 1.2 beta 2 since ARM64 support is added and added the .xcodeproj file in a group inside my static library. Added the User Header Search Paths in the build settings of the static library target, in build phases added in Target Dependencies the CrashReporter-iOS-Device (CrashReporter) static library and Link Binary With Libraries added the libCrashReporter-iphoneos.a static library.

My static library builds successfully all the targets with no problem, but when it comes to adding my .xcodeproj project as a dependency in a UI client test project or even adding directly the .framework that I generate, the build for the simulator breaks.

I can run it on a device and work properly but it is major to use it in a simulator too.

If I hit build I get the following errors.

Undefined symbols for architecture i386:
  "std::terminate()", referenced from:
      ___clang_call_terminate in libReporter-iOS.a(PLCrashSignalHandler.o)
      ___clang_call_terminate in libReporter-iOS.a(PLCrashAsyncImageList.o)
  "___cxa_begin_catch", referenced from:
      ___clang_call_terminate in libReporter-iOS.a(PLCrashSignalHandler.o)
      ___clang_call_terminate in libReporter-iOS.a(PLCrashAsyncImageList.o)
  "___gxx_personality_v0", referenced from:
      Dwarf Exception Unwind Info (__eh_frame) in libReporter-iOS.a(PLCrashSignalHandler.o)
      Dwarf Exception Unwind Info (__eh_frame) in libReporter-iOS.a(PLCrashAsyncImageList.o)
      Dwarf Exception Unwind Info (__eh_frame) in libReporter-iOS.a(PLCrashSignalHandler.o)
      Dwarf Exception Unwind Info (__eh_frame) in libReporter-iOS.a(PLCrashAsyncImageList.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I miss something for sure here!

Thank you in advance.

Was it helpful?

Solution

It looks like the i386 architecture is missing from libCrashReporter-iphoneos.a (The name of that file also suggests that it's for device only). Try to run lipo -info libCrashReporter-iphoneos.a to see if all the required architectures are there, if the i386 (required for simulator) is not there, you have to find the lib for i386 (or build it if you are building it yourself) and use lipo -create lib-iphoneos.a lib-iphonesimulator.a -output lib-all.a to create a library with all required architectures.

P.S. I have just downloaded the latest build from https://www.plcrashreporter.org and it seems like the CrashReporter.framework in iOS Framework contains armv7, armv7s and i386, so you might try that if you don't require arm64 and x86_64.

EDIT: see this for arm64 support (it's a beta from September).

EDIT2: I didn't pay attention to the std::terminate() at first, so if all the required architectures are there you might have to add libstdc++ to the Linked Frameworks and Libraries.

OTHER TIPS

By the way.. can be useful to others..

the same settings: -lstdc++ in linker flags may solve similar headache for using MySQL in C/C++ in Xcode in OSX. in fact when you link against libmysqlclient.a or libmysqlclient.dylib, you get the same error.

It has been broken in respect to previous installation of mysql.

verify to have:

//:configuration = Debug OTHER_LDFLAGS = -lstdc++

//:configuration = Distribution OTHER_LDFLAGS = -lstdc++

//:completeSettings = some OTHER_LDFLAGS

Hope this can help.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top