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. [SOLVED] Building Qt 5.4.1 static application for Windows 7?
QtWS25 Last Chance

[SOLVED] Building Qt 5.4.1 static application for Windows 7?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 3.2k Views
  • 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.
  • J Offline
    J Offline
    Johnathon
    wrote on last edited by Johnathon
    #1

    Hi all, I have created a Window 7 based application and managed to get it running under release build. However this application requires external Qt dll files such as "QtCore5.dll" and "Qt5Gui.dll" as well as a "\platforms" folder with "qminimal.dll", "qpffscreen.dll" and "qwindows.dll".

    I would like to create a standalone application which does not requires any of the external dll files, such as those mentioned above. I'm currently using

    • QtCreator 3.4.0 based on Qt 5.4.1
    • Windows 7
    • MinGW 4.9.1 32bit (installed via Qt Creator, C:\Qt\5.4\mingw491_32\bin\qmake.exe)

    I came across many forums whose solution eventually leads to the url, https://wiki.qt.io/How_to_build_a_static_Qt_version_for_Windows_with_gcc, but it is meant for 4.7.0. A lot of the directories had since changed, removed or renamed. Does anyone have any ideas on how to make it a standalone?

    Many thanks,
    Johnathon

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by koahnig
      #2

      Hi and welcome to devnet

      Checkout this link for Qt5
      In order to build Qt yourself AFAIK you should use the source from this zip or of a previous version. The source as shipped in the prebuilds should not be used for recompilation with a different configuration.

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

      1 Reply Last reply
      1
      • QT-static-prgmQ Offline
        QT-static-prgmQ Offline
        QT-static-prgm
        wrote on last edited by
        #3

        The steps for building qt 5.4.1 are the same as for qt 4.7.0.
        Have a look at the links koahnig gave you. If you still do not know what to do you could have a look at my german tutorial:
        https://forum.qt.io/topic/44406/tutorial-qt-5-3-1-für-statisches-linken-builden-mingw
        It base on an english tutorials, but it was updated for the 5.3.1 libs. Nothing changed to 5.4.1, so you can look up the path in the german tut ;)

        If you still have question feel free to ask. I'll see how to help you.

        J 1 Reply Last reply
        1
        • QT-static-prgmQ QT-static-prgm

          The steps for building qt 5.4.1 are the same as for qt 4.7.0.
          Have a look at the links koahnig gave you. If you still do not know what to do you could have a look at my german tutorial:
          https://forum.qt.io/topic/44406/tutorial-qt-5-3-1-für-statisches-linken-builden-mingw
          It base on an english tutorials, but it was updated for the 5.3.1 libs. Nothing changed to 5.4.1, so you can look up the path in the german tut ;)

          If you still have question feel free to ask. I'll see how to help you.

          J Offline
          J Offline
          Johnathon
          wrote on last edited by
          #4

          @QT-static-prgm Thank you so much for your tutorial. After some modifications on the tutorial steps, I managed to get it working.

          I have installed the Qt Creator in C:\Qt\5.5 and the opensource to C:\Qt\5.5_static. When reaching the following step:

          • wechselt nun in das Verzeichnis C:\Qt\Qt_5.3.1\ und wählt eure Konfiguration:
          • configure -static -platform win32-g++ -opengl desktop -c++11 -make libs

          instead of running the command in command prompt in the directory C:\Qt\5.5, i ran the command in the directory C:\Qt\5.5_static. When finished running mingw32-make in the command prompt, there were some compiler errors as below:

          C:/MinGW/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-ming
          w32/bin/ld.exe: C:/Qt/5.5_static/qtbase/lib\libQt5Qml.a(YarrInterpreter.o): bad
          reloc address 0x1f4 in section `.text$_ZN3JSC4Yarr12ByteCompiler7compileEPN3WTF2
          0BumpPointerAllocatorE[__ZN3JSC4Yarr12ByteCompiler7compileEPN3WTF20BumpPointerAl
          locatorE]'
          collect2.exe: error: ld returned 1 exit status
          Makefile.Release:86: recipe for target 'C:\Qt\5.5_static\qtbase\bin\qml.exe' fai
          led
          mingw32-make[4]: *** [C:\Qt\5.5_static\qtbase\bin\qml.exe] Error 1
          mingw32-make[4]: Leaving directory 'C:/Qt/5.5_static/qtdeclarative/tools/qml'
          Makefile:34: recipe for target 'release' failed
          mingw32-make[3]: *** [release] Error 2
          mingw32-make[3]: Leaving directory 'C:/Qt/5.5_static/qtdeclarative/tools/qml'
          Makefile:94: recipe for target 'sub-qml-make_first' failed
          mingw32-make[2]: *** [sub-qml-make_first] Error 2
          mingw32-make[2]: Leaving directory 'C:/Qt/5.5_static/qtdeclarative/tools'
          Makefile:66: recipe for target 'sub-tools-make_first' failed
          mingw32-make[1]: *** [sub-tools-make_first] Error 2
          mingw32-make[1]: Leaving directory 'C:/Qt/5.5_static/qtdeclarative'
          makefile:220: recipe for target 'module-qtdeclarative-make_first' failed
          mingw32-make: *** [module-qtdeclarative-make_first] Error 2

          I did came across the following post and the author mentioned that some of these errors can be ignored.

          • https://forum.qt.io/topic/49387/how-to-build-qt-5-4-statically-on-window-7-compression-exe-by-upx/2

          Following through to the end of the tutorial, I managed to create a and compile a new project with standalone static build kit. I copied the released version of the executable file onto Desktop and run it, it ran without any errors.

          QT-static-prgm, thank you very much for your help.

          Johnathon

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Johnathon
            wrote on last edited by
            #5

            I'm facing another issue right now, I can build a new project as a standalone when I choose the static kit. But when I add the following to the project .pro file:

            QT += core gui \
            serialport

            QtCreator immediately prompts an error saying

            • Project ERROR: Unknown module(s) in QT: serialport

            I have tried some of the suggestions like below:

            1. Run command prompt and go to C:\Qt\5.5_static\qtserialport
            2. Run the command: qmake qtserialport.pro

            but it still doesn't work.

            Has anyone work with QtSerialPort in static Qt?

            Thank you

            Johnathon

            K 1 Reply Last reply
            0
            • J Johnathon

              I'm facing another issue right now, I can build a new project as a standalone when I choose the static kit. But when I add the following to the project .pro file:

              QT += core gui \
              serialport

              QtCreator immediately prompts an error saying

              • Project ERROR: Unknown module(s) in QT: serialport

              I have tried some of the suggestions like below:

              1. Run command prompt and go to C:\Qt\5.5_static\qtserialport
              2. Run the command: qmake qtserialport.pro

              but it still doesn't work.

              Has anyone work with QtSerialPort in static Qt?

              Thank you

              Johnathon

              K Offline
              K Offline
              koahnig
              wrote on last edited by
              #6

              @Johnathon
              It could be better to start another thread. Even though the topic is related.
              One of the developers of serialPort is typically very responsive.

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

              J 1 Reply Last reply
              0
              • K koahnig

                @Johnathon
                It could be better to start another thread. Even though the topic is related.
                One of the developers of serialPort is typically very responsive.

                J Offline
                J Offline
                Johnathon
                wrote on last edited by
                #7

                @koahnig
                Thank you for your suggestion, I will do that.

                Johnathon

                1 Reply Last reply
                0

                • Login

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