Macdeployqt is not working

2.7k views Asked by At

I've installed the latest version of Qt (5.1) and when I try to deploy my app on Mac using the macdeployqt tool, the app is still not working on other macs. It's completely working on my Mac and it doesn't not indicate any errors. After researches I found this and I think it's my problem : Qt 5.1 and Mac: Bug making macdeployqt not working properly and https://bugreports.qt-project.org/browse/QTBUG-14699 But the explanation is too technical for me (+ english not my native language), I'm a complete beginner, can you explain what do I have to do to simply make my app work on Mac ? Step by step ? It is perfectly functional on Windows (with the standard dlls).

Thank you so much, I think it will help a lot of beginners that are going through the same issue.

1

There are 1 answers

4
TheDarkKnight On BEST ANSWER

There are 3 tools at your disposal to sort out deployment of Qt for OS X (MacOS).

  1. macdeployqt: This tool gathers all the Qt libraries that your application declares it needs in its project, adds them to the app bundle and updates their paths so that your application knows where to find them.

  2. otool: A complex tool for examining the contents of binaries, but in this case, used with the -L argument, will display the paths to all the libraries that your application will reference. These are the paths that it will be looking to find those libraries.

  3. install_name_tool: Since macdeployqt only handles Qt libraries that are required by your application, you can use install_name_tool to update paths to any other libraries that your app requires. For example, if you have a separate non-Qt framework that your application relies upon, you need to have a post compilation step to copy the framework into the application bundle and then use install_name_tool to update the paths to the framework.

If you're having problems, check that the libraries / frameworks have been copied to the correct location in the application bundle and then use otool -L to check the paths. If any are incorrect, use name_install tool to fix them.

If you still can't get it to work, please edit your question and add the output from using otool -L.

Note, historically, various versions of Qt have suffered bugs with the macdeployqt utility, so if it is not working properly, you may also want to check the qt bug tracker.