How to link to libz and libsqlite in xcode 7 beta?

笑着哭i 提交于 2020-01-01 17:09:53

问题


I got linkage error like:

   +[WeChatApiUtil DecodeBase64:] in libWeChatSDK.a(WeChatApiUtil.o)
  "_deflate", referenced from:
      +[MTAWXOHelper GZip:Out:] in libWeChatSDK.a(MTAWXOHelper.o)
  "_deflateEnd", referenced from:
      +[MTAWXOHelper GZip:Out:] in libWeChatSDK.a(MTAWXOHelper.o)
  "_deflateInit2_", referenced from:

But I've already added those library to my target. But currently all those library have different extension .tbd.

Any idea? Thanks.


回答1:


There is a known issue in XCode 7 while linking tbd files. Here is the link to the apple developer forum answer on how to link tbd files in XCode 7 - https://forums.developer.apple.com/message/8609#8609

[Snippet from the link is available below]

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 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.




回答2:


I have two project using zlib, one which finds it to link, one which doesn't. I set them both up by using the "+" in "Linked Frameworks and Libraries". I finally figured out how to fix the non-working one:

  1. Remove all links to zlib that you added in previous attempts
  2. Open Finder, head to /usr/lib, and drag the libz.dylib alias into your project's Frameworks folder
  3. Compile. This worked on 2015/08/23 for me.


来源:https://stackoverflow.com/questions/30859416/how-to-link-to-libz-and-libsqlite-in-xcode-7-beta

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!