I'm using some external codes from google in my new Swift 2.0 project that required "libz.dylib" in earlier versions. After updating to the new XCode / the new SDK.
在我的新Swift 2.0项目中,我使用了一些来自谷歌的外部代码,这需要“libz”。在早期版本dylib”。更新到新的XCode /新的SDK。
XCode is now unable to import the libz.dylib and throws some errors
XCode现在无法导入libz。dylib并抛出一些错误。
Undefined symbols for architecture i386: "_deflate", referenced from: +[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) "_deflateEnd", referenced from: +[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) "deflateInit2", referenced from: +[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) "_inflate", referenced from: +[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) "_inflateEnd", referenced from: +[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) "inflateInit2", referenced from: +[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o) ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)
架构i386的未定义符号:“_deflate”,引用自:+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(gaicompressionlop .o)"_deflateEnd",引用自:+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(gaicompressionsionlsservice .)“deflateInit2”,引用自:+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(gaicompressionsionl .o)“膨胀”,引用自:+[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:]在libGoogleAnalyticsServices.a(gaicompressionlutil .o)"_inflateEnd",引用自:+[GAICompressionUtil gai_dataByInflatingBytes:length:以色列数据:]在libGoogleAnalyticsServices.a(gaicompressionlutil .o)“inflateInit2”,引用自:+[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:]在libGoogleAnalyticsServices.a(GAICompressionUtil.o) ld:没有找到架构i386 clang:错误:linker命令失败,退出代码1(使用-v查看调用)
When looking through the available packages in the "build phase" settings I can find "libz.tbd" which seems to be the replacement for the libz.dylib. When importing this lib the linker error stays the same but I get this additional warning:
在“构建阶段”设置中查看可用包时,我可以找到“libz”。tbd似乎是libz.dylib的替代品。在导入这个lib时,链接器错误保持不变,但我得到了额外的警告:
warning: skipping file '/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/usr/lib/libz.tbd' (unexpected file type 'text' in Frameworks & Libraries build phase)
警告:跳过文件' /应用程序/ Xcode-beta.app /内容/开发/平台/ iPhoneSimulator.platform /开发/ sdk / iPhoneSimulator9.0.sdk / usr / lib / libz。tbd(框架和库构建阶段中未预料的文件类型“文本”)
Any idea what to do?
你知道该怎么做吗?
8 个解决方案
#1
109
I had the same problem. I found some kind of way around.
我遇到了同样的问题。我找到了一些方法。
- Go to Build Phases >Link Binary with Librairies > + > Add other
- 去构建阶段>链接二进制与Librairies > + >添加其他。
- Once in the file selection window do "CMD"+Shift+G (Go to folder) and type /usr/lib/
- 一旦在文件选择窗口中执行“CMD”+Shift+G(转到文件夹)和类型/usr/lib/。
- From /usr/lib you can add : libz.dylib and more...
- 从/usr/lib可以添加:libz。dylib和更多…
- Compile and have fun
- 编译并玩得开心
#2
79
libz.dylib is now found under libz.tbd quote from the Apple developer forums:
libz。dylib现在在libz下找到。tbd引用苹果开发者论坛:
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.
对于那些好奇的人来说,.tbd文件是新的“基于文本的存根库”,它提供了一个更紧凑的存根库版本供SDK使用,并帮助大大减少了它的下载规模。
Hopefully more documentation will be coming soon.
希望很快就会有更多的文档出现。
edit
编辑
To clearify it, i will cite Guitz answer with the updated Content
为了使它更清晰,我将用更新后的内容引用Guitz的答案。
- Go to Build Phases >Link Binary with Librairies > + > Add other
- 去构建阶段>链接二进制与Librairies > + >添加其他。
- Once in the file selection window do "CMD"+Shift+G (Go to folder) and type /usr/lib/
- 一旦在文件选择窗口中执行“CMD”+Shift+G(转到文件夹)和类型/usr/lib/。
- From /user/lib you can add : libz.tbd and more...
- 从/user/lib可以添加:libz。tbd和更多…
- Compile and have fun
- 编译并玩得开心
#3
8
Remove all dynamic libraries (dylib) from the linking with binaries phase. It will find these libraries on its own.
从链接中删除所有动态库(dylib)。它将自己找到这些库。
#4
2
I have this problem in objective-c project.ios9.1,xcode7.1
我在objective-c项目中有这个问题,ios9.1,xcode7.1。
1.Go to Target> Build Phases >Link Binary with Librairies > +
1。去目标>构建阶段>链接二进制与Librairies > +。
2.select libz.tbd and add it
2。选择libz。tbd并添加它
It worked for me
它为我工作
#5
1
libz.dylib is the dynamic lib for Zlib, You can install Zlib from here http://zlib.net/
libz。dylib是Zlib的动态库,您可以从这里安装Zlib http://zlib.net/。
#6
0
You can add libz.1.dylib from location:/usr/lib/
您可以添加libz.1。从位置dylib:/ usr / lib /
- Go to Build Phases >Link Binary with Librairies > + > Add other
- 去构建阶段>链接二进制与Librairies > + >添加其他。
- Once in the file selection window do CMD+Shift+G (Go to folder) and type /usr/lib/
- 在文件选择窗口中,执行CMD+Shift+G(转到文件夹)和类型/usr/lib/。
- From /user/lib you can add : libz.1.dylib
- 从/user/lib可以添加:libz.1 dylib。
It worked for me.
它为我工作。
#7
0
You can also add the lybz.dylib
from "Other Linker Flags" in the Build Settings by adding the argument -lz
.
你也可以添加lybz。通过添加参数-lz,在构建设置中从“其他链接器标志”中删除dylib。
I had to do this because, using the method where you reference the library from /usr/lib, when I deployed my app to our testers the .dylib library could not resolve and caused the app to crash on launch.
我必须这样做,因为我使用了从/usr/lib中引用库的方法,当我将我的应用程序部署到我们的测试人员时。dylib库无法解析并导致应用程序在启动时崩溃。
#8
-2
Meanwhile you can use previous SDK. This is my answer for libsqlite3:
与此同时,您可以使用以前的SDK。这是我对libsqlite3的回答:
https://*.com/a/30981161/627794
https://*.com/a/30981161/627794
Edit: (link content added)
编辑(链接内容添加):
Open terminal, type (change to your desired library, e.g. libz)
打开终端,键入(更改到您想要的库,例如libz)
locate libsqlite3.dylib
You'll find several files like these:
你会发现几个这样的文件:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libsqlite3.dylib
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libsqlite3.dylib
Go to your project's setting -> Build Phases -> Link with Binaries. Add BOTH files by clicking +
, then Add Other
. Hit Cmd-Shift-G
, and copy-paste the file path. Click Open
.
进入项目的设置->构建阶段->链接与二进制文件。通过点击+添加两个文件,然后添加其他文件。点击Cmd-Shift-G,复制粘贴文件路径。单击Open。
If you install sqlite3 using macports, remove /opt/local/lib
from Library Search Path in Build Settings.
如果使用macports安装sqlite3,在构建设置中从库搜索路径中删除/opt/local/lib。
#1
109
I had the same problem. I found some kind of way around.
我遇到了同样的问题。我找到了一些方法。
- Go to Build Phases >Link Binary with Librairies > + > Add other
- 去构建阶段>链接二进制与Librairies > + >添加其他。
- Once in the file selection window do "CMD"+Shift+G (Go to folder) and type /usr/lib/
- 一旦在文件选择窗口中执行“CMD”+Shift+G(转到文件夹)和类型/usr/lib/。
- From /usr/lib you can add : libz.dylib and more...
- 从/usr/lib可以添加:libz。dylib和更多…
- Compile and have fun
- 编译并玩得开心
#2
79
libz.dylib is now found under libz.tbd quote from the Apple developer forums:
libz。dylib现在在libz下找到。tbd引用苹果开发者论坛:
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.
对于那些好奇的人来说,.tbd文件是新的“基于文本的存根库”,它提供了一个更紧凑的存根库版本供SDK使用,并帮助大大减少了它的下载规模。
Hopefully more documentation will be coming soon.
希望很快就会有更多的文档出现。
edit
编辑
To clearify it, i will cite Guitz answer with the updated Content
为了使它更清晰,我将用更新后的内容引用Guitz的答案。
- Go to Build Phases >Link Binary with Librairies > + > Add other
- 去构建阶段>链接二进制与Librairies > + >添加其他。
- Once in the file selection window do "CMD"+Shift+G (Go to folder) and type /usr/lib/
- 一旦在文件选择窗口中执行“CMD”+Shift+G(转到文件夹)和类型/usr/lib/。
- From /user/lib you can add : libz.tbd and more...
- 从/user/lib可以添加:libz。tbd和更多…
- Compile and have fun
- 编译并玩得开心
#3
8
Remove all dynamic libraries (dylib) from the linking with binaries phase. It will find these libraries on its own.
从链接中删除所有动态库(dylib)。它将自己找到这些库。
#4
2
I have this problem in objective-c project.ios9.1,xcode7.1
我在objective-c项目中有这个问题,ios9.1,xcode7.1。
1.Go to Target> Build Phases >Link Binary with Librairies > +
1。去目标>构建阶段>链接二进制与Librairies > +。
2.select libz.tbd and add it
2。选择libz。tbd并添加它
It worked for me
它为我工作
#5
1
libz.dylib is the dynamic lib for Zlib, You can install Zlib from here http://zlib.net/
libz。dylib是Zlib的动态库,您可以从这里安装Zlib http://zlib.net/。
#6
0
You can add libz.1.dylib from location:/usr/lib/
您可以添加libz.1。从位置dylib:/ usr / lib /
- Go to Build Phases >Link Binary with Librairies > + > Add other
- 去构建阶段>链接二进制与Librairies > + >添加其他。
- Once in the file selection window do CMD+Shift+G (Go to folder) and type /usr/lib/
- 在文件选择窗口中,执行CMD+Shift+G(转到文件夹)和类型/usr/lib/。
- From /user/lib you can add : libz.1.dylib
- 从/user/lib可以添加:libz.1 dylib。
It worked for me.
它为我工作。
#7
0
You can also add the lybz.dylib
from "Other Linker Flags" in the Build Settings by adding the argument -lz
.
你也可以添加lybz。通过添加参数-lz,在构建设置中从“其他链接器标志”中删除dylib。
I had to do this because, using the method where you reference the library from /usr/lib, when I deployed my app to our testers the .dylib library could not resolve and caused the app to crash on launch.
我必须这样做,因为我使用了从/usr/lib中引用库的方法,当我将我的应用程序部署到我们的测试人员时。dylib库无法解析并导致应用程序在启动时崩溃。
#8
-2
Meanwhile you can use previous SDK. This is my answer for libsqlite3:
与此同时,您可以使用以前的SDK。这是我对libsqlite3的回答:
https://*.com/a/30981161/627794
https://*.com/a/30981161/627794
Edit: (link content added)
编辑(链接内容添加):
Open terminal, type (change to your desired library, e.g. libz)
打开终端,键入(更改到您想要的库,例如libz)
locate libsqlite3.dylib
You'll find several files like these:
你会发现几个这样的文件:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libsqlite3.dylib
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libsqlite3.dylib
Go to your project's setting -> Build Phases -> Link with Binaries. Add BOTH files by clicking +
, then Add Other
. Hit Cmd-Shift-G
, and copy-paste the file path. Click Open
.
进入项目的设置->构建阶段->链接与二进制文件。通过点击+添加两个文件,然后添加其他文件。点击Cmd-Shift-G,复制粘贴文件路径。单击Open。
If you install sqlite3 using macports, remove /opt/local/lib
from Library Search Path in Build Settings.
如果使用macports安装sqlite3,在构建设置中从库搜索路径中删除/opt/local/lib。