在xcode 6中使用动态库有错误:库没有加载:/ usr/local/lib/xxx。dylib原因:图像未找到。

时间:2022-03-19 22:19:00

i have a beginner of cross-platform programming. my project is a simple 3d project it works on windows well, it is mananged by vistual sutido 2013.and then, i create projects under xcode 6.

我有一个跨平台编程的初学者。我的项目是一个简单的3d项目,它在windows上运行良好,它是由vistual sutido 2013设计的。然后,我在xcode 6下创建项目。

there is a Core library in my project, i have compiled it as a dll file under windows, and static link it by a tool which is named Editorbuilder, this tool used to build editor script. the Core project which is Core.vcxproj generate a Core.dll under ProjectRoot/Binaries/Win32/Debug/. EditorBuilder.vcxproj generate a EditorBuilder.exe under ProjectRoot/Binaries/Win32/Debug. if i run this tool in visual studio or the console window, it works well.

在我的项目中有一个核心库,我将它编译为windows下的dll文件,并通过一个名为editor builder的工具将其静态链接起来,这个工具用于构建编辑器脚本。核心项目是核心项目。vcxproj生成一个核心。dll在ProjectRoot / Win32 /调试/ /二进制文件。EditorBuilder。vcxproj生成EditorBuilder。exe下ProjectRoot /双星/ Win32 /调试。如果我在visual studio或console窗口中运行这个工具,它会运行得很好。

under macos, i use xcode 6. first i have create a dynamic library project, it has a product libCore.dylib, it will generate to ProjectRoot/Binaries/Mac/Debug. and then i create the EditorBuilder project in xcode 6 which is a normal command line tools,and add the reference of libCore.dylib to the product:

在macos下,我使用xcode 6。首先,我创建了一个动态库项目,它有一个产品libCore。dylib,它将生成ProjectRoot/二进制/Mac/Debug。然后我在xcode 6中创建了编辑器项目,这是一个普通的命令行工具,并添加了libCore的引用。dylib产品:

在xcode 6中使用动态库有错误:库没有加载:/ usr/local/lib/xxx。dylib原因:图像未找到。 the picture of projects

项目的照片

在xcode 6中使用动态库有错误:库没有加载:/ usr/local/lib/xxx。dylib原因:图像未找到。 the files is generated success

文件生成成功。

it compile success, and works well if i debug EditorBuilder Under Xcode6 use Ctrl + R. but when i run EditorBuilder in the terminal or double click it, it can not launch up because this :

它编译成功,如果我在Xcode6下调试编辑器,使用Ctrl + r,效果很好,但是当我在终端运行编辑器或双击它时,它不能启动,因为:

/Users/bodong/Documents/Hikari/Binaries/Mac/Debug/EditorBuilder ; exit;
bodeMacBook-Pro:~ bodong$ /Users/bodong/Documents/Hikari/Binaries/Mac/Debug/EditorBuilder ; exit;
dyld: Library not loaded: /usr/local/lib/libCore.dylib
  Referenced from: /Users/bodong/Documents/Hikari/Binaries/Mac/Debug/EditorBuilder
  Reason: image not found
Trace/BPT trap: 5
logout

so my question is that the libCore.dylib is in the same directory, why the EditorBuilder process can't find the dylib? why the EditorBuilder can find the dylib when run it in xcode 6 with Ctrl + R ?

我的问题是,libCore。dylib位于同一个目录中,为什么编辑器进程无法找到dylib?为什么编辑器可以在xcode 6中使用Ctrl + R来查找dylib ?

what's the difference between windows dll and macos dylib? what is the search strategy under macos?

windows dll和macos dylib有什么区别?macos下的搜索策略是什么?


ps: if i create a directory /usr/local/lib,and copy libCore.dylib to this dir, it works well. how to make the EditorBuilder load the dylib which is the same parent dir.????

如果我创建一个目录/usr/local/lib,并复制libCore。对于这个dir,它运行得很好。如何使编辑器加载与父目录相同的dylib。

2 个解决方案

#1


0  

You can find the answer at this post:

你可以在这篇文章中找到答案:

iOS app with framework crashed on device, dyld: Library not loaded, Xcode 6 Beta

iOS应用程序框架崩溃,dyld:库未加载,Xcode 6测试版。

Reply stays here for reference.

请在这里留作参考。

This post in the same page, explains why this happens: https://*.com/a/28469804/999817

这篇文章在同一页,解释了为什么会这样:https://*.com/a/28469804/999817。

#2


-1  

there is a install directory in the build settings, change this directory to the output directory, it works well. but i don't know if i deploy this app to another mac, should it works well?

在build设置中有一个安装目录,将此目录更改为输出目录,它运行良好。但我不知道我是否应该将这个应用程序部署到另一个mac上,它是否应该运行良好?

#1


0  

You can find the answer at this post:

你可以在这篇文章中找到答案:

iOS app with framework crashed on device, dyld: Library not loaded, Xcode 6 Beta

iOS应用程序框架崩溃,dyld:库未加载,Xcode 6测试版。

Reply stays here for reference.

请在这里留作参考。

This post in the same page, explains why this happens: https://*.com/a/28469804/999817

这篇文章在同一页,解释了为什么会这样:https://*.com/a/28469804/999817。

#2


-1  

there is a install directory in the build settings, change this directory to the output directory, it works well. but i don't know if i deploy this app to another mac, should it works well?

在build设置中有一个安装目录,将此目录更改为输出目录,它运行良好。但我不知道我是否应该将这个应用程序部署到另一个mac上,它是否应该运行良好?