libz.dylib 与 libz.1.2.3.dylib 与 libz.1.2.5.dylib

发布于 2024-11-27 22:11:27 字数 538 浏览 1 评论 0原文

我在评论中问过这个问题,但这似乎是一个值得单独提问的问题。

我有一个项目在三个不同的 XCode 安装和两个不同的 iOS SDK 安装之间共享。目前,联合相关开发人员还不是一个选择。

当我安装 iOS 5 Beta 和 XCode 4.2 时,找不到 libz.1.2.3.dylib 。我发现链接 libz.1.2.5.dylib 可以解决这个问题,但这与 XCode 和 iOS SDK 的其他活动安装不兼容。

我在线研究了这一点,发现了上述建议和这个建议。前者对我不起作用,后者让我紧张。

那么 libz.dyliblibz.1.2.3.dyliblibz.1.2.5.dylib 之间有什么区别,我可以安全地链接吗到所有 XCode 和 iOS SDK 安装中的第一个?

I asked this in a comment but this seems like an issue that deserves its own question.

I have a project that's shared between three different installations of XCode and two different installations of the iOS SDK. At the moment unifying the developers involved is not an option.

When I installed the iOS 5 Beta and XCode 4.2 libz.1.2.3.dylib was nowhere to be found. I discovered that linking against libz.1.2.5.dylib handled this but this was not compatible with the other active installations of XCode and the iOS SDK.

I researched this online and discovered the above suggestion and this suggestion. The former doesn't work for me, and the latter makes me nervous.

So what's the difference between libz.dylib, libz.1.2.3.dylib and libz.1.2.5.dylib and can I safely link to the first across all installations of XCode and the iOS SDK?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

世态炎凉 2024-12-04 22:11:27

操作系统通常包含许多版本的动态库。这些由不同的程序使用,具体取决于它们在编译时编译的库,但是当您编译时,您希望链接到与您要包含/导入到源代码中的已安装标头相对应的版本。

libz.dylib 将是指向您安装的标头使用的同一版本的链接。

假设您有 2 个版本 libXYZ.1.dyliblibXYZ.2.dyliblibXYZ.dylib 是指向 libXYZ 的链接。 2.dyliblibXYZ.1.dylib 是一个遗留库,也可在操作系统中用于在 libXYZ.2.dylib 之前编译和分发的应用程序释放。 libXYZ.1.dylib 已包含在 SDK 中,因为可能存在仍希望与旧版本链接的旧框架。

这两个版本可能在标头中具有非常相似的接口,因此在编译和运行时您不会看到任何真正的差异,但在未来的版本中,旧版本可能会被删除并添加新版本,这将使您的项目在链接时中断。

如果我理解正确,链接器将取消引用文件链接,以便找到正确的版本并保留该 dylib 名称,并在应用程序启动时动态链接该名称。因此 libz.dylib 不会成为使用的路径(比编译时更多)。

我在 4.3 SDK

/Developer/.../SDKs/iPhoneOS4.3.sdk/usr/include/zlib.h

/* zlib.h -- interface of the 'zlib' general purpose compression library
  version 1.2.3, July 18th, 2005

  Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler

libz.dylib中的 Xcode 安装中看到了这一点

/Developer/.../SDKs/iPhoneOS4.3.sdk/usr/lib/libz.dylib -> libz.1.2.3.dylib

The OS often includes many versions of dynamic libraries. These are used by different programs depending on which library they were compiled against at their compile time, but when you compile you want to link against the version that correspond to the installed headers which you are including/importing into your source code.

The libz.dylib will be a link to the same version that your installed headers use.

Say you have 2 versions libXYZ.1.dylib and libXYZ.2.dylib, libXYZ.dylib is a link to libXYZ.2.dylib and libXYZ.1.dylib is a legacy lib that is also available in the OS for apps compiled and distributed before libXYZ.2.dylib was released. The libXYZ.1.dylib has been included in the SDK because there can be old frameworks that still want to be linked against the old version.

The two versions might have very similar interfaces in the header so you won't see any real differences when you compile and run, but in future versions the older versions might get removed and new ones added which will make your project break when linking.

If I understand it right, the linker will dereference file links so it will find the right version and keep that dylib name and dynamically link against that when the app starts. So the libz.dylib won't be the path used (more than at compile time).

I see this in my Xcode installation in the 4.3 SDK

/Developer/.../SDKs/iPhoneOS4.3.sdk/usr/include/zlib.h

/* zlib.h -- interface of the 'zlib' general purpose compression library
  version 1.2.3, July 18th, 2005

  Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler

libz.dylib

/Developer/.../SDKs/iPhoneOS4.3.sdk/usr/lib/libz.dylib -> libz.1.2.3.dylib
寂寞美少年 2024-12-04 22:11:27

您可以在取景器中轻松查看它们的工作原理。在 XCode 中,“Show in Finder”库之一。现在单击 libz.dylib 和“获取信息”。您会看到“原始”是:

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/libz.1.2.5.dylib(截至XCode4.2 与 iOS 5 SDK)

所以它现在是版本 1.2.5 的符号链接。将来它将更新到最新的 1.xx 您可以通过这种方式检查所有不同的版本。

You can easily see in the finder how they work. In XCode, "Show in Finder" one of the libraries. Now click once on libz.dylib and "Get Info". You'll see that "Original" is:

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/libz.1.2.5.dylib (as of XCode4.2 with iOS 5 SDK)

So it's a symbolic link to version 1.2.5 for now. In the future it will update to the latest 1.x.x. You can examine all of the various versions this way.

红ご颜醉 2024-12-04 22:11:27

只需链接 libz.dylib 而不是特定版本,编译器就会链接已安装 SDK 上的可用版本。如果链接到当前安装的 SDK 中不可用的某些特定版本,则可能会出现链接器错误。

Just link with libz.dylib instead of a specific version and compiler will link the available version on installed SDK. Linker error may come in case of linking with some specific version that is not available in currently installed SDK.

疯了 2024-12-04 22:11:27

可以使用 libz.1.2.5.dylib 代替 libz.1.2.3.dylib

替换 libz.1.2.3.dylib -----> libz.1.2.5.dylib

You can use use libz.1.2.5.dylib instead of libz.1.2.3.dylib

Replace libz.1.2.3.dylib -----> libz.1.2.5.dylib

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文