Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Static build Qt 5.9.2 using MinGw on Windows 10
Forum Updated to NodeBB v4.3 + New Features

Static build Qt 5.9.2 using MinGw on Windows 10

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
9 Posts 3 Posters 3.4k Views 1 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.
  • D Offline
    D Offline
    drmhkelley
    wrote on 1 Nov 2017, 18:29 last edited by
    #1

    I am having trouble making fully independent, statically-linked apps using MinGw 7.1 and Qt 5.9.2 on Windows 10 - the symptom is missing dlls at run-time.

    For background, I have successfully built Qt 5.9.2 using MinGw 7.1, and have successfully used this build on a number of somewhat complex (i.e. they require multiple homegrown and 3rd-party libraries) Qt projects. I use multiple computers but only have MinGw, Qt and some of the 3rd party libraries on one of them. In order to use the Qt apps on all of my systems, I am trying to get a static build of the Qt apps. FWIW, I already have multiple non-Qt apps that I have statically linked and use in this fashion.

    To accomplish statically-linked Qt apps, I have also built a statically-linked version of Qt5.9.2 (configure -static ...), which largely appears to work correctly. Unfortunately, when I try to run any Qt apps in a standalone fashion (a bit more about my testing strategy below), I get two run-time errors, each of the form

    "The code execution cannot proceed because [dll] was not found. ...".

    The missing dlls are libgcc_s_dw2-1.dll and libstdc++-6.dll, both of which are part of the standard MinGw libraries.

    For test purposes, I used the standard Qt example program ..../Examples/Qt-5.9.2/widgets/mainwindows/application/

    The way I test whether the statically-linked app likely to run on the other machines is to simply create a local environment with a restricted definition of the PATH environmental variable (This strategy has been useful and effective for many prior apps). The above-reference error happens when I don't include the standard MinGw libraries in my path. NOTE: paths for the Qt and other libraries don't need to be in PATH. If the MinGw path is included, the example app works fine - without it, the app fails.

    Any suggestions for finding out who is requiring these dlls and how to get that required functionality statically linked?

    Thanks in advance

    K 1 Reply Last reply 1 Nov 2017, 18:46
    0
    • D drmhkelley
      1 Nov 2017, 18:29

      I am having trouble making fully independent, statically-linked apps using MinGw 7.1 and Qt 5.9.2 on Windows 10 - the symptom is missing dlls at run-time.

      For background, I have successfully built Qt 5.9.2 using MinGw 7.1, and have successfully used this build on a number of somewhat complex (i.e. they require multiple homegrown and 3rd-party libraries) Qt projects. I use multiple computers but only have MinGw, Qt and some of the 3rd party libraries on one of them. In order to use the Qt apps on all of my systems, I am trying to get a static build of the Qt apps. FWIW, I already have multiple non-Qt apps that I have statically linked and use in this fashion.

      To accomplish statically-linked Qt apps, I have also built a statically-linked version of Qt5.9.2 (configure -static ...), which largely appears to work correctly. Unfortunately, when I try to run any Qt apps in a standalone fashion (a bit more about my testing strategy below), I get two run-time errors, each of the form

      "The code execution cannot proceed because [dll] was not found. ...".

      The missing dlls are libgcc_s_dw2-1.dll and libstdc++-6.dll, both of which are part of the standard MinGw libraries.

      For test purposes, I used the standard Qt example program ..../Examples/Qt-5.9.2/widgets/mainwindows/application/

      The way I test whether the statically-linked app likely to run on the other machines is to simply create a local environment with a restricted definition of the PATH environmental variable (This strategy has been useful and effective for many prior apps). The above-reference error happens when I don't include the standard MinGw libraries in my path. NOTE: paths for the Qt and other libraries don't need to be in PATH. If the MinGw path is included, the example app works fine - without it, the app fails.

      Any suggestions for finding out who is requiring these dlls and how to get that required functionality statically linked?

      Thanks in advance

      K Offline
      K Offline
      koahnig
      wrote on 1 Nov 2017, 18:46 last edited by
      #2

      @drmhkelley

      AFAIK will you have always to use those dlls which are from the MinGW compiler.

      When you have recompiled Qt for static linking this is only the compilation of Qt linking everything to full libs instead of the stubs required as for dlls.

      Try to create a static hello world or a bit more application without involving Qt. My guess is that you will require those dlls regardless of not having any bit of Qt libs used. Therefore, the best place would be in the MinGW forum to find a solution where no MinGW dlls required.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • D Offline
        D Offline
        drmhkelley
        wrote on 1 Nov 2017, 19:25 last edited by
        #3

        As I mentioned in my original post, I have quite a number of other applications that DO NOT require those (or any other) MinGw libraries to be present at run-time.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on 1 Nov 2017, 19:48 last edited by
          #4

          Sorry, did not see that you mentioned that in your post.

          I remember some discussions along those lines and I think there was no solution and for some reason these dlls are required, but I could be wrong.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • D Offline
            D Offline
            drmhkelley
            wrote on 1 Nov 2017, 20:06 last edited by
            #5

            Yes, I saw many such discussions. Some of them even reported success, but always for somewhat different circumstances than mine. Most importantly, I do not recall seeing any that identified why it "shouldn't" be possible to build apps fully statically-linked. Since I successfully do that for non-Qt apps, I'd like for someone to point out why it is impossible for Qt apps. My suspicion is that there is something in the Qt build process, which is a bit to complex for me to follow in its entirety, that leads to this outcome.

            J 1 Reply Last reply 1 Nov 2017, 20:25
            0
            • D drmhkelley
              1 Nov 2017, 20:06

              Yes, I saw many such discussions. Some of them even reported success, but always for somewhat different circumstances than mine. Most importantly, I do not recall seeing any that identified why it "shouldn't" be possible to build apps fully statically-linked. Since I successfully do that for non-Qt apps, I'd like for someone to point out why it is impossible for Qt apps. My suspicion is that there is something in the Qt build process, which is a bit to complex for me to follow in its entirety, that leads to this outcome.

              J Offline
              J Offline
              JonB
              wrote on 1 Nov 2017, 20:25 last edited by JonB 11 Jan 2017, 20:26
              #6

              @drmhkelley
              I'm afraid I'm not a Qt expert person, and I don't build Qt, use statics or MinGw or Windows. But I am just a curious reader!

              When you "build Qt with MinGw", is the output one .LIB file, multiple .LIB files? Can you use a tool like LIB or DUMPBIN or dependency viewer so that you can start by finding where your MinGw .DLL s are actually being referenced from?

              1 Reply Last reply
              0
              • D Offline
                D Offline
                drmhkelley
                wrote on 1 Nov 2017, 20:41 last edited by
                #7

                Well, that's an interesting approach I hadn't considered. Up til now, I've never known about or used such tools. As for the Qt build output, it produces something like 100-200 individual lib files. Can you point me to any user info about LIB or DUMPBIN? A quick google search pointed me to Visual Studio tools, but I don't have Visual Studio.

                J 1 Reply Last reply 1 Nov 2017, 20:47
                0
                • D drmhkelley
                  1 Nov 2017, 20:41

                  Well, that's an interesting approach I hadn't considered. Up til now, I've never known about or used such tools. As for the Qt build output, it produces something like 100-200 individual lib files. Can you point me to any user info about LIB or DUMPBIN? A quick google search pointed me to Visual Studio tools, but I don't have Visual Studio.

                  J Offline
                  J Offline
                  JonB
                  wrote on 1 Nov 2017, 20:47 last edited by JonB 11 Jan 2017, 20:49
                  #8

                  @drmhkelley
                  Yeah, well, I actually expected you to know more about this than I! I was MSVC, never MinGw. thought some of these tools were available outside MSVC. Does your MinGw have its own linker or does it use LINK? Are its LIB files same as those from any other compiler or only its own format for its own linker? Really we're looking perhaps for a tool supplied with MinGw which can tell you what outside world references a LIB file is making?

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    drmhkelley
                    wrote on 1 Nov 2017, 21:27 last edited by
                    #9

                    MinGw uses the GNU compiler/linker g++. I don't know enough detail to know how that relates to MSVC.

                    Again, I'm hoping ultimately to learn where in the build process for Qt Apps something is done that assumes required libs are shared rather than static. A dependency viewer may inform that, but is likely to involve a fair bit of wasted effort by someone like me.

                    1 Reply Last reply
                    0

                    1/9

                    1 Nov 2017, 18:29

                    • Login

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