Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can't trouble running an executable file for my Qt Application
Forum Updated to NodeBB v4.3 + New Features

Can't trouble running an executable file for my Qt Application

Scheduled Pinned Locked Moved General and Desktop
exebuilddllqt5
15 Posts 7 Posters 10.5k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    harveyab
    wrote on 2 Apr 2015, 20:33 last edited by
    #3

    I have a similar situation. I am on Linux mint (two machines). I develop and build on one computer, and all is good. I put the executable file on the other and get similar errors.

    Is it possible/feasible to build so that EVERYTHING is in one file? I want to build utilities that do not require "installation". Simply copy the executable file and it works.

    How?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 2 Apr 2015, 21:34 last edited by
      #4

      Hi,

      @harveyab the only solution is a static build, but you'll have to follow the licensing constraints that comes with it.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      H 1 Reply Last reply 2 Apr 2015, 21:41
      3
      • S SGaist
        2 Apr 2015, 21:34

        Hi,

        @harveyab the only solution is a static build, but you'll have to follow the licensing constraints that comes with it.

        H Offline
        H Offline
        harveyab
        wrote on 2 Apr 2015, 21:41 last edited by
        #5

        @SGaist Can I try it on my own systems before I buy? What Qt package do I need to do static build? I have only "community" (free) so far. Will it do it?

        J 1 Reply Last reply 3 Apr 2015, 00:13
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 2 Apr 2015, 21:50 last edited by
          #6

          There's no pre-built static package, you have to compile it yourself. For your own use, there's no problem.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • A Offline
            A Offline
            alex_malyu
            wrote on 3 Apr 2015, 00:12 last edited by
            #7

            Proper static build depending on Qt version is more challenging than provide dependencies.
            I would advice against it especially for your case.

            H 1 Reply Last reply 4 Apr 2015, 06:12
            0
            • H harveyab
              2 Apr 2015, 21:41

              @SGaist Can I try it on my own systems before I buy? What Qt package do I need to do static build? I have only "community" (free) so far. Will it do it?

              J Online
              J Online
              JKSH
              Moderators
              wrote on 3 Apr 2015, 00:13 last edited by
              #8

              @harveyab said:

              Can I try it on my own systems before I buy?

              Depending on what kind of license you want, you may not need to buy anything.

              For example, you can continue using the Community (free) version if you follow the terms of the LGPL.

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              1 Reply Last reply
              0
              • H Offline
                H Offline
                harveyab
                wrote on 4 Apr 2015, 06:00 last edited by
                #9

                Thanks all for your responses. I have some basic understanding of the Windows dlls but does Linux have an equivalent?

                What are the options in Linux if I don't do a static build that gets everything into one executable file? And if I do a static build, will a bunch of stuff get included that is not actually used or needed in the particular program? Is the static build a build of the Qt packages that then gets linked in to and becomes part of any program I link with it, or is it that I do a static link of whatever program so it gets linked with only what it needs?

                Please explain (or direct me to a clear description.)

                J 1 Reply Last reply 4 Apr 2015, 14:20
                0
                • A alex_malyu
                  3 Apr 2015, 00:12

                  Proper static build depending on Qt version is more challenging than provide dependencies.
                  I would advice against it especially for your case.

                  H Offline
                  H Offline
                  harveyab
                  wrote on 4 Apr 2015, 06:12 last edited by
                  #10

                  @alex_malyu Why do you say that; "advise against it". Ultimately I would want an all in one file if I ever release the program(s) to the public. And for testing purposes, I have my second Linux computer that does not have Qt installed, which I would like to keep that way from the start, so that I would know that any program I test on it really has no external dependencies. If the executable file becomes quite large because of a static build (which I expect it would), would that really be worse than installing a bunch of other files all over the place for anyone who wants to use my program? Dlls would have been a better idea if there weren't so many ways that your system can break when installs and uninstalls fail leaving an ever increasing state of chaos (especially in MS Windows).

                  K 1 Reply Last reply 4 Apr 2015, 14:11
                  0
                  • H harveyab
                    4 Apr 2015, 06:12

                    @alex_malyu Why do you say that; "advise against it". Ultimately I would want an all in one file if I ever release the program(s) to the public. And for testing purposes, I have my second Linux computer that does not have Qt installed, which I would like to keep that way from the start, so that I would know that any program I test on it really has no external dependencies. If the executable file becomes quite large because of a static build (which I expect it would), would that really be worse than installing a bunch of other files all over the place for anyone who wants to use my program? Dlls would have been a better idea if there weren't so many ways that your system can break when installs and uninstalls fail leaving an ever increasing state of chaos (especially in MS Windows).

                    K Offline
                    K Offline
                    kroman
                    wrote on 4 Apr 2015, 14:11 last edited by kroman 4 Apr 2015, 16:44
                    #11

                    @harveyab said:

                    If the executable file becomes quite large because of a static build (which I expect it would), would that really be worse than installing a bunch of other files all over the place for anyone who wants to use my program? Dlls would have been a better idea if there weren't so many ways that your system can break when installs and uninstalls fail leaving an ever increasing state of chaos (especially in MS Windows).

                    You can put all necessary dlls into one single directory (where exe-file lives), so your Qt-based program will work with no external dependency (outside your program directory) at all.
                    For easy distribution you can bundle all files into one single zip-archive or create installation file using NSIS or InnoSetup (they are free).
                    Written above is true for Linux too. There are so-files (brothers of Windows dlls) and ldd command line utility - depends.exe analogue on Windows.

                    1 Reply Last reply
                    0
                    • H harveyab
                      4 Apr 2015, 06:00

                      Thanks all for your responses. I have some basic understanding of the Windows dlls but does Linux have an equivalent?

                      What are the options in Linux if I don't do a static build that gets everything into one executable file? And if I do a static build, will a bunch of stuff get included that is not actually used or needed in the particular program? Is the static build a build of the Qt packages that then gets linked in to and becomes part of any program I link with it, or is it that I do a static link of whatever program so it gets linked with only what it needs?

                      Please explain (or direct me to a clear description.)

                      J Online
                      J Online
                      JKSH
                      Moderators
                      wrote on 4 Apr 2015, 14:20 last edited by
                      #12

                      @harveyab said:

                      I have some basic understanding of the Windows dlls but does Linux have an equivalent?

                      Shared libraries are called DLLs ("Dynamic Link Libraries") in Windows, and SOs ("Shared Objects") in Linux. They are essentially the same. For example, if your program requires Qt5Core.dll and Qt5Gui.dll to run in Windows, a Linux build of your program requires Qt5Core.so and Qt5Gui.so.

                      What are the options in Linux if I don't do a static build that gets everything into one executable file?

                      Same as Windows: Provide the required shared libraries with your executable.

                      Alternatively, you could install the libraries to a system-wide location, but that's often not recommended.

                      And if I do a static build, will a bunch of stuff get included that is not actually used or needed in the particular program?

                      I'm not entirely sure as I usually don't use static linking, but I think only the libraries you need get embedded into your executable.

                      Is the static build a build of the Qt packages that then gets linked in to and becomes part of any program I link with it, or is it that I do a static link of whatever program so it gets linked with only what it needs?

                      There's a nice diagram at http://stackoverflow.com/questions/311882/what-do-statically-linked-and-dynamically-linked-mean (replace "crtlib" with Qt libraries)

                      See also http://stackoverflow.com/questions/1993390/static-linking-vs-dynamic-linking

                      @alex_malyu Why do you say that; "advise against it".

                      I'm guessing it's because it's very a lengthy process that's not strictly necessary. If you're willing to take the time to learn it, then there's no problem (aside from the time involved)

                      Ultimately I would want an all in one file if I ever release the program(s) to the public.

                      If you want only 1 binary file at the end of the process, then you need to take the static linking route.

                      Just be aware of licensing implications. This is a currently a legal grey area, but the commonly accepted wisdom says that if you statically-link your program to the Community edition of Qt, then your program must be released under the GPL/LGPL. You have fewer restrictions with dynamic linking.

                      And for testing purposes, I have my second Linux computer that does not have Qt installed, which I would like to keep that way from the start, so that I would know that any program I test on it really has no external dependencies.

                      I test deployments on my dev machine by temporarily moving my Qt dev folder away from its usual location. That makes it unfindable, so programs on my system think I don't have Qt installed.

                      If the executable file becomes quite large because of a static build (which I expect it would), would that really be worse than installing a bunch of other files all over the place for anyone who wants to use my program? Dlls would have been a better idea if there weren't so many ways that your system can break when installs and uninstalls fail leaving an ever increasing state of chaos (especially in MS Windows).

                      It sounds like there are only 2 options in your mind:

                      1. Produce one large statically-linked executable
                      2. Produce one small dynamically-linked executable, and have your users install Qt libraries in a system-wide location that everyone has access to.

                      In reality, developers use a 3rd option nowadays:

                      1. Produce one small dynamically-linked executable, and include local copies of the dependencies with your app installer. No chaos -- these DLLs/SOs are exclusively for this app only, and not accessible to other apps.

                      This means there's no significant difference in total file size of your distribution, whether you go with static or dynamic linking. With Qt 5.4, the benefits of dynamic linking are: (1a) licensing flexibility, and (1b) no need to compile Qt yourself. The benefit of static linking is: (2) No need to think about which libraries to deploy.

                      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                      1 Reply Last reply
                      1
                      • S Offline
                        S Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on 4 Apr 2015, 20:36 last edited by
                        #13

                        To add to @JKSH, static libraries can link to shared libraries. e.g. On Windows even if you build Qt statically by default it's linked to the dynamic runtime of MSVC. In any case, static linking should only pull in what your software uses (and its own dependencies)

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • H Offline
                          H Offline
                          harveyab
                          wrote on 4 Apr 2015, 21:33 last edited by
                          #14

                          Thank you all for your good answers. Now I have a better understanding and some options that sound not so bad as I thought.

                          1 Reply Last reply
                          0
                          • K koahnig
                            2 Apr 2015, 19:01

                            Hi and welcome to devnet

                            When copying an executable to another machine you need to have also all required dlls. Please check the windows deployment guidelines.

                            You have started correctly by copying the Qt dlls to the folder with the executable. Howver, you need some more. libwinpthread-1.dll and libstdc++6.dll are dlls required by the compiler you are using.

                            You should use depends for checking additional dependencies. You have to be also aware of the platform plugins as listed in the link above.

                            The dependcy walker (depends.exe) can be downloaded.

                            R Offline
                            R Offline
                            Robert Lech
                            wrote on 6 Apr 2015, 23:03 last edited by
                            #15

                            @koahnig Thank you very much for your help. Your link explained some concepts to me. I had the "The procedure entry point _ZN10QArrayData10deallocateEPS_jj could not be located in the dynamic link library Qt5Core.dll." error message and wasn't sure how to deal with it. I realized I was using only .dll files from the C:\Qt\Tools\QtCreator\bin directory. When I used the .dll files from the C:\Qt\5.4\mingw491_32\bin directory -- including libstdc++6.dll which i should have just tossed into my build folder, my issues disappeared. This makes sense since I was using that MinGW instance to do my compiling. This forum question helped my problem more specifically.

                            Dependency Walker is still stating that I'm missing these files:
                            API-MS-WIN-CORE-COM-L1-1-0.DLL
                            API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
                            API-MS-WIN-CORE-WINRT-L1-1-0.DLL
                            API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
                            API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
                            API-MS-WIN-SHCORE-SCALING-L1-1-0.DLL
                            DCOMP.DLL
                            GPSVC.DLL
                            IESHIMS.DLL

                            These are .dll files which some forums tell me are only side problems of something unrelated.

                            1 Reply Last reply
                            0

                            12/15

                            4 Apr 2015, 14:20

                            • Login

                            • Login or register to search.
                            12 out of 15
                            • First post
                              12/15
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved