On the way of making an app installable



  • Hi all,

    I finished my app and ran it in both Debug and Release modes. And then made a folder named Cal on my desktop and brought the .exe file from the Release folder and put that .exe plus some .dll files onto it so that made it executable.

    My machine is a win 7 x64and use Qt Creator 5.7.
    My Cal folder is on this path: C:\Users\ME\Desktop\Cal
    And the Debug and Release folders are on this path: C:\Users\ME\Documents\Qt

    My purpose as the title says, is making the app installable to send it to others and be sure that it will be installed on their Windows machines as well.
    For this, I was advised to see and follow this Docs

    I read the first page and until now I have a question. It says: "All you need to do is to build Qt and your application in release mode..."
    Building the application means running it (because when we run some app it first will be built then run), but what does "building Qt" mean? Is Qt build-able!?

    After reading that page I went for the next Qt For Windows page there.

    I found the windeployqt.exe file in this path: C:\Qt\Qt5.7.0\5.7\mingw53_32\bin\windeployqt.exe

    Now I'm at the beginning of the dark cadre on how to use that executable file.
    It says: "The simplest way to use windeployqt is to add the bin directory of your Qt
    installation (e.g. <QT_DIR\bin>) to the PATH variable and then run:
    windeployqt <path-to-app-binary>
    "

    Does it mean I should run that .exe file from some folder's path (say, the Release or Cal folder)?

    Have I gone the way right?


  • Lifetime Qt Champion

    Hi,

    If you opened a Qt development console then you don't have to toy with path.

    Then, yes, windeployqt is the simplest to make your application "independent".

    No you don't have to build Qt yourself.

    Once you have that, you can use a package creator like the Qt Installer Framework, NSIS, Inno Setup, etc. to make an installer and thus make your application easy to install.



  • @SGaist said in On the way of making an app installable:

    Hi,

    If you opened a Qt development console then you don't have to toy with path.

    Hi,

    What is a Qt development console please? Is it a command prompt?

    Then, yes, windeployqt is the simplest to make your application "independent".

    No you don't have to build Qt yourself.

    Once you have that, you can use a package creator like the Qt Installer Framework, NSIS, Inno Setup, etc. to make an installer and thus make your application easy to install.

    OK, that's a good news, but, should I run that windeployqt file from a command prompt or just double click on it?


  • Lifetime Qt Champion

    Command prompt pre-configured for you. IIRC you may have it in the start menu.

    Command prompt also.



  • @SGaist said in On the way of making an app installable:

    Command prompt pre-configured for you. IIRC you may have it in the start menu.

    Command prompt also.

    I didn't find IIRC ( and haven't heard this) but have a normal command prompt and also MinGW 5.3.0 32 bit.

    So I go to my Release folder's path by ones of these command prompts and write windeployqt and hit enter. Right?

    MinGW 5.3.0 32 bit's path: C:\Qt\Qt5.7.0\5.7\mingw53_32

    command prompt's path: C:\Windows\system32\cmd.exe



  • @tomy Just a heads up - "IIRC" is an acronym for "If I remember correctly". :)



  • @Carmoneer
    Ow thanks. :D :D
    I'm not a native speaker of English, so informal speaking may make misunderstanding cases. :)



  • I did these:
    1- Using a Command Prompt went to the windeployqt's path and pasted the path of Release folder into <>:

    C:\Qt\Qt5.7.0\5.7\mingw53_32\bin>windeployqt <C:\Users\CS\Documents\Qt\build-Cal-Desktop_Qt_5_7_0_MinGW_32bit-Release\release>
    Result: The syntax of the command is incorrect.

    Once again this time I pasted the path of the Cal folder:
    C:\Qt\Qt5.7.0\5.7\mingw53_32\bin>windeployqt <C:\Users\CS\Desktop\Cal>
    Result, again: The syntax of the command is incorrect.

    If this is the simplest way to make an app installable, so how to run that .exe file please??


  • Lifetime Qt Champion

    Remove all these < and > from your command



  • @SGaist
    GOOD, something happened.
    My Release folder changed. It's now as follows:
    http://uploads.im/ViqNX.jpg

    Now what to do with them please?
    I mean what is the rest of the process? when I will reach the end please? It's a week I'm just looking for a way to make my app installable on other machines (and mine as well)


  • Lifetime Qt Champion

    I already suggested in a previous post to look for an installer creation framework.



  • Yes, you are right, sorry.

    I have all of these:
    qt-installer-framework-opensource-2.0.1-x86.run
    qt-installer-framework-opensource-2.0.1-x64.run
    qt-installer-framework-opensource-2.0.1-src

    And also two folders (Cal and Release) that I have used them for windeployqt by a Command Prompt.

    Now how to use these?



  • I have questions:
    Should I follow the process using here?
    If yes, which one of the above qt-installer-framework-opensources is pre-built, or which one should I use?

    Then should I follow from Setting up Qt Installer Framework there?


  • Lifetime Qt Champion

    Those ending with .run are pre-built, which one you use depends on your OS.



  • @SGaist said in On the way of making an app installable:

    Those ending with .run are pre-built, which one you use depends on your OS.

    OK. since my OS in a x64 Windows 7, I choose qt-installer-framework-opensource-2.0.1-x64.

    So I don't need the Building from Sources section and go directly to: Setting up Qt Installer Framework, yeah?

    I just don't understand these two:
    1- Clone the Qt Installer Framework source code from http://code.qt.io/cgit/installer-framework/installer-framework.git/ to get the sources for the tools.
    2- Build the tools by running the "qmake" from the static Qt, followed by "make" or "nmake".

    for (1-) since I want to use a .run one so I don't need the source one, yes?
    But I don't know how to do (2-) at all. :(

    I would be appreciative if your guide me on the way.


  • Lifetime Qt Champion

    Since you are installing the pre-built package, you don't need to do these.



  • Good, thanks.
    It seems that I should go here now. but isn't it for OS X?

    I want my app for Windows.


  • Lifetime Qt Champion

    No it's not. It just describes the various possibilities you can use.



  • OK. So I follow it.

    It says: Starting Installer

    When end users start the installer, the introduction page opens:
    Where is that installer please?


  • Lifetime Qt Champion

    These are just screenshots to illustrate the documentation. They don't necessarily indicate anything special except when there's an OS specific feature like Selecting Windows Program Group.



  • OK, whatever they are, fine. I want to continue the way to the end.
    Now what should I do then? Any other tuts, links?


  • Lifetime Qt Champion

    In the doc here.



  • so I created a folder on Desktop named package directory.

    For this:
    Place all components in the same root directory, which is called the package directory. The directory name acts as a domain-like identifier, which identifies all components. For example, com.vendor.root.

    what components does it mean? The qt-installer-framework-opensource-2.0.1-x64 and Release folder containing:
    http://uploads.im/aN8CQ.jpg

    ??


  • Lifetime Qt Champion

    Please take the time to read the linked pages.



  • @SGaist
    Actually as a habit, I read the pages/links but only when I find something unknown/strange, I post a question again.

    Frankly speaking, making an app installable is much much harder than creating the app itself. I would have never think it would be that difficult.

    Anyway, I go on the way and try to read all pages.



  • Hi, and thanks for your guidance.

    I went for creating a package directory on my Desktop with two subdirectories data and meta.

    Then using a Notepad I created a package.xml like this and put into meta subdirectory:

    <?xml version="1.0"?>
    -<Package>
    <DisplayName>Qt Calculator</DisplayName>
    <Description>A Calculator Written in Qt by Purely C++ Code</Description>
    <Version>1.1</Version>
    <ReleaseDate>2017-03-23</ReleaseDate>
    <Name>com.vendor.root.component2</Name>
    <Dependencies>com.vendor.root.component1</Dependencies>
    <Virtual>false</Virtual>
    <Default>false</Default>
    <ForcedInstallation>false</ForcedInstallation>
    <Essential>false</Essential>
    <Replaces>com.vendor.root.component2old</Replaces>
    </Package>

    My app is very simple I think. I just need a window that installs the app including the .dll files and puts a shortcut on the desktop on the target machine.
    I then went for this page section Predefined Installer Pages for going on the process.

    Have I done the work correctly up to now?

    A question:
    For the data subdirectory, the link says "The data directory contains the content that the installer extracts during the installation."
    What content does it mean? I have the Release folder plus qt-installer-framework-opensource-2.0.1-x86.run only.
    Should I package these as a 7zip archive and put into data subdirectory?

    Thanks so much.


  • Lifetime Qt Champion

    They mean whatever is needed to run your application. So basically, you usually copy the binary of your exec in an empty folder, run windeployt, check that everything is working, and then you package that.



  • @SGaist

    Thanks.

    What I have now:
    A packaeg_directory with a meta folder and a data.7z file in it.
    The meta folder contains a package.xml file.
    The data.7z archive file contains: the .exe file and related files and folders that were added to it after running windeployt, plus qt-installer-framework-opensource-2.0.1-x86.

    Then I continued to the Control Scpripting page.
    There I think I should write one or mor Control Scripts. There are a few versions there that each one adds some functionality and wizards to the installation process.
    The examples of codes are available there but the question is where and how to write them and then add them to the package_directoy?


  • Lifetime Qt Champion

    Why are you adding qt-installer-framework-opensource-2.0.1-x86 to your installer ?



  • @SGaist
    I hadn't used it until now and thought it should be probably added to there. I just guessed. :(

    OK, I will remove it from there.

    And what then please?


  • Lifetime Qt Champion

    Are you following the tutorial here ?



  • @SGaist

    Summary:

    I have a package_directory folder on my Windows Desktop with these sub-folders. The config.xml file contains this. The data subfolder contains the data.7z file. The meta subfolder contains a package.xml file with this content.

    following the link, I got to the Creating the Installer Binary where it says:
    On Windows:
    ....\bin\binarycreator.exe -c config\config.xml -p packages YourInstaller.exe

    Whatever I searched I didn't find a .exe file named binarycreator. After searching the Web, I downloaded QtInstallerFramework-win-x86.exe from here and installed it and finally could find that .exe file in path: C:\Qt\QtIFW2.0.3\bin\binarycreator.exe

    Now everything is ready to implement the command above. So by a command like I went to the path of package_directory on my Desktop and typed C:\Qt\QtIFW2.0.3\bin\binarycreator.exe -c config\config.xml -p packages YourInstaller.exe and hit Enter.

    The message of the command line, as stated in the following, is seemingly all about the package.xml file.

    0_1486717978694_upload-c042a463-6e2c-4cdf-98f6-3a42621bb960

    And no installer is created on my package_directory folder unfortunately. :(

    Would you please tell me how to solve this?



  • My last works:

    1- I changed the file config.xml to this.
    2- Created a licens.txt file on my Desktop and changed the file package.xml to this.

    3- Created a folder named Result on my Desktop and pasted the Cal.exe file from the Release folder onto it.
    4- Ran this command.

    Now what is the problem please?


  • Lifetime Qt Champion

    Put the license in the same folder as your script.

    On a side note, you are using single backslashes in your path which mean you are escaping characters.



  • @SGaist

    @SGaist said in On the way of making an app installable:

    Put the license in the same folder as your script.

    Do you mean into the meta folder?

    On a side note, you are using single backslashes in your path which mean you are escaping characters.

    Do you mean that I should use double-backslashes for my paths, like below?

    C:\Qt\QtIFW2.0.3\bin\binarycreator.exe -c C:\Users\CS\Desktop\package_directory\config\config.xml -p C:\Users\CS\Desktop\package_directory\packages C:\Users\CS\Desktop\Result\Cal.exe

    It seems rather odd! (Each single backslash to be changed to a double-backslashes)


  • Lifetime Qt Champion

    In the same folder as package.xml

    I mean again in package.xml. Don't mix command line and text file content.



  • @SGaist
    OK, I copied the license.txt onto the mate folder (where the package.xml exists).
    And changed package.xml license section to this:

    <Licenses>
            <License name="Beer Public License Agreement" file="C:\\Users\\CS\\Desktop\\license.txt" />
        </Licenses>
    

    And then ran the command.
    Again the same result.
    http://uploads.im/d2bNT.jpg


  • Lifetime Qt Champion

    If it's in the same folder then there's no need to put any path, just the file name



  • Thank you, it worked. :)

    But one question and one issue!

    The question: I'd changed the config.xml to this and package.xml to this.

    When I ran the command line, I got an issue about the Name tag as follows:

    [1] Warning: The <Name> tag in the 'C:/Users/CS/Desktop/package_directory/packag
    es/com.vendor.product/meta/package.xml' is ignored - the installer uses the path
    element right before the 'meta' ('com.vendor.product').
    C:\Qt\QtIFW2.0.3\bin>

    Should I ignore it? If not how to solve it, too, please?

    The issue: The installer file exists in the Result folder on Desktop. When I install it and select a folder on Start Menu (say Accessories or Start Up) to have the shortcut of the program, no shortcut will be created or saved there!! :(

    What is the reason for that problem and how should I solve it please?


  • Lifetime Qt Champion

    Fix the Name entry in your package.xml. It should be a domain-like identification.


Log in to reply
 

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