[英]Copied Cocoa Framework searches /Library/Frameworks/… only. How can I make it search binary within itself?
I made a Cocoa Framework with dynamic library. 我用动态库制作了一个Cocoa框架。 This library contains C functions.
该库包含C函数。 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?
为什么会发生这种情况,我该如何避免呢?
This is somewhat complicated than I thought. 这比我想象的要复杂。
Problem is locating binary file in framework. 问题是在框架中找到二进制文件。 It looks enough with only
$(EXECUTABLE_PATH)
. 仅
$(EXECUTABLE_PATH)
看起来就足够了。 But real problem is it should be absolute path. 但是真正的问题是它应该是绝对路径。
So basic solution is @executable_path/../Frameworks/$(EXECUTABLE_PATH)
. 因此,基本解决方案是
@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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.