Search code examples
ios7xcode6cocoapodszipzap

XCode 6.4 breaks Project with zipzap dependency


Up until I upgraded to XCode 6.4 the project was working fine but after the upgrade I have boiled down the build failure to zipzap.

Using CocoaPod 0.37.2

pod 'zipzap', '~> 8.0'

Linked Frameworks and Libraries = libz.1.2.5.dylib

Targeting iOS 7.0 +

Build Failure

Undefined symbols for architecture arm64:
  "___cxa_begin_catch", referenced from:
      ___clang_call_terminate in libPods-Ally-zipzap.a(ZZArchive.o)
  "std::terminate()", referenced from:
      ___clang_call_terminate in libPods-Ally-zipzap.a(ZZArchive.o)
  "___gxx_personality_v0", referenced from:
      +[ZZArchive archiveWithURL:error:] in libPods-Ally-zipzap.a(ZZArchive.o)
      +[ZZArchive archiveWithData:error:] in libPods-Ally-zipzap.a(ZZArchive.o)
      -[ZZArchive initWithURL:options:error:] in libPods-Ally-zipzap.a(ZZArchive.o)
      -[ZZArchive initWithData:options:error:] in libPods-Ally-zipzap.a(ZZArchive.o)
      -[ZZArchive initWithChannel:options:error:] in libPods-Ally-zipzap.a(ZZArchive.o)
      -[ZZArchive loadCanMiss:error:] in libPods-Ally-zipzap.a(ZZArchive.o)
      -[ZZArchive updateEntries:error:] in libPods-Ally-zipzap.a(ZZArchive.o)
      ...
ld: symbol(s) not found for architecture arm64

Things I have done so far

  1. For both the Project and the Pods project: Build Settings > C++ Standard Library = libstdc++ (originally was libc++)
  2. couple of times pod deintegrate && rm *.lock && pod install

Solution

  • I've experienced this issue as well - the ZipZap podspec has been updated losing a number of compiler flags in the process:

    https://github.com/pixelglow/ZipZap/commit/0e4e6aa885196640ca86462c6748e68a50c66ee9

    The way I resolved this in my project was to restore the compiler flags (that were present before the update) as follows:

    • Navigate to the Pods project in your workspace
    • Select the Pods-zipzap target
    • Select the Build Phases tab
    • Expand the Compile Sources section
    • Select all the Objective-C++ files (with the extension .mm) - hold the CMD key to select multiple files
    • Add the compiler flags: -fno-objc-exceptions -fno-exceptions -std=c++11 -stdlib=libc++ -DOS_OBJECT_USE_OBJC=0
    • Select all Objective-C files (.m) except Pods-zipzap-dummy.m
    • Add the compiler flags: -fno-objc-exceptions -std=c99 -DOS_OBJECT_USE_OBJC=0
    • Select the one C++ file (.cpp)
    • Add the compiler flags: -fno-exceptions -std=c++11 -stdlib=libc++ -DOS_OBJECT_USE_OBJC=0

    If you have a test target you will likely need to add the same flags there as well. All being well you should now be able to build again.

    [Update]: Upgrading Cocoapods to version 0.38.0 will also resolve the errors but may result in compile errors currently with ZipZap 8.0.4 - see https://github.com/pixelglow/ZipZap/issues/105.

    Alternatively, you could rollback to ZipZap 8.0.3 in your Podfile.