复制的 Cocoa Framework 仅搜索 /Library/Frameworks/...。我怎样才能让它在自身内部搜索二进制?

发布于 2024-11-05 20:17:15 字数 758 浏览 5 评论 0原文

我做了一个带有动态库的Cocoa框架。该库包含 C 函数。我将框架复制到其他项目中,编译得很好,但是运行时它崩溃并显示这样的消息。

warning: Unable to read symbols for /Library/Frameworks/NewtonGameDynamics.framework/Versions/A/NewtonGameDynamics (file not found).
warning: Unable to read symbols from "NewtonGameDynamics" (not yet mapped into memory).
[Switching to process 48902 thread 0x0]
dyld: Library not loaded: /Library/Frameworks/NewtonGameDynamics.framework/Versions/A/NewtonGameDynamics
  Referenced from: /Users/eonil/Library/Developer/Xcode/DerivedData/newton-integration-test-1-ddaxmlnzdnwstkfaiolnkygefbmp/Build/Products/Debug/newton-integration-test-1.app/Contents/MacOS/newton-integration-test-1
  Reason: image not found
(gdb) 

二进制文件位于复制的框架目录中。为什么会发生这种情况以及如何避免这种情况?

I made a Cocoa Framework with dynamic library. This library contains C functions. I copied the framework into other project, compiled well, but when running it crashes with message like this.

warning: Unable to read symbols for /Library/Frameworks/NewtonGameDynamics.framework/Versions/A/NewtonGameDynamics (file not found).
warning: Unable to read symbols from "NewtonGameDynamics" (not yet mapped into memory).
[Switching to process 48902 thread 0x0]
dyld: Library not loaded: /Library/Frameworks/NewtonGameDynamics.framework/Versions/A/NewtonGameDynamics
  Referenced from: /Users/eonil/Library/Developer/Xcode/DerivedData/newton-integration-test-1-ddaxmlnzdnwstkfaiolnkygefbmp/Build/Products/Debug/newton-integration-test-1.app/Contents/MacOS/newton-integration-test-1
  Reason: image not found
(gdb) 

The binary file is in the copied framework directory. Why this happen and how can I avoid this?

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

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

发布评论

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

评论(1

怀里藏娇 2024-11-12 20:17:15

这比我想象的要复杂一些。

问题是在框架中定位二进制文​​件。仅使用 $(EXECUTABLE_PATH) 看起来就足够了。但真正的问题是它应该是绝对路径。

所以基本的解决方案是@executable_path/../Frameworks/$(EXECUTABLE_PATH)。因为这是嵌入式私有框架,并且运行应用程序二进制文件的路径就是这样。

INSTALL_PATH = @executable_path/../Frameworks
LD_DYLIB_INSTALL_NAME = @executable_path/../Frameworks/$(EXECUTABLE_PATH)

This is somewhat complicated than I thought.

Problem is locating binary file in framework. It looks enough with only $(EXECUTABLE_PATH). But real problem is it should be absolute path.

So basic solution is @executable_path/../Frameworks/$(EXECUTABLE_PATH). Because this is embedded private framework and the path from running app binary is just that.

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