将框架链接到QuickLook插件 [英] Linking Frameworks into QuickLook plugins

查看:191
本文介绍了将框架链接到QuickLook插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个QuickLook生成器。为此,我需要链接到我创建的框架。但是,一旦我链接到所述框架, qlmanage 拒绝加载我的插件通过告诉我:

  [ERROR]无法在/path/to/my-ql.qlgenerator加载插件:无法加载包my-ql,因为它已损坏或缺少必要的资源。 



我已经阅读了所有关于链接,框架和QuickLook的相关教程,但没有找到答案。 >

我发现/排除的东西




  • 架构:当将框架包含为32位二进制文​​件时,整个链接过程会出错,因此这似乎并不是问题。

  • 我已验证该框架已复制到框架的安装路径设置为 @executable_path /../。 框架



此外,当在另一个应用程序中使用框架时,一切都很顺利。我唯一可能的解释是,如下:当执行 qlmanage 时, @executable_path 实际上指向的二进制和所以我的框架从来没有找到。如果是这样,我如何设置安装路径仍然允许相对于插件的位置?



在构建的QuickLook插件上的code> otool -L 产生以下:

  /Library/Frameworks/QuickLook.framework/Versions/A/QuickLook(兼容性版本1.0.0,当前版本为327.4.0)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices(兼容性版本1.0.0,当前版本38.0.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices(兼容性版本1.0.0,当前版本44.0.0)
/系统/库/框架/ CoreFoundation.framework /版本/ A / CoreFoundation(兼容版本150.0.0,当前版本550.29.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa(兼容性版本1.0 .0,当前版本15.0.0)
@executable_path /../ Frameworks / PESHandler.framework / Versions / A / PESHandler(兼容性版本1.0.0,当前版本1.0.0)< == *我的框架*
/usr/lib/libSystem.B.dylib(兼容性版本1.0.0,当前版本125.2.0)
/usr/lib/libobjc.A.dylib(兼容性版本1.0.0 ,current version 227.0.0)

otool -D 我的框架产生这个:

  @executable_path /../ Frameworks / PESHandler.framework / Versions / A / PESHandler 

框架不需要垃圾回收。

解决方案

@executable_path解析进程的主可执行映像。这将是quicklook守护进程,而不是你的插件。您应该使用@loader_path。



这里是博客帖子


I am trying to write a QuickLook generator. For this, I need to link against a framework I created. However, as soon as I link against said framework, qlmanage refuses to load my plugin by telling me:

[ERROR] Can't load plug-in at /path/to/my-ql.qlgenerator: The bundle "my-ql" couldn’t be loaded because it is damaged or missing necessary resources.

I have read all the relevant tutorials on Linking, Frameworks and QuickLook but found no answer.

Things I have found out/ruled out so far

  • Architecture: when including the Framework as 32-bit binary, the entire linking process faults, so this does not seem to be the problem.
  • I have verified that the Framework gets copied into the plugin’s bundle under Contents/Frameworks.
  • The framework’s install path is set to @executable_path/../Frameworks

Also, when using the framework in another application, everything goes well. The only possible explanation I can fathom is as follows: When executing qlmanage, the @executable_path actually points to that binary and so my framework is never found. If this is the case, how must I set the install path to still allow a location relative to the plugin? I don’t want to install my framework globally.

EDIT

otool -L on the built QuickLook Plugin yields the following:

/System/Library/Frameworks/QuickLook.framework/Versions/A/QuickLook (compatibility version 1.0.0, current version 327.4.0)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 38.0.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 44.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.29.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 15.0.0)
@executable_path/../Frameworks/PESHandler.framework/Versions/A/PESHandler (compatibility version 1.0.0, current version 1.0.0) <== *this is my framework*
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)

otool -D on my framework yields this:

@executable_path/../Frameworks/PESHandler.framework/Versions/A/PESHandler

The Framework does not require garbage collection.

解决方案

@executable_path resolves against the main executable image for the process. That would be the quicklook daemon, not your plug-in. You should use @loader_path instead.

Here's a blog post covering this.

这篇关于将框架链接到QuickLook插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆