macdeployqt和第三方库 [英] macdeployqt and third party libraries

查看:395
本文介绍了macdeployqt和第三方库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序项目,这取决于我自己创建的几个共享库。根据Qt 4.6文档在Mac OSX上部署应用程序:


注意:如果您想要第三方库
要包含在您的应用程序
bundle中,那么您必须为该库添加一个excplicit
lib条目到
应用程序的.pro文件。否则,
macdeployqt工具将不会将
第三方.dylib复制到包中。


我有在我的应用程序的.pro文件中添加了lib条目,但是当我执行macdeployqt时,我写的库不会被复制到捆绑包中。我的.pro文件中有以下内容:

  LIBS + = -L ../库-lMyLib 

所有内容都可以,但是当我尝试从捆绑中运行时遇到问题,即图像未找到错误



在macdeployqt中是否有错误,或者我需要更多的对我的.pro文件?

解决方案

badcat是正确的,Qt 4.6文档对于 macdeployqt 工具是可以实现的。@ b
$ b根据我的经验,macdeployqt所做的唯一的事情是:


  1. 将Qt库复制到foo中的应用程序包中.app / Contents / Frameworks /目录

  2. 调整一个二进制文件的链接库,即foo.app/Contents/MacOS/foo(必须具有与应用程序包相同的名称,即使你提到另一个二进制文件在Info.plist中)

所以,对于你想要de在您的应用程序包中,您必须执行以下操作:


  1. 运行macdeployqt以享受其有用但无效的收益



    macdeployqt< path_to_your_nascent_app_bundle> /foo.app


  2. p>手动安装额外的库



    cp< original_library_path> foo.app/Contents/Frameworks/<lib_name>


  3. 找出每个二进制文件夹的库。



    otool -L< binary_file_name>


  4. 二进制文件中的内部libary路径



    install_name_tool -change< original_library_path> @executable_path /../框架/< lib_name> < binary_file_name>


我写了一个perl脚本,为我的应用程序自动执行这些步骤,但是对于我的特定环境来说,这太过分了。


I've got an application project that depends on a couple of shared libraries that I have created myself. According to the Qt 4.6 documentation "Deploying an Application on Mac OSX":

Note: If you want a 3rd party library to be included in your application bundle, then you must add an excplicit lib entry for that library to your application's .pro file. Otherwise, the macdeployqt tool will not copy the 3rd party .dylib into the bundle.

I have added lib entries to my application's .pro file but the libraries that I have written do not get copied into the bundle when I execute macdeployqt. I have the following in my .pro file:

LIBS += -L../Libraries -lMyLib

Everything builds okay, its just when I try to run from the bundle that I run into problems i.e. "image not found" errors.

Is there a bug in macdeployqt or do I have to something more to my .pro file?

解决方案

badcat is correct that the Qt 4.6 documentation has a grossly inflated view of what is possible with macdeployqt tool.

In my experience, the only things that are done by macdeployqt are:

  1. Copy the Qt libraries into your app bundle in the foo.app/Contents/Frameworks/ directory
  2. Adjusts the link libraries of one binary, namely foo.app/Contents/MacOS/foo (must have same name as app bundle, even if you mention another binary in Info.plist)

So, for every other binary and library you want to deploy in your app bundle, you must do the following:

  1. Run macdeployqt to enjoy its useful but feebly inadequate benefits

    macdeployqt <path_to_your_nascent_app_bundle>/foo.app

  2. Install your extra libraries manually

    cp <original_library_path> foo.app/Contents/Frameworks/<lib_name>

  3. Find out what libraries each binary links to.

    otool -L <binary_file_name>

  4. Change the internal libary paths in your binaries

    install_name_tool -change <original_library_path> @executable_path/../Frameworks/<lib_name> <binary_file_name>

I wrote a perl script that automates these steps for my application, but it's a bit too specific to my particular environment to post here.

这篇关于macdeployqt和第三方库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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