Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcode7 ios9 about libz.tbd is not an object file (not allowed in a library)

Tags:

Error:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/usr/lib/libz.tbd is not an object file (not allowed in a library)

If I replace libz.dylib with libz.tbd, xcode shows this bug. My project is a Cocoa Touch Static Library.

like image 418
Appfame Appfame Avatar asked Sep 23 '15 08:09

Appfame Appfame


2 Answers

I found the solution here: https://forums.developer.apple.com/thread/4572

To summarize:

  1. Remove the libz.tbd file from the Libraries and Frameworks area.
  2. Edit your build settings for Other Linker Flags add "-lz"

It isn't ideal because it bypasses the GUI for managing the linked libraries in your project, but it works.

like image 179
mikepj Avatar answered Sep 17 '22 15:09

mikepj


The below steps solved the issue. Reference solution

As per this article:

  1. Delete all references to .tbd files from either your linked libraries phase, or from the copied bundle resources phase (where they sometimes will be added).
  2. Go to Build Phases >Link Binary with Librairies > + > Add other -> Add a library to your project, then click 'Add Other...' then press Shift+Command+G and type in the path '/usr/lib' - you'll find libz.dylib there.
  3. add "-lz" to the other linker flags
like image 43
Saikiran Komirishetty Avatar answered Sep 17 '22 15:09

Saikiran Komirishetty