How do I link against .tbd files in Xcode 7?

I need to link libz in my project. Normally I would add libz.dylib under the Linked Frameworks and Libraries settings, but now there are only .tbd files and no .dylib files when you search the list of libraries to add. When building I get a "warning: skipping file '/Users/me/xcode7/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/usr/lib/libz.tbd' (unexpected file type 'text' in Frameworks & Libraries build phase)"
Then I build fails with linker errors because of missing symbols. Am I missing something new in the way libraries are linked?

Answered by in 9366022

This is a known issue in the Xcode 7 beta.


To work around this issue for now, please:

  • 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).
  • Add the library you want to link manually to the "Other Linker Flags" build settings, by adding the argument:

-l<library_name>

for each library you want to link (for example, add "-lsqlite3" (without quotes)).


For those who are curious, the .tbd files are new "text-based stub libraries", that provide a much more compact version of the stub libraries for use in the SDK, and help to significantly reduce its download size.

I am having the same issue, I tried upgrading to Beta 7.1 but that did not help

On step 3 I tried to add libz.dylib, but got libz.1.dylib somehow. I already tried 10 times, nothing changes. Also I tried manually drag and drop it to the project, it appears as libz.dylib, but I still get same errors. Adding "-lz" to linker flags did nothing. Clearing project didn't work either. It is blowing my mind currently.

Me too.. Anyone has a new (working) fix?

Me too. But I can build on simulator just not on device. Anyone has a solution?

I have the same problem. Works fine on simulator but not on device.

The /usr/lib/libz.dylib is only for i386 or x86_64 (i.e. the emulator) and not for arm. You need to go via the SDK path. Xcode 7.0.1 should work on El Capitan with .tbd files.


Cheers, Fons.

Unfortunately, this problem still persists with OSX 10.11 El Capitan and Xcode 7.0.1 (7A1001).

Why is this still not fixed?

Still not working in Xcode 7.1 official. I used the -l technique and its working on the Simulator at least. Wow - this problem has been around since June???

This is preventing me from building Qt (Xcode 7.2 release, MacOSX10.11 sdk). I'll try to work around it, but Qts build system is... special.

Did you manage to fix this as I'm having the same issue

i think this problem not caused by xcode version. i was using osx 10.11.5 and latest xcode, everything working good after update to osx 10.11.6 libxml2 stop to compile just work on simulator


Edit: All things change update xcode7.2 to xcode7.3. It is working on xcode7.2. And problem stills on xcode8.0

Push: Do we have a "best Practice" for CommonCrypto as of Xcode 8 Beta 3?


I would like to link to CC in a Framework, and all my attempts don't seem clean, or don't work with CocoaPods (which I would like to keep working).

I register this forum for giving my thanks to this reply!

Code Block
ld -L /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem

This links the text based dynamic libraries that should work on all machO platforms.
How do I link against .tbd files in Xcode 7?
 
 
Q