Need help on proper way to deploy to Windows



  • I am trying to follow the instructions here: http://qt-project.org/doc/qt-5.0/qtdoc/deployment-windows.html

    But right off, I cannot even find the tool "configure" anywhere in my Qt directory. I did a Windows search which revealed a configure.prf but I cannot run it.

    I am trying to deploy a basic QML interface into a standalone executable. Can anyone point me in the right direction?


  • Moderators

    Do you mean you want to make your application static ?

    For that you need to compile Qt statically. First get the Qt source code for windows. When you extract it you will find configure.exe in it. Using this configure.exe pass proper flags to it to compile Qt statically using mingw or visual studio and then build your application using this Qt version.



  • Thanks. I used the online installed for Windows from here:

    http://qt-project.org/downloads

    I assume that was not the way to go about it? Are you saying that you cannot build a standalone (static) executable using one of the packages on this page?

    Instead, I should use this package: http://download.qt-project.org/official_releases/qt/5.1/5.1.0/single/qt-everywhere-opensource-src-5.1.0.zip

    Then unzip it, run configure from there? What are the flags I should use? I don't want to require Visual Studio to be installed on the system for the build process, so I assume Mingw is what I want?


  • Moderators

    No you can't. You have to build static Qt manually.

    Yes. You have downloaded the correct package. Extract and you will see configure.exe there.
    A typical configure step for static linking is

    ./configure -prefix $PWD -nomake demos -nomake examples -nomake tests -release -static -no-exceptions -no-webkit -qt-zlib -qt-libpng -qt-libjpeg -no-qt3support

    -static indicates static build.
    For more flags check configure.exe --help
    once it is configured you can use mingw to compile the source



  • Thanks, I think I need a tad more hand holding. Once it has been configured and after mingw is installed, how do I actually compile the source? I assume it is from the command line as well?


  • Moderators

    [quote author="qttester5" date="1376909531"]Thanks, I think I need a tad more hand holding. Once it has been configured and after mingw is installed, how do I actually compile the source? I assume it is from the command line as well?[/quote]
    You have installed the dynamic version of Qt, which is the standard way.
    It is not necessary to (re)compile Qt libs in general.
    When you have to compile a static version of Qt libs for windows you should download the source "from here":http://download.qt-project.org/official_releases/qt/5.1/5.1.0/single/qt-everywhere-opensource-src-5.1.0.zip

    Some information on static compilation of Qt libs are "found here":http://qt-project.org/wiki/How_to_build_a_static_Qt_version_for_Windows_with_gcceven though it is not uptodate.
    You can find some details for "an external site here":http://qt-project.org/forums/viewthread/30968/

    Note: Beware also the license implication when using static libs



  • Regarding the license implication, is there something about building a standalone executable that somehow requires a different license? Is the license only supposed to apply to executables running on a system with the Qt framework independently installed?



  • Also, I am curious why you mention that the dynamic version of the Qt is the standard way and that it is not necessary to recompile the source usually. How then can you build an application that can run on another computer if that computer does not have Qt installed? How are such applications typically deployed? Do they somehow install the Qt framework separately rather than build a standalone executable?


  • Moderators

    Checkout the "license conditions here":http://qt-project.org/products/licensing
    I am not a lawyer.

    However, to my understanding but with dlls you are more flexible in terms of using Qt libs with your own applications in case you want to distribute.

    For deployment of applications "with dlls you need to check this":http://qt-project.org/doc/qt-5.0/qtdoc/deployment-windows.html which referenced already. It depends on your preferences and those of the people you give your applications. Either it is good enough to use an archive or probably you can use an installer.



  • Ah, it looks like I misunderstood the initial response in this thread and that a static executable is not in fact the only way to distribute a Qt application onto a machine that does not have Qt installed, that I can use the shared library option which, as I think you describe, is in fact the typical way to do so. In which case I would simply provide the dlls for the Qt framework.

    When you say "good enough to use an archive" are you referring to a zip archive, they simply unzip and everything is in place?

    If I were to use an installer, what would you recommend?


  • Moderators

    [quote author="qttester5" date="1376915625"]
    When you say "good enough to use an archive" are you referring to a zip archive, they simply unzip and everything is in place?[/quote]
    Yes,
    [quote author="qttester5" date="1376915625"]
    If I were to use an installer, what would you recommend?[/quote]
    "There is a page":http://qt-project.org/wiki/Qt-Installer-Framework You can check also the tags on the right of your initial post.



  • The instructions on this page: http://qt-project.org/doc/qt-5.0/qtdoc/deployment-windows.html mention use of "nmake" however despite that Qt is installed on my system as a shared library environment (with Qt Creator) there is no nmake I can find anywhere, even after searching Windows.

    Furthermore, I am wondering if the Build & Run options within Qt Creator can do all of this for you, and create a directory with all the self-contained files in it, with proper libraries?


  • Lifetime Qt Champion

    Hi,

    nmake comes with Visual Studio


  • Moderators

    As commented by SGaist nmake comes with MSVC

    Just a more general note from C++-programmer's view, you can download and install Qt libs. However, those are in principle not good for anything when you want to do your own apps. You need in addition a compiler.
    On windows you got two principle choices MSVC and MinGW.
    MSVC (called also Microsoft Visual Studio) comes in different flavors/versions (2005-2013?). The express version comes for free and can be used with Qt creator as IDE. However, it cannot be distributed with Qt sdk, you have to download and install separately.
    MinGW is an opensource compiler suite. The Qt sdk for MinGW has the compiler included.



  • I installed the Windows online installer for Qt here, fourth on the list:

    http://qt-project.org/downloads

    If I want to actually build following the instructions on the Windows deployment page, which refer to nmake, do I instead need to install a different Qt SDK? I'm sorry of the question seems basic but this just isn't clear and I feel a bit lost on the overall process. I just need to get to the point where I can follow the approach to deploy with the shared libraries included in an archive and run an app on a machine that doesn't have Qt installed previously.


  • Moderators

    OK, no problem, that clears a bit the picture. The deployment page is something you do not have to worry about at the moment.

    Check the options you have installed. If you do not have MS Visual Studio (MSVC) and do not have a preference of using this, you should go for MinGW. This is probably easiest for you.

    Start the "Qt maintenance tool" and there the "package manager" you will find the install components.
    Under tools there should be "MinGW4.8 (32bit)" (This is the MinGW compiler) selected and under Qt 5.1.0 you should have the very same setting "MinGW4.8 (32bit)" (these are the Qt libs) selected (Android stuff and MSVC stuff, you probably do not need).

    In general that is all you have to do and after starting the Qt creator you can start with the tutorials "(e.g. Getting started)":http://qt-project.org/doc/qt-5.1/qtdoc/gettingstarted.html#creating-applications-using-qt



  • I have written some small test apps in Qt Creator but when I build them, the resulting binaries cannot be run on another system, only on mine, which has Qt installed. The key problem I have is how to build them for distribution to other computers.

    When I look at Maintenance Tool and try to click on Package Manager, it says "at least one valid and enabled repository required for this action to succeed."

    However I know I installed MinGW with Qt so it is there, but I don't know what settings in Creator to use to make sure I am building something that will stand on its own on another machine that does not have Qt installed?



  • If you want static linking:
    Buy qt commercial license. With static linking you don't need to have various qt dll s in your executable folder and only one exe file.
    For dynamic linking: {lgpl, commercial usage}
    use dependency walker to find all the dependencies like qtgui.dll, etc. The qt dependencies will be in QtInstallationFolder/bin. External third party dependencies like database or qwt will be in the bin where the these libraries where installed.
    If you are using nmake, you will also need two msvcp100.dll and msvcr100.dll. These are to be placed along side your exe or installed at client system using microsoft visual studio redistrubitable (vcredist_x86.exe). This is downloadable and redistrubitable.
    Then if you are using any plugins like image, or database, create a folder next to your exe file and name it as the folder was named in qt installation plugins folder. Thus all the codecs like qcncodec.dll will go to codecs folder. All imageformats like qgif4.dll will go to imageformats folder as it is named so in plugins folder.
    Now dependency walker will show all dependencies resolved. You can double click and open your exe.
    Use some packer to create a installer. There are lot of free and commercial packers. One of my favourites is innosetup. A very old and customizable is nsis. but it is too tenuous to understand.



  • This has been the clearest help yet, thank you. Where can I get the dependency walker you'd recommend with Qt, for example is this one good? http://kb.froglogic.com/display/KB/Analyzing+dependencies+with+Dependency+Walker


  • Moderators

    [quote author="qttester5" date="1377063064"]This has been the clearest help yet, thank you. Where can I get the dependency walker you'd recommend with Qt, for example is this one good? http://kb.froglogic.com/display/KB/Analyzing+dependencies+with+Dependency+Walker[/quote]
    The page you found is referencing the correct dependency walker. There is also some information on "this qt wiki page":http://qt-project.org/wiki/Show_library_dependencies#aea23489ce3aa9b6406ebb28e0cda430 Beware this page not completely up-to-date for Qt 5, since there are more dependencies than with Qt 4.

    Also the page you have posted contains already this information "in this section.":http://qt-project.org/doc/qt-5.0/qtdoc/deployment-windows.html#additional-libraries

    In another section there is "the reference":http://qt-project.org/doc/qt-5.0/qtdoc/deployment-windows.html#creating-the-application-package to an additional plugin as required for Qt5 on windows systems
    [quote]
    The Qt Windows platform plugin platforms\qwindows.dll
    [/quote]

    which is of vital importance.


Log in to reply
 

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