Bug found in macdeployqt
-
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!
-
I think it would be better to raise a bug report