Please nominate your Qt Champions for 2021! https://forum.qt.io/topic/132134/looking-for-the-2021-qt-champions

Deployed app not connecting to mysql on other Macs



  • Hello,
    I have an app deployed using macdeployqt tool. It works fine on the mac it was created on but when used on another mac, I get the error Driver not loaded.

    I looked in the MyApp.app and ran otool -L on libqsqlmysql.dylib. It looks to be reaching out for libmysqlclient.21.dylib in the /usr/local/mysql-8.0.20-macos10.15-x86_64/lib directory instead of the app?

    It did put the libmysqlclient.21.dylib in the package but in the frameworks directory. It is looking for 2 librarys in the @loader_path directory, libssl.1.1.dylib and libcrypto.1.1.dylib.

    I am not sure if these are the issues as I am a noob on Macs.

    Any help would be appreciated.

    Thanks,
    --James



  • @JSher said in Deployed app not connecting to mysql on other Macs:

    2

    Scratch that. Those WERE in my mysql directory (thanks @SGaist ).....find could not find them for some reason....added them to the /Frameworks directory and BAM....working.

    Thanks,
    --James


  • Lifetime Qt Champion

    Hi,

    The path should have been corrected to point inside the bundle. You can still do it by hand though.



  • @SGaist said in Deployed app not connecting to mysql on other Macs:

    The path should have been corrected to point inside the bundle. You can still do it by hand though.

    How do I do it by hand? Do you have some documentation? And do I need to find those 2 libs and add them as well?

    Thanks,
    --James



  • @SGaist

    Just for a clear picture, here is otool:

    Ghosts-iMac:sqldrivers ghost$ otool -L libqsqlmysql.dylib

    libqsqlmysql.dylib:

    libqsqlmysql.dylib (compatibility version 0.0.0, current version 0.0.0)
    
    @rpath/QtSql.framework/Versions/5/QtSql (compatibility version 5.9.0, current version 5.9.9)
    
    @rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.9.0, current version 5.9.9)
    
    /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
    
    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    
    /usr/local/mysql-8.0.20-macos10.15-x86_64/lib/libmysqlclient.21.dylib (compatibility version 20.0.0, current version 20.0.0)
    
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
    
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)
    

    Ghosts-iMac:sqldrivers ghost$ otool -L libmysqlclient.21.dylib

    libmysqlclient.21.dylib:

    @rpath/libmysqlclient.21.dylib (compatibility version 21.0.0, current version 21.0.0)
    
    @loader_path/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
    
    @loader_path/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
    
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 800.7.0)
    
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)

  • Lifetime Qt Champion

    To do it by hand, use install_name_tool (that's what macdeployqt uses)

    As for the OpenSSL librairies, they are likely provided with your MySQL distribution.



  • @SGaist said in Deployed app not connecting to mysql on other Macs:

    To do it by hand, use install_name_tool (that's what macdeployqt uses)

    Thats what I figured but I cannot figure out the commands for install_name_tool and when to use them...

    I have a couple of questions if you would be so kind:

    1: It is possible for you to give me an example of install_name_tool line to fix libqsqlmysql.dylib to point to the frameworks directory in the .app instead of /usr/local/mysql-8.0.20-macos10.15-x86_64/lib ?

    2: When would I execute these commands? Once the .app is built?

    Thanks a ton,
    --James



  • @SGaist What I have done so far, still not working...

    used install_name_tool -change /usr/ocal/mysql-8.0.20-macos10.15-x86_64/lib/libmysqlclient.21.dylib @executable_path/../Frameworks/libmysqlclient.21.dylib libqsqlmysql.dylib

    This made libqsqlmysql.dylib point to @executable_path/../Frameworks/libmysqlclient.21.dylib which I am hopeing is the right spot as the .app structure is:
    contents-Frameworks-libmysqlclient.21.dylib
    -plugins-sqldrivers-libqsqlmysql.dylib

    Still does not work. I checked on my system for the libraries libssl.1.1.dylib and libcrypto.1.1.dylib and neither are there so I did not add as they work without.

    Any ideas where I could check why the driver is not loading?

    Thanks,
    --James



  • @JSher said in Deployed app not connecting to mysql on other Macs:

    2

    Scratch that. Those WERE in my mysql directory (thanks @SGaist ).....find could not find them for some reason....added them to the /Frameworks directory and BAM....working.

    Thanks,
    --James


Log in to reply