QT5 deploying on windows, mingw32



  • hello,
    being tired of always having to run QT Creator in order to execute my app i want to "deploy" (as they fancy call it) it on windows. My first thought? double click the mother-effer. Libs missing. So i copied them all (as seeing windows throwing error messages). I added the MSVC++ lib (for no apparent reason mingw32 requires it - or so google told me). And now i get this:

    Runtime Error!
    Program: %my program.exe%
    This application requested the runtime to terminate in an unusual way.
    Pls contact the applications suport team for more information.

    i contacted myself, then contacted google again, read a lot, couldn't find any usefull answer.
    i even copied my exe file into Qt creator\bin folder where all the dlls are and yet another interesting error occured:

    no input procedure (or sth like that) in _Z17qt_message_output9QtMsgTypeRK18QMessageLogContextRK7QString in Qt5Core.dll

    plus i'm not interested in building qt in static mode, i'd be more the satisfied with just copying the neccessary libs in the exe containing folder,

    plus2 dependency walker only warned my about missing msjava.dll which i'm to ignore as google suggested, not any other clues from him,

    any ideas?
    and if anything, please use simple language - like dont ask me what compiler my ICU was compiled with... keep it simpler then that please


  • Moderators

    In order to find out abut the dependencies of your application the best tool under windows is the "dependency walker as described in the wiki":http://qt-project.org/wiki/Show_library_dependencies#aea23489ce3aa9b6406ebb28e0cda430
    It tells from where the actual dlls have been loaded and you can check this way that there is no mix up.


  • Moderators

    Don't forget about copying the platform plugin.

    Also, since you mention it - ICU is very likely the cause of your problem. I won't ask you the question you don't want me to ask, but without answering it you probably won't be able to run you application... it's your choice.



  • i made a huge mistake here...



  • [quote author="koahnig" date="1371232871"]In order to find out abut the dependencies of your application the best tool under windows is the "dependency walker as described in the wiki":http://qt-project.org/wiki/Show_library_dependencies#aea23489ce3aa9b6406ebb28e0cda430
    It tells from where the actual dlls have been loaded and you can check this way that there is no mix up.
    [/quote]
    oh really?
    [quote author="comanderv" date="1371304524"]
    plus2 dependency walker only warned my about missing msjava.dll which i’m to ignore as google suggested, not any other clues from him,
    [/quote]
    nah...

    [quote author="sierdzio" date="1371304524"]
    Don’t forget about copying the platform plugin.

    Also, since you mention it – ICU is very likely the cause of your problem. I won’t ask you the question you don’t want me to ask, but without answering it you probably won’t be able to run you application… it’s your choice.
    [/quote]

    well then, what good is a compilator that can create an exe that can only be executed on one machine? QT is great, but it sucks if it comes to portability of execs on windows...

    anyhow i managed to copy all, and some more, dlls into my exe folder and it can be run on my computer without qt - great success,

    first it took me 1,3GB to launch my exe, then after a couple of minutes of selective delete and exe-check-if-can-run-without-this-dll it came down to 40MB ...

    but i send it over to my friend (same system - xp sp2) and he gets runtime, which i was recently told is triggered when the libs are either missing or plain wrong (as in evil kind of way wrong)... i'm really fed up with this now...

    well guess what else i suck at? editing my own posts -_-
    i'm sorry from the core of my CPU ...


  • Moderators

    Yeah, deployment of Qt5 on Windows is a pain.


  • Moderators

    [quote author="sierdzio" date="1371309678"]Yeah, deployment of Qt5 on Windows is a pain.[/quote]
    Is Qt5 as bad? ;-)

    I am doing Qt on windows for a couple of years now. So far, and I knock on wood, it worked. I have changed from msvc2005 to MinGW lately. The main issue is not mixing different version and their dlls. Therefore, you need to pay attention from where the dll is loaded. The problems come typically from other applications placing their installation path in environment path setting. The likelihood that one of these applications is using a compatible Qt dll is not high. I expect that the problem is not a major at the moment with Qt5, since it is almost brand new.

    There are two possibilities either inspecting the folders of each Qt dll where it is loaded from. depends.exe provides this information. Or you start depends from a cmd-prompt where you have erased all settings of the path environment variable. The latter ensures that have all dlls in the place of your application. You can start it and see that it is working and those dlls.

    The only issue lately with depends.exe is that apparently some of the windows stuff has been changed. So, depends.exe reports a couple of dlls as missing, but they are neither necessary nor anywhere found on the system.

    By summarizing I have to state that I am still using Qt4 (4.8.4 at the moment). So I am wondering if there would trouble when changing to Qt5 ;-)


  • Moderators

    I try to avoid Windows as much as I can (for private projects that means always, things are different at work, though ;)). On Linux, with my habit of compiling Qt and Creator myself, it's all nice and rosy so far. So for me, Qt5 is really great, especially when combined with clang.

    However, with Windows being such a crippled platform, and Qt5 introducing several new dependencies for build and deployment, it gets hard. I know I can manage it myself if need arises, but it's clearly visible that people new to Qt struggle a lot - and sadly a lot of them drop out simply because they get annoyed. And recently there are lots of people getting interested in Qt, you must have seen the amount of "newbie" threads around here lately.

    Also, there is an annoying effect that many of those new people do not read the documentation, or even refuse to read it when I provide them with a link... And Qt's docs are really great, also when it comes to deployment guides.



  • [quote author="sierdzio" date="1371323680"]
    Also, there is an annoying effect that many of those new people do not read the documentation, or even refuse to read it when I provide them with a link... And Qt's docs are really great, also when it comes to deployment guides.[/quote]

    i've never had chance to visit trolltech website but from what i have seen the documentation is indeed great if it comes to major and most used classes, for some cases documentation sucks - like tutorial on threads when documentation cleary says to subclass QThread (threaded fortune client/server) ... and if it comes to deployment these guides are written as if from QT creators for QT creators and sadly, in most cases, in my case almost useless.

    i've figure my friend cann't launch my exec because he's lacking msvc and mingw libs, which is nowhere to find in my QT folder, i'm having him install QT to confirm that.


  • Moderators

    You have your compiler in PATH, that is why you don't need those libs on your machine. Forcing your friend to install Qt in that case is more or less pointless.

    You may be looking at old documentation. QThread docs for Qt 4.8 and 5.x have been fixed some time ago.

    BTW. Trolltech does not exist for more than 5 years... ;) documentation is here on Qt Project website (and bundled with all releases, of course).


  • Moderators

    [quote author="comanderv" date="1371376430"]
    i've figure my friend cann't launch my exec because he's lacking msvc and mingw libs, which is nowhere to find in my QT folder, i'm having him install QT to confirm that.
    [/quote]
    [quote author="sierdzio" date="1371376680"]You have your compiler in PATH, that is why you don't need those libs on your machine. Forcing your friend to install Qt in that case is more or less pointless.
    [/quote]

    I guess that this is more a windows thing, but the quoted text below had its sense, because of that.

    [quote author="koahnig" date="1371232871"]
    It tells from where the actual dlls have been loaded and you can check this way that there is no mix up.
    [/quote]
    [quote author="koahnig" date="1371322539"]
    Or you start depends from a cmd-prompt where you have erased all settings of the path environment variable. The latter ensures that have all dlls in the place of your application. You can start it and see that it is working and those dlls.
    [/quote]
    Cleaning (erasing) out under cmd-prompt helps quite a lot in that respect.


  • Moderators

    I have updated the "wiki entry for dependency checking":http://qt-project.org/wiki/Show_library_dependencies#277b62cc3cfe1a1ecfa66f8bd25d7e3f with an example.

    Hope that helps :-)



  • yeah as you predicted it was kinda pointless, my friend wasn't able to run the exe, but anyhow i forced him to compile it in QT Creator and he launched it but it still kinda failed due to my ports being closed, as its based on tcp communication - big surprise here ...

    i cleared my path var (after running dependency walker - which suggests me to get msjava.dll for my c++ app - ignored it) and surprise surprise, my app still launches on my computer while throwing runtime on my friend's.

    and yeah, trolltech is down for a long time but on many forums there are still links to that website, plus harmattan-dev.nokia.com which also 504s or 404s me all the time...



  • I share your frustration on this one, Qt is very easy to get start with, but the deployment is a very difficult/steep learning curve.

    From what I was reading (and from my own experience) it sounds strange that you have need for the MSVC libraries. As far as I know the only reason you would need those libraries is if you use the MSVC compiler. If you installed Qt SDK (includes Qt Creator + MinGW + some other stuff) then all the libraries you need will be in the MinGW folders.

    Note that you may find multiple copies of certain files, this is because Qt Creator itself uses Qt .dll files (as though it is itself a Qt project). It is important therefore to take only the .dll files from your compiler folder locations. For example "Qt5Core.dll" can be found:

    C:\Qt\Qt5.0.2\5.0.2\mingw47_32\bin
    or
    C:\Qt\Qt5.0.2\Tools\QtCreator\bin

    You should always select the one under the mingw folder.

    Once the right combination of files is achieved (easy, no?) then your "package" should run stand alone.

    I also note that you mention that you have only 40mb of .dll files. Just to compare to my project, I have 124mb of .dll files and my project is really basic and possibly similar to yours. I use: QUdpSocket, QThreads, QTimers, XML and a few other basic Qobjects), its a console app so no GUI even!. Here is the list of the dlls that I needed, maybe it gives you some hints?!:

    icudt49.dll
    icuin49.dll
    icuuc49.dll
    libgcc_s_sjlj-1.dll
    libstdc++-6.dll
    libwinpthread-1.dll
    Qt5Cored.dll (this is 70mb on its own)
    Qt5Newtorkd.dll
    Qt5Xmld.dll

    Note: these are hand-copied so there maybe a type error so don't copy paste to look for them!

    I am running my Qt Deployment on wine (for running windows apps under linux if you have not heard of it) under linux so I am pretty sure that everything I need is now with my project.

    So summary, a few things to check:

    • Why are you using MSVC libs?
    • Check the paths that you get your .dll from (make sure they are the correct one)

    Hope something in all that helps...


  • Moderators

    [quote author="code_fodder" date="1371454771"]
    Qt5Cored.dll (this is 70mb on its own)
    Qt5Newtorkd.dll
    Qt5Xmld.dll[/quote]

    You should use release DLLs (not ending with 'd' which stands for debug). They are at least an order of magnitude smaller (QtCore is around 5MB, IIRC).



  • ah ha, thanks :) .... and I still don't have it completely right! :(


  • Moderators

    Those are the dlls I had to add for the installation on windows server (2012 IIRC)
    @
    01/17/2013 12:42 AM 100,864 libgcc_s_sjlj-1.dll
    01/17/2013 12:42 AM 1,062,912 libstdc++-6.dll
    01/17/2013 12:42 AM 71,680 libwinpthread-1.dll
    02/02/2013 08:02 PM 3,568,640 QtCore4.dll
    02/02/2013 09:54 PM 12,981,760 QtGui4.dll
    02/02/2013 08:05 PM 1,443,328 QtNetwork4.dll
    6 File(s) 19,229,184 bytes
    @

    Qt is compiled with recent MinGW 64 bit compiler.



  • [quote author="code_fodder" date="1371454771"]I share your frustration on this one, Qt is very easy to get start with, but the deployment is a very difficult/steep learning curve.

    From what I was reading (and from my own experience) it sounds strange that you have need for the MSVC libraries. As far as I know the only reason you would need those libraries is if you use the MSVC compiler. If you installed Qt SDK (includes Qt Creator + MinGW + some other stuff) then all the libraries you need will be in the MinGW folders.

    Note that you may find multiple copies of certain files, this is because Qt Creator itself uses Qt .dll files (as though it is itself a Qt project). It is important therefore to take only the .dll files from your compiler folder locations. For example "Qt5Core.dll" can be found:

    C:\Qt\Qt5.0.2\5.0.2\mingw47_32\bin
    or
    C:\Qt\Qt5.0.2\Tools\QtCreator\bin

    You should always select the one under the mingw folder.

    Once the right combination of files is achieved (easy, no?) then your "package" should run stand alone.

    I also note that you mention that you have only 40mb of .dll files. Just to compare to my project, I have 124mb of .dll files and my project is really basic and possibly similar to yours. I use: QUdpSocket, QThreads, QTimers, XML and a few other basic Qobjects), its a console app so no GUI even!. Here is the list of the dlls that I needed, maybe it gives you some hints?!:

    icudt49.dll
    icuin49.dll
    icuuc49.dll
    libgcc_s_sjlj-1.dll
    libstdc++-6.dll
    libwinpthread-1.dll
    Qt5Cored.dll (this is 70mb on its own)
    Qt5Newtorkd.dll
    Qt5Xmld.dll

    Note: these are hand-copied so there maybe a type error so don't copy paste to look for them!

    I am running my Qt Deployment on wine (for running windows apps under linux if you have not heard of it) under linux so I am pretty sure that everything I need is now with my project.

    So summary, a few things to check:

    • Why are you using MSVC libs?
    • Check the paths that you get your .dll from (make sure they are the correct one)

    Hope something in all that helps...[/quote]
    thanks for the effort man :)
    i used the dlls from mingw folder ofcourse, and as far as i have seen on my computer at least when trying to launch my exe all by itself with no libs it started shouting about missing ones, and it never mentioned anything conected to MSVC, in addition it didnt mention some libs it required to launch (neither did Dependecy Walker) ! how i know this? i coppied my exe to mingw folder and run it successfully after which i started a procedure of deleting a lib and trying to launch my exe....

    and i dont even have a MSVC on my computer but i can launch my app without running qt wheras the same exe with the same libs throws MSVC runtime on friends computer,
    and i'm even sure that qt 5.0.2 doesnt include it as my friend installed it and tried runnig the app - failed.

    another friend acustomed with QT deployment said that runtime is thrown when the libs are either missing or there is problem with versioning... so how come the same framework being installed throwing an error on the same operating system as mine ? he was confused as well...

    sorry if im not making sense in some parts, i did drink today...



  • [quote author="koahnig" date="1371459987"]Those are the dlls I had to add for the installation on windows server (2012 IIRC)
    @
    01/17/2013 12:42 AM 100,864 libgcc_s_sjlj-1.dll
    01/17/2013 12:42 AM 1,062,912 libstdc++-6.dll
    01/17/2013 12:42 AM 71,680 libwinpthread-1.dll
    02/02/2013 08:02 PM 3,568,640 QtCore4.dll
    02/02/2013 09:54 PM 12,981,760 QtGui4.dll
    02/02/2013 08:05 PM 1,443,328 QtNetwork4.dll
    6 File(s) 19,229,184 bytes
    @

    Qt is compiled with recent MinGW 64 bit compiler. [/quote]

    and those are the dlls i have to add to run my exe on MY AND ONLY MY computer (xp sp2 -why not.)

    @
    2013-06-11 10:49 18 025 758 icudt49.dll
    2013-06-11 10:49 3 090 303 icuin49.dll
    2013-06-11 10:49 1 808 899 icuuc49.dll
    2013-06-11 10:57 99 328 libEGL.dll
    2013-06-11 10:47 115 200 libgcc_s_sjlj-1.dll
    2013-06-11 10:57 968 704 libGLESv2.dll
    2013-06-11 10:47 895 488 libstdc++-6.dll
    2013-06-11 10:47 68 608 libwinpthread-1.dll
    2013-06-11 11:02 4 279 808 Qt5Core.dll
    2013-06-11 10:58 3 493 376 Qt5Gui.dll
    2013-06-11 10:59 1 130 496 Qt5Network.dll
    2013-06-11 11:00 5 210 624 Qt5Widgets.dll
    @
    the trickiest isliblEGL.dll because neither "missing dll error" nor Dependency Walker mention it but well...

    sorry for the double post... i cant quote withour using the Quote Link (date thing goes off...)



  • If I was you... I would try a simpler application "just to test that your environment is ok".

    What I mean by that is, make the simplest app you can from the "new project wizard thing", in this case a console application (no GUI). Make it do nothing more then the code that is already in there but maybe add a qDebug() << "hello" << endl; in there and then build that for release and test-deploy that.

    Your application will not need more then the dlls that I posted (because mine is a console with a few extras), and as mentioned dont use the debug version like I did :o .

    If you can deploy that successfully on your friends PC then at least we know the most basic things are working and we can go on from there and maybe identify what additions are not working for you...

    Also it might be interesting to see your .pro file, but I would test the simple app first just to see if that works :)



  • simple, console, doing-nothing application works like a charm both on my and my friend's PC.
    I used only the libs windows shouted missing while trying to launch exe.

    so... we know that the method is OK, but when trying the same thing with my little bigger gui app it fails... ideas?



  • It is difficult to say.... you could add in simple instantiations of all the objects you are using one by one until you find that one that is not working then we can see which libraries each requires... painful though :(

    What classes are you using? and what libraries (includes) are you bringing in?


  • Moderators

    The icu libs have something to do with unicode according to some post found through Google.

    There is also this post.

    [quote author="sierdzio" date="1371272019"]Don't forget about copying the platform plugin.

    Also, since you mention it - ICU is very likely the cause of your problem. I won't ask you the question you don't want me to ask, but without answering it you probably won't be able to run you application... it's your choice.[/quote]

    Are you using unicode?
    Is it really necessary to use?

    The optimum would be that you do not need it and it is easy to eliminate the dependency.

    Typically depends.exe shows all dll dependencies and lately some more than actually. It seem to be less a problem of depends.exe than more of the moving target windows. If it would fail to show missing dlls as well, the tool would be completely useless by now. Well, may be not completely, since you would get some part of the functionality.

    If you follow unicode in the Qt documentation you find "some specifics for windows":http://qt-project.org/doc/qt-5.0/qtdoc/internationalization.html#windows

    So my conclusion is either you are using unicode in some third party module or in your own, but not the Qt unicode. If you use Qt unicode, it should be in one of the Qt dlls.


Log in to reply
 

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