XCode:使用终端启动时出现 dylib 链接问题

发布于 2024-12-21 13:31:05 字数 1355 浏览 6 评论 0原文

我在 XCode 上开发了一个项目,其中添加了 somme dylib。该项目可以编译,并且在使用 XCode 启动时可以很好地执行。

但是当我尝试在 shell 中启动它时,出现了 lib 错误:

iMac-de-Remi-Doolaeghe:MacOS remidoolaeghe$ ./Adobe\ InDesign\ CS5 
2011-12-16 10:08:55.160 Adobe InDesign CS5[8071:903] Error loading /Applications/Adobe InDesign CS5/Plug-Ins/Autocat/Autocat.InDesignPlugin/Autocat:  dlopen(/Applications/Adobe InDesign CS5/Plug-Ins/Autocat/Autocat.InDesignPlugin/Autocat, 265): Library not loaded: libboost_filesystem-xgcc42-mt-1_37.dylib
  Referenced from: /Applications/Adobe InDesign CS5/Plug-Ins/Autocat/Autocat.InDesignPlugin/Autocat
  Reason: image not found
2011-12-16 10:08:55.161 Adobe InDesign CS5[8071:903] Error loading /Applications/Adobe InDesign CS5/Plug-Ins/Autocat/AutocatUI.InDesignPlugin/AutocatUI:  dlopen(/Applications/Adobe InDesign CS5/Plug-Ins/Autocat/AutocatUI.InDesignPlugin/AutocatUI, 265): Library not loaded: libboost_filesystem-xgcc42-mt-1_37.dylib
  Referenced from: /Applications/Adobe InDesign CS5/Plug-Ins/Autocat/AutocatUI.InDesignPlugin/AutocatUI
  Reason: image not found
Bus error

这是一个错误,我可以通过复制 usr/lib 文件夹中的库来解决这个错误。我的帖子里没问题。但分发时就不行了。我认为我的 XCode 项目中的链接器出了问题,但看不出是什么。

我使用 XCode 3.2.6。这些库存在于我的目标中的“Link Binary With Libraries”下以及“Groups&Files”下的“Libraries”文件夹中,

我不确定这是否重要,但我的项目是 Adob​​e InDesign 的插件。

提前致谢。

I develop a project on XCode, in which I have added somme dylib. The project compiles, and execute nicely when launched with XCode.

But when I try to launch it in my shell, I got lib errors :

iMac-de-Remi-Doolaeghe:MacOS remidoolaeghe$ ./Adobe\ InDesign\ CS5 
2011-12-16 10:08:55.160 Adobe InDesign CS5[8071:903] Error loading /Applications/Adobe InDesign CS5/Plug-Ins/Autocat/Autocat.InDesignPlugin/Autocat:  dlopen(/Applications/Adobe InDesign CS5/Plug-Ins/Autocat/Autocat.InDesignPlugin/Autocat, 265): Library not loaded: libboost_filesystem-xgcc42-mt-1_37.dylib
  Referenced from: /Applications/Adobe InDesign CS5/Plug-Ins/Autocat/Autocat.InDesignPlugin/Autocat
  Reason: image not found
2011-12-16 10:08:55.161 Adobe InDesign CS5[8071:903] Error loading /Applications/Adobe InDesign CS5/Plug-Ins/Autocat/AutocatUI.InDesignPlugin/AutocatUI:  dlopen(/Applications/Adobe InDesign CS5/Plug-Ins/Autocat/AutocatUI.InDesignPlugin/AutocatUI, 265): Library not loaded: libboost_filesystem-xgcc42-mt-1_37.dylib
  Referenced from: /Applications/Adobe InDesign CS5/Plug-Ins/Autocat/AutocatUI.InDesignPlugin/AutocatUI
  Reason: image not found
Bus error

That's an error I could workaround by copying the libs in my usr/lib folder. That's ok on my post. But that won't be ok when distributing it. I think I did something wrong with my linker in my XCode project, but can't see what.

I use XCode 3.2.6. The libs are presents in my targets, under "Link Binary With Libraries", and in "Libraries" folder under Groups&Files

I'm not sure if it matters, but my project is a plugin for Adobe InDesign.

Thanks in advance.

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

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

发布评论

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

评论(1

迷鸟归林 2024-12-28 13:31:05

我说的是更正,但如果它是动态库,则您也必须在将其分发到的计算机上拥有该动态库。您可能有兴趣将动态库打包到安装向导或其他东西中。

但是,如果它是静态库,您可以使用以下标志之一强制包含所有符号:

-Obj-C
-all_load
-force_load

可以在此处找到有关这些标志的作用以及如何使用它们的很好的解释:静态库中的 Objective-C 类别

I'm speaking under correction, but if it is a dynamic lib, you would have to have that dynamic lib on the machine where it gets distributed to as well. You might be interested in packaging the dynamic lib into your installation wizard or something.

However if it was a static lib, you could have enforced to include all symbols by using one of the following flags:

-Obj-C
-all_load
-force_load

A nice explanation on what these flags do and how to use them can be found here: Objective-C categories in static library

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