Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt 5.14.0 plugins path



  • Hi, I have recently updated from 5.12.6 to 5.14.0 (using msvc2017 kits). In the older version I was able to run Gui programs (developed in Visual Studio 2019) without the need of copying the plugins dll's (like qwindows.dll) to the bin folder (where the .exe of the Gui program is). It did find the dll's in the Qt install path, e.g. C:\Qt\5.14.0\msvc2017_64\plugins\platforms.
    After the Update it is not the case anymore and I have to copy the plugins. Actually it is not a big deal, but I was just wandering why it is different now, I have checked system variables and registry (with the 5.12.6 version) but could not find anything that points to the plugins folder. So I am just curious now why it does not find the files after the update although nothing in system variables and registry has changed.



  • Actually Qt's loading of plugins does not pay attention to the system PATH, it uses other means of obtaining the directory of qwindows.dll etc.

    Before 5.14.0 the most frequent method was to read the directory hardwired into Qt5Core.dll at install time (grep for qt_prfxpath, that's how your Qt version 5.12.6 could find the plugins it needed).

    But in 5.14.0 Qt got rid of that qt_prfxpath hardwired into Qt5Core.dll, it caused more problems than it solved. For example, windeployqt patched that path to "." More here https://bugreports.qt.io/browse/QTBUG-14150

    There are lots of other alternatives to inform Qt where your plugins are, for example you can place a qt.conf file next to your .exe file, that looks like this:

    [Paths]
    Plugins=C:/Qt/5.14.0/msvc2017_64/plugins
    

    (Be sure to use forward slashes, backward slashes do not work)


  • Moderators

    @Gertio said:

    I was able to run Gui programs (...) without the need of copying the plugins dll's

    That doesn't happen on its own and Qt installer doesn't set it up this way as far as I know.
    This would happen if you have your plugin directory added to the system PATH. If your new installation dir is different (e.g. has the version number in it) this would also explain why it stopped working - you still have the old dir in your PATH.

    Check your PATH. Btw. if Qt is there this is a pretty bad setup and I would discourage this. It can mess up things if you have two versions of Qt installed side by side or some Qt based app picks this up accidentally. Keep your libraries local, that's a lot safer.



  • Thats the thing I dont get, I have checked the environment variables (which also includes PATH variable) and I have also checked the registry, but I have not found anything regarding the plugin directory.
    If PATH would contain the dir, it would explain it, just as you say. But it does not, and thats what I dont get.



  • Actually Qt's loading of plugins does not pay attention to the system PATH, it uses other means of obtaining the directory of qwindows.dll etc.

    Before 5.14.0 the most frequent method was to read the directory hardwired into Qt5Core.dll at install time (grep for qt_prfxpath, that's how your Qt version 5.12.6 could find the plugins it needed).

    But in 5.14.0 Qt got rid of that qt_prfxpath hardwired into Qt5Core.dll, it caused more problems than it solved. For example, windeployqt patched that path to "." More here https://bugreports.qt.io/browse/QTBUG-14150

    There are lots of other alternatives to inform Qt where your plugins are, for example you can place a qt.conf file next to your .exe file, that looks like this:

    [Paths]
    Plugins=C:/Qt/5.14.0/msvc2017_64/plugins
    

    (Be sure to use forward slashes, backward slashes do not work)


Log in to reply