PDA

View Full Version : Deployed qt app on Mac can't load mysql driver



ce_nort
7th December 2016, 23:22
Hello,
I haven't done much deploying of qt apps on Macs (though most of my development is on one) but have generally had success previously. Now I'm using Qt 5.7 and macdeploy qt to create a dmg for an application that requires the QMYSQL plugin. When I install from the dmg on my dev machine (all set up with Qt Creator) then the app runs fine, but when it's installed on a different machine it says "driver not loaded." I think this is related to the fact that I had to use install_name_tool change when initially setting up Qt Creator to make sure that libqsqlmysql.dylib could find libmysqlclient.18.dylib (which was previously not being found and keeping the driver from loading). Now when I run otool -L on libqsqlmysql.dylib in the app bundle on one of the other machines it is downloaded on, it still seems to be looking for libmysqlclient.18.dylib in the same path specific to my dev machine. To me this seems to be likely why the driver is not loading: the plugin is looking for a dependency in the wrong place and therefor failing. Does anybody else have any experience with this or any tips on how I can get more information on the error?

ce_nort
8th December 2016, 20:18
Update: Still broken, more information.
I used install_name_tool on libqsqmysql.dylib in the release build folder to change the path from the one on my dev machine to @executable_path/../Frameworks/libmysqlclient.20.dylib and made sure there was a copy of libmysqlclient.20.dylib in that folder before running macdeployqt. This is because I have a build folder of an older version of the program using Qt 5.5 that worked perfectly fine, and this was the way it was structured. Unfortunately, this did not solve my problem. I have confirmed that all the sql drivers are in fact listed as available by the application, but they are just not being loaded.