Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-51728

macdeployqt read wrong frameworks path

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.5.0
    • None
    • OSX El Captain 10.11.3
      Qt: 5.5
    • macOS

    Description

      I was using the *macdeployqt* tool but I found an error when the tool tries to copy the Qt Plugins that my application depends on.

      The problem was that I am linking my application with VTK shared libraries and one of the libraries is called *libvtkGUISupportQtOpenGL.dylib*.

      Since this is a very small change to the code, I figured that it might save me some time to post here in the forums rather than building the entire Qt library in order to make a contribution. I found that the problem is in this file: https://github.com/qtproject/qttools/blob/dev/src/macdeployqt/shared/shared.cpp at line 853. Here is the problem

      // Get the qt path from one of the Qt frameworks;
      >if (deploymentInfo.qtPath.isNull() && framework.frameworkName.contains("Qt")
                  && framework.frameworkDirectory.contains("/lib"))
      {
             deploymentInfo.qtPath = framework.frameworkDirectory;
             deploymentInfo.qtPath.chop(5); // remove "/lib/"
      }
      

      In this case, the macdeployqt tool thinks that libvtkGUISupportQtOpenGL.dylib. is a Qt framework and sets the deploymentInfo.qtPath to the path of a VTK library, which has nothing to do with Qt Frameworks. At the end of the process, back in main.cpp it tries to copy the Qt Plugins from the same directory as libvtkGUISupportQtOpenGL.dylib thus rising an error.

      So I added a fourth condition in the line that check if the current framework being analysed is in fact a Qt Framework. This is the fix:

      // Get the qt path from one of the Qt frameworks;
      >if (deploymentInfo.qtPath.isNull() && framework.frameworkName.contains("Qt") 
                  && framework.frameworkName.contains(".framework")
                  && framework.frameworkDirectory.contains("/lib"))
      {
             deploymentInfo.qtPath = framework.frameworkDirectory;
             deploymentInfo.qtPath.chop(5); // remove "/lib/"
      }
      

      I am currently using a fork of the macdeploytool, hope this can make its way to the official code!

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sorvig Morten Sørvig
            mcleary Thales Sabino
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes