⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

Mysql plugin not loaded when running in debug mode

  • Hi there.

    Using QtSDK 1.2.1 on a mac.

    I'm trying to identify an issue with my application, and as such trying to use Qt debug libraries.
    Following the documentation there:

    I set export DYLD_IMAGE_SUFFIX=_debug

    When doing so, I can see that the Qt debut libraries are properly loaded.
    However, it can't find the mysql plugins.

    mysql plugin is installed, for both standard and debug:
    jyaimac:plugins jyavenard$ ls -l sqldrivers/
    total 4976
    -rwxr-xr-x 1 jyavenard staff 646992 20 Apr 13:39 libqsqlite.dylib
    -rwxr-xr-x 1 jyavenard staff 958048 20 Apr 13:39 libqsqlite_debug.dylib
    -rwxr-xr-x 1 jyavenard staff 93376 20 Apr 15:02 libqsqlmysql.dylib
    -rwxr-xr-x 1 jyavenard staff 187752 20 Apr 15:01 libqsqlmysql_debug.dylib
    -rwxr-xr-x 1 jyavenard staff 169032 20 Apr 13:39 libqsqlodbc.dylib
    -rwxr-xr-x 1 jyavenard staff 210144 20 Apr 13:39 libqsqlodbc_debug.dylib
    -rwxr-xr-x 1 jyavenard staff 111176 20 Apr 13:39 libqsqlpsql.dylib
    -rwxr-xr-x 1 jyavenard staff 159088 20 Apr 13:39 libqsqlpsql_debug.dylib

    If I unset DYLD_IMAGE_SUFFIX, then everything works fine...

    What is the proper way of not only running debug version of Qt and still have access to plugins ?

    Thanks in advance.

  • I would suspect that the dynamic linker tries to load libmysqlclient_debug.dylib - i.e. the mysql library itself with the respective suffix. Try to find the installation directory of your mysql libs:


    on the shell issue

    locate libmysqlclient.dylib

    and then setup some symlinks:

    cd /usr/local/mysql/lib
    ln -s libmysqlclient.dylib libmysqlclient_debug.dylib

    You might need to add the respective symlinks for the versioned file names too.

  • Actuelly, i had already created the symlinks as I too thought it was the issue.

    However, activating linker logs showed that it was not even loading the original plugin to start with.

    I then looked at what QStringList QCoreApplication::libraryPaths would return, and the value was different to when running in non-debug mode.
    In non-debug it points to the Qt system plugin directory (where the MySQL plugin was copied) but when running in debug mode it is set to the working dir.

    So I simply created a link in my working directory to the system Qt lib. And it's now working.

    A tad confusing...
    Since I've found why it's crashing, and the bug is in qt unfortunately.

    Thanks for the help.

Log in to reply