Which DLL files to need to run exe files in other computer?



  • Hi all,

    Currently I have finished a small application with QT. I copied Build and Debug folders to other computers to test (without installing QT). When I ran exe files, I got the error message "The program can't start because QT5core.dll is missing__". Which DLL files to need to run exe files in other computer?

    When I copy project folder - was build and generate to bin folder - from my computer to anothers. It shows "The program can't start because QT5core.dll is missing".

    Will I install QT to another computer for get all of QT dll - It arround 2gb. I think it's not good solution. Because when I want to transfer it to customer. He will not like to install this software for just seeing program.

    I tried to use NSIS but I don't know how to get dll from my machine. And what dll will I need for move to build folder.

    Thanks for any solutions from you.


  • Moderators



  • I used "qmake" and "mingw32-make debug-all" . It generate .exe file in debug folder. I copy Qt5Core.dll , Qt5Gui.dll , Qt5Widgets.dll to application folder (It's nearly .pro file - paralle with debug folder). It didnt' work.



  • Hi LeeMinh.
    To debug mode, try with Qt5Cored.dll, Qt5Guid.dll , Qt5Widgetsd.dll

    Regards



  • It show *icuin51.dll * is missing too after I copy 3 dll files to debug folder.



  • Hi,

    1. When you want to deploy your application, please compile it under release mode instead of debug mode.

    2. You can use microsoft tool "process explorer ", to find all the dlls used in your application.


  • Moderators

    [quote author="LeeMinh" date="1374492589"]It show *icuin51.dll * is missing too after I copy 3 dll files to debug folder.[/quote]Then copy icuin51.dll into your folder.

    In the link I posted, read "Creating the Application Package" -- it lists many DLLs that you need



  • "Qt relies on the ICU library for unicode support. Therefore, you must include the ICU DLLs that are located in the bin directory of your Qt installation if Qt was configured to use ICU. The Qt version bundled in the Qt5 package uses ICU, so deployment is needed there. The ICU DLLs are version dependent and have to match the ones your Qt version was linked against."- Creating the Application Package

    Is it right?


  • Moderators

    From that paragraph, scroll down some more. You will see a few lists/tables of DLLs.



  • Dear JKSH.
    Thanks for your sugesstion. There are dll files which I copy to release folder - It contain excute file.

    Qt5Core.dll
    Qt5Gui.dll
    Qt5Sql.dll
    Qt5Widgets.dll
    icudt51.dll
    icuin51.dll
    icuuc51.dll
    libgcc_s_dw2-1.dll
    libstdc++-6.dll
    libwinpthread-1.dll

    So, I have another question. What will we do if we want to move these dll to another folder such as lib folder. I think that it will be clearly if we move these dll to a clearly name folder . It also we will not hold on it at release folder.



    1. You need re-read the documentation “Creating the Application Package” .
    • The windows platform plugin must be deployed, it's required by all the GUI application.
    • Seems that Qt5Sql.dll is deployed by yourself. so it nearly sure that database plugins is needed by your application.
    • other plugins such as imageformats is required if you used .gif/.jpg/... files in your application.
    • ...
    1. Please use a process tool such as Microsoft's process explorer to monitor your application, so you can easily find out all the dlls needed by your application.


  • Will I must copy these dll - I comment above - (in C:\Qt\Qt5.1.0\5.1.0\mingw48_32\bin) to RELEASE folder?

    I cant' copy them to another folder such as \MyProject\Myresources\Mylib folder?



  • When I copy to target machine. It show

    This application has requested the Runtime to terminate it in an unusual way Please contact the application's support team for more information

    May you explain it for me. I'm looking forward to receiving your msg.
    Thanks,


  • Moderators

    [quote author="LeeMinh" date="1374553838"]When I copy to target machine. It show

    This application has requested the Runtime to terminate it in an unusual way Please contact the application's support team for more information

    May you explain it for me. I'm looking forward to receiving your msg.
    Thanks,[/quote]That means your program crashed. Does it run properly on your development PC?

    Did you remember to include platforms\qwindows.dll?

    What OS does your development PC use? What OS does your target PC use?

    [quote author="LeeMinh" date="1374551835"]Will I must copy these dll - I comment above - (in C:\Qt\Qt5.1.0\5.1.0\mingw48_32\bin) to RELEASE folder?

    I cant' copy them to another folder such as \MyProject\Myresources\Mylib folder?[/quote]No. If you copy them to another folder, the .exe file can't find them. In Qt, only plugin DLLs are put in subfolders.

    All programs will look for DLLs in the same folder as the .exe -- that is normal. If you look inside C:\Program Files, you can see that most programs put the .dll files together with the .exe files.

    If you want to be tidy and clear, put a Shortcut on your desktop.



  • [quote author="JKSH" date="1374562273"]That means your program crashed. Does it run properly on your development PC?

    Did you remember to include platforms\qwindows.dll?

    What OS does your development PC use? What OS does your target PC use?[/quote]

    1.It's run fine when I run it on my development PC.

    2.I forgot include platforms\qwindows.dll.

    3.I use win7-32bit at development PC and target PC use win7-32bit too.

    I have been checking how to add platforms\qwindows.dll to my project.

    Will I copy it to \release\platforms\qwindows.dll and run executable file.

    It didn't work in here. Will I reconfigure something at .pro file?


  • Moderators

    [quote author="LeeMinh" date="1374564383"][quote author="JKSH" date="1374562273"]That means your program crashed. Does it run properly on your development PC?

    1.It's run fine when I run it on my development PC.[/quote][/quote]Sorry, I wasn't clear before: Does it run properly on your development PC, outside Qt Creator? Close Qt Creator, and run your program by launching the .exe file directly.

    [quote]3.I use win7-32bit at development PC and target PC use win7-32bit too.[/quote]Ok, that should be easier then. (Deployment is harder if you build on Windows 7 and transfer to Windows XP)

    [quote]I have been checking how to add platforms\qwindows.dll to my project.

    Will I copy it to \release\platforms\qwindows.dll and run executable file. [/quote]Yes, that is correct. Your folder should look like this:

    \release\application.exe
    \release\Qt5Core.dll
    \release\Qt5Gui.dll
    \release\Qt5Sql.dll
    \release\Qt5Widgets.dll
    \release\icudt51.dll
    \release\icuin51.dll
    \release\icuuc51.dll
    \release\libgcc_s_dw2-1.dll
    \release\libstdc++-6.dll
    \release\libwinpthread-1.dll
    \release\platforms\qwindows.dll

    (but maybe it needs more. Did you use "Process Explorer":http://technet.microsoft.com/en-au/sysinternals/bb896653.aspx, as suggested by 1+1=2?)

    [quote]It didn't work in here. Will I reconfigure something at .pro file?
    [/quote]No, the .pro file is only for compiling and linking.



  • When I copy a basic project to target PC. It work fine.



  • [quote author="JKSH" date="1374565818"]
    Sorry, I wasn't clear before: Does it run properly on your development PC, outside Qt Creator? Close Qt Creator, and run your program by launching the .exe file directly.
    [/quote]
    Yes,I close the Qt Creator and It run fine at development machine.



  • It's seem missing some dll when I ran real project at target machine.I use sqlite for database and some images for icon. That's all.



  • It show
    C:\Qt\Qt5.1.0\5.1.0\mingw48_32\plugins\imageformats\qgif.dl at Process Explorer.
    Will we create release\imageformats folder?


  • Lifetime Qt Champion

    Hi,

    The deployment documentation "plugins chapter":https://qt-project.org/doc/qt-5.0/qtdoc/deployment-windows.html#qt-plugins

    explains that.
    Basically you need to create the plugins folder and the needed subfolder like imageformats.

    appfolder
    appfolder\plugins
    appfolder\plugins\imageformats
    etc...

    I've written a doc note with some examples about it but it has been on moderation for some time now and I can't access it.



  • yes, thanks for your solution . But it didnt' work , Will we NEED reconfigure something at .pro file?

    After I add these folder.

    *appfolder\plugins*
    appfolder\plugins\accessible
    appfolder\plugins\imageformats
    appfolder\plugins\platforms
    appfolder\plugins\sqldrivers

    It didn't work. So that, I try with :

    *appfolder\release\plugins*
    appfolder\plugins\plugins\accessible
    appfolder\plugins\plugins\mageformats
    appfolder\plugins\plugins\platforms
    appfolder\plugins\plugins\sqldrivers

    It didn't work too.



  • remove the plugins from your paths please

    [quote author="LeeMinh" date="1374571023"]yes, thanks for your solution . But it didnt' work , Will we NEED reconfigure something at .pro file?

    After I add these folder.

    *appfolder\plugins*
    appfolder\plugins\accessible
    appfolder\plugins\imageformats
    appfolder\plugins\platforms
    appfolder\plugins\sqldrivers

    It didn't work. So that, I try with :

    *appfolder\release\plugins*
    appfolder\plugins\plugins\accessible
    appfolder\plugins\plugins\mageformats
    appfolder\plugins\plugins\platforms
    appfolder\plugins\plugins\sqldrivers

    It didn't work too.[/quote]


  • Lifetime Qt Champion

    The only exception is platform, it should be in appfolder directly so:

    appfolder\plaftorms
    appfolder\plugins\imageformats
    etc..



  • @SGaist : Do you mean that we* will not* put platforms and plugins to RELEASE folder. Will We put these folder to appfolder?



  • [quote author="SGaist" date="1374571281"]The only exception is platform, it should be in appfolder directly so:

    appfolder\plaftorms
    appfolder\plugins\imageformats
    etc..[/quote]

    Both
    @
    appfolder\plugins\imageformats
    @
    and
    @
    appfolder\imageformats
    @

    can be used.

    But if we use the former, a configure file called qt.conf is needed. while the latter doesn't need this file.



  • [quote author="SGaist" date="1374571281"]The only exception is platform, it should be in appfolder directly so:

    appfolder\plaftorms
    appfolder\plugins\imageformats
    etc..[/quote]

    Both
    @
    appfolder\plugins\imageformats
    @
    and
    @
    appfolder\imageformats
    @

    can be used.

    But if we use the former, a configure file called qt.conf is needed, or the plugins path should manually set in the source code. while the latter doesn't need this.



  • It's still didn't work. May you access my machine by teamviewer?.

    I replace all of them by :

    @appfolder
    appfolder\accessible
    appfolder\imageformats
    appfolder\sqldrivers@

    @appfolder\release\plugins
    appfolder\release\plugins\accessible
    appfolder\release\plugins\mageformats
    appfolder\release\plugins\platforms
    appfolder\release\plugins\sqldrivers@

    But it didnt' work.



  • I put

    @appfolder\plugins
    appfolder\plugins\accessible
    appfolder\plugins\mageformats
    appfolder\plugins\platforms
    appfolder\plugins\sqldrivers@

    And write code:

    @int main(int argc, char *argv[])
    {
    qApp->addLibraryPath("../plugins");
    QApplication a(argc, argv);

    MainWindow w;
    w.show();
    
    return a.exec();
    

    }@ at main.cpp

    But it didnt' work. Just show "Microsoft Visual C++ runtime library".



  • I make some basic project for testing. It work fine if we use images , but if when I use sqlite for connect. It shows error “Microsoft Visual C++ runtime library”. I think that because we didn't reconfig plugins. So that, It shows error.


  • Moderators

    • Where did you put qsqlite.dll?
    • What compiler did you use?
    • How many copies of Qt do you have on your development PC?
    • Which package(s) of Qt did you install?
      ** Qt 5.1.0 for Windows 32-bit (MinGW 4.8, OpenGL, 666 MB)?
      ** Qt 5.1.0 for Windows 64-bit (VS 2012, 525 MB)?
      ** Something else?


  • Hi, I'm trying to solve the same problem. I do believe that the issue I have has something to do with QML. But I'm not sure. I copied all the DLLs the program requested, but if I run it, I only get a blank window.

    I even tried to use q .qrc file, to include the .qml files in the .exe file. But with the same result.

    What bothers me most is that I don't know how to find out what is wrong. Even if I run the program from console, it doesn't show any message in it.


  • Moderators

    Hi Jech,

    Did you deploy the built-in QML-related files? You need the *.qml, qmldir and *.dll files in C:<Qt>\qml.



  • Yes, I did. I even tried to specify the path to these files either as absolute or relative but it didn't help. It used to work without any problems with Qt4, so I'm wondering why it is a problem with Qt5 now.

    Is there any possibility to debug the problem to at least find out if the problem is related to QML files or something else?

    Thank you!



  • Hi JKSH,
    just to be sure, you mean the 3 files in directory c:\Qt\5.2.0\mingw48_32\qml\QtQml\Models.2 ? I suppose they should be in the same directory as my .exe file. Or somewhere else?


  • Moderators

    Hi Jech,

    I mean _C:\Qt\5.2.0\mingw48_32\qml_ itself.

    These are your plugins folders:

    • C:\Qt\5.2.0\mingw48_32\plugins\ -- C++ plugins
    • C:\Qt\5.2.0\mingw48_32\qml\ -- QML plugins

    You need to copy some of the subfolders in these plugin folders. The exact combination that you need depends on the features that you use. Example:

    • <MyApp>\app.exe
    • <MyApp>\ qml\MyApp\main.qml ^
    • <MyApp>\ qml\MyApp\MyCustomQmlFile.qml ^
    • <MyApp>\Qt5Core.dll
    • ...
    • <MyApp>\QtQuick.2\qmldir
    • <MyApp>\QtQuick.2\qtquick2plugin.dll
    • <MyApp>\platforms\qwindows.dll

    The first 3 (italicized) lines are your project-specific files, which you should copy from your build directory. The rest should be copied from _C:\Qt\5.2.0\mingw48_32_ somewhere.

    The 2nd and 3rd (^) lines depend on your code. My example above assumes that you used Qt Creator's defaults for a new Qt Quick 2 project, so your main.cpp should have this line:
    @
    // Your deployment folder structure is shown below:
    viewer.setMainQmlFile(QStringLiteral("qml/MyApp/main.qml"));
    @

    An easy way is to copy all the subfolders of _c:\Qt\5.2.0\mingw48_32\qml_ into your .exe directory, and then launch your program. If it works, delete things one by one and try launching again, to see what you need and what you don't.



  • This is really strange. I copied everything from *C:\Qt\5.2.0\mingw48_32\plugins* and *C:\Qt\5.2.0\mingw48_32\qml* to the directory with my .exe file. The other .dll and .qml files are in their place too. But the result is still the same, I only get a blank window without any content and no error message is displayed.

    If I compile my program using Qt4, it is very easy to deploy it and I don't have any problems with it.

    Do you have any idea what I could try? For example is there a way I could get any debug information from the application. I have no idea what could be wrong. :-(


  • Moderators

    Maybe try deploying a Hello World QML app first, to figure out what you need. Once you succeed, then try deploying your complex app.

    [quote author="jech" date="1389000430"]I copied all the DLLs the program requested, but if I run it, I only get a blank window.[/quote]I just noticed this part. You'll need some DLLs that the program DOESN'T ask for too; you won't get popup messages for DLLs that are loaded dynamically AFTER the program starts running.

    See http://qt-project.org/doc/qt-5/windows-deployment.html -- use Dependency Walker to open your application.

    Note: You will get some false positives. Ignore the warnings about API-MS-WIN*.DLL, DCOMP.DLL and IESHIMS.DLL.

    Then, click "Profile" -> "Start Profiling...". This will reveal the dynamically-loaded DLLs.



  • Thanks a lot for your help and suggestions. I finally found out what I was missing. I simply copied all release **.dll files from from _c:\Qt\5.2.0\mingw48_32\bin_ and then by deleting them I only left those, which were necessary for my app to run. The 2 files I was missing were Qt5Multimedia.dll and Qt5MultimediaQuick_p.dll. I'm surprised I don't need any files from the ..\plugins and ..\qml directories.

    I tried to use Dependency Walker but I was not able to find out any useful information from the log. But it seems to be a very useful tool once I understand it. :-)

    Thanks a lot for your help.


  • Moderators

    You're welcome :)

    One last thing to try, do be safe: Rename your Qt SDK folder and launch your app again. Qt DLLs remember the absolute path where they came from, so your app might load some DLLs from your SDK folder instead of your deployment folder.

    Once you've finished testing this, rename your Qt SDK folder back.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.