如何在iPhone项目中指定dylib的兼容版本?

发布于 2024-08-01 16:38:20 字数 818 浏览 2 评论 0原文

我最近向我的 iPhone 项目添加了一个静态库 (mobclix),这需要我将 Base SDK 设置为 3.0。 该库据称与 2.2 兼容,到目前为止看起来确实如此。 我将项目的部署目标设置为 2.2。 那里没有问题。

现在,我也在同一个项目中使用 libxml2。 显然,OS 3.0 中的 libxml2.2.dylib 比 OS 2.X 中的 libxml2.2.dylib 更新(分别为版本 10 和 9)。 但是,我使用 libxml2 的代码已经与 OS 2.X 中包含的 libxml2 版本兼容。 由于我需要将 Base SDK 设置为 3.0,因此“兼容性版本”/最低版本要求/依赖项会自动设置为较新版本的 libxml2。 当我尝试在 OS 2 中运行该应用程序时,我收到此运行时错误(显然):

  Dyld Error Message:
  Library not loaded: /usr/lib/libxml2.2.dylib
  Referenced from: /Users/Martijn/Library/Application Support/iPhone Simulator/User/Applications/4D5456DE-F297-4DF4-ACA6-DA8BBBBBA914/Luisterpaal.app/Luisterpaal
  Reason: Incompatible library version: Luisterpaal requires version 10.0.0 or later, but libxml2.2.dylib provides version 9.0.0

是否可以在某处覆盖版本要求? 或者有其他想法来解决这个问题?

I recently added a static library (mobclix) to my iPhone project which required me to set the Base SDK to 3.0. This library is claimed to be compatible with 2.2 and so far it looks like it's true. I set the project's Deployment Target to 2.2. No problems there.

Now, I am also using libxml2 in this same project. Apparently, the libxml2.2.dylib in OS 3.0 is newer than in OS 2.X (version 10 and 9 respectively). However, my code that uses libxml2, was already compatible with the libxml2 version included with OS 2.X. Since I needed to set the Base SDK to 3.0, the "compatibility version" / minimum version requirement / dependency is automatically set to the newer version of libxml2. When I try to run the app in OS 2, I get this runtime error (obviously):

  Dyld Error Message:
  Library not loaded: /usr/lib/libxml2.2.dylib
  Referenced from: /Users/Martijn/Library/Application Support/iPhone Simulator/User/Applications/4D5456DE-F297-4DF4-ACA6-DA8BBBBBA914/Luisterpaal.app/Luisterpaal
  Reason: Incompatible library version: Luisterpaal requires version 10.0.0 or later, but libxml2.2.dylib provides version 9.0.0

Is it possible to override the version requirement somewhere?
Or other ideas to solve this issue?

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

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

发布评论

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

评论(2

雨落□心尘 2024-08-08 16:38:20

兼容版本根据构建时当前SDK的dylib中嵌入的版本设置。 我还没有找到改变或覆盖这个的方法。

然而,在 Xcode 的目标中,在“使用库链接二进制文件”分支下,有一个选项可以“弱”链接 dylib。 这会在加载 dylib(运行时)时跳过版本检查。 那么您的责任就是只调用现有的函数。 调用不存在的函数将使应用程序崩溃。

The compatibility version is set according to the version embedded in the dylib of the current SDK during build. I have not found a way to change or override this.

However, in the target in Xcode under the "Link with binary with libraries" branch there is an option to link a dylib "weakly". This skips version checking at the time of loading the dylib (runtime). It's your responsibility then to only make calls to existing functions. Making calls to non-existent functions will crash the application.

余厌 2024-08-08 16:38:20

显然,SDK 3.0 中的一项更改破坏了与 libxml 的兼容性。 苹果已经在这里发布了相关信息:

http://developer.apple.com /iphone/library/qa/qa2009/qa1659.html

Apparently there was a change with SDK 3.0 that broke compatibility with libxml. Apple have posted about it here:

http://developer.apple.com/iphone/library/qa/qa2009/qa1659.html

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