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] Qt 5.1.1. Win7. How to build an application statically
Qt 6.11 is out! See what's new in the release blog

[SOLVED] Qt 5.1.1. Win7. How to build an application statically

Scheduled Pinned Locked Moved General and Desktop
39 Posts 2 Posters 37.2k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #28

    Add "-nomake examples -nomake tests"

    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
    • 8Observer88 Offline
      8Observer88 Offline
      8Observer8
      wrote on last edited by
      #29

      I typed this:

      configure -static -opengl desktop -nomake examples -nomake tests

      Output:

      bq. process_begin: CreateProcess(NULL, rm -f project.o option.o property.o main.o io
      utils.o proitems.o qmakeglobals.o qmakeparser.o qmakeevaluator.o qmakebuiltins.o
      makefile.o unixmake2.o unixmake.o mingw_make.o winmakefile.o projectgenerator.o
      meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o msvc_vcproj.o m
      svc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o gbuild.o ces
      dkhandler.o qtextcodec.o qutfcodec.o qstring.o qstringbuilder.o qtextstream.o qi
      odevice.o qmalloc.o qglobal.o qarraydata.o qbytearray.o qbytearraymatcher.o qdat
      astream.o qbuffer.o qlist.o qfiledevice.o qfile.o qfilesystementry.o qfilesystem
      engine.o qfsfileengine.o qfsfileengine_iterator.o qregexp.o qvector.o qbitarray.
      o qdir.o qdiriterator.o quuid.o qhash.o qfileinfo.o qdatetime.o qstringlist.o qa
      bstractfileengine.o qtemporaryfile.o qmap.o qmetatype.o qsettings.o qsystemerror
      .o qlibraryinfo.o qvariant.o qvsnprintf.o qlocale.o qlocale_tools.o qlinkedlist.
      o qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o qlogging.o qfilesyste
      mengine_win.o qfilesystemiterator_win.o qfsfileengine_win.o qlocale_win.o qsetti
      ngs_win.o qsystemlibrary.o registry.o, ...) failed.
      make (e=2): The system cannot find the file specified.
      Makefile:155: recipe for target 'clean' failed
      mingw32-make: *** [clean] Error 2
      Cleaning qmake failed, return code 2
      C:\Qt\Qt5.1.1_static\5.1.1\Src\qtbase>

      1 Reply Last reply
      0
      • 8Observer88 Offline
        8Observer88 Offline
        8Observer8
        wrote on last edited by
        #30

        Now I am building of Qt on my old computer with XP. It was configured successfully.

        1 Reply Last reply
        0
        • 8Observer88 Offline
          8Observer88 Offline
          8Observer8
          wrote on last edited by
          #31

          It was building on my old computer with XP successfully! It took 1 or 1.5 hour.

          Please say me. Should I run this command: mingw32-make install

          1 Reply Last reply
          0
          • 8Observer88 Offline
            8Observer88 Offline
            8Observer8
            wrote on last edited by
            #32

            I compiled a simple project. But it was not build statically.

            1 Reply Last reply
            0
            • 8Observer88 Offline
              8Observer88 Offline
              8Observer8
              wrote on last edited by
              #33

              I ran this: mingw32-make install

              It is installing now. But I see:

              bq. can not be copied on top of itself

              1 Reply Last reply
              0
              • 8Observer88 Offline
                8Observer88 Offline
                8Observer8
                wrote on last edited by
                #34

                bq. xcopy /s /q /y /i C:\Qt\Qt5.1.1\5.1.1\Src\qtbase\doc\global C:\Qt\Qt5.1.1\5.1.1
                Src\qtbase\doc\global

                1 Reply Last reply
                0
                • 8Observer88 Offline
                  8Observer88 Offline
                  8Observer8
                  wrote on last edited by
                  #35

                  I created the new folder with name C:/Qt5.1.1_static

                  And copied to it the content of the folder C:\Qt\Qt5.1.1_static\5.1.1\Src\qtbase

                  I ran this: cd C:/Qt5.1.1_static

                  And this: configure -static -opengl desktop -nomake examples -nomake tests

                  And I ran this: mingw32-make

                  And this: mingw32-make install

                  I open QtCreator -> and selected qmake.exe from C:/Qt5.1.1_static

                  I created a simple Dialog Project (Release)

                  But my Application-exe require the libgcc_s_dw2-1.dll

                  Why? I want to ran my Application on another computer. Please help me! What should I do?

                  1 Reply Last reply
                  0
                  • 8Observer88 Offline
                    8Observer88 Offline
                    8Observer8
                    wrote on last edited by
                    #36

                    This is right for installing:

                    configure -static -prefix "C:/Qt/Qt5.1.1_static" -opengl desktop -nomake examples -nomake tests

                    But my Application-exe require the libgcc_s_dw2-1.dll How to build all dll's to one exe-file?

                    1 Reply Last reply
                    0
                    • 8Observer88 Offline
                      8Observer88 Offline
                      8Observer8
                      wrote on last edited by
                      #37

                      Need I to change mkspecs file?

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #38

                        "Here":http://bit.ly/1bMwrbH

                        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
                        • 8Observer88 Offline
                          8Observer88 Offline
                          8Observer8
                          wrote on last edited by
                          #39

                          Thank you for reply. I am helped here: http://www.prog.org.ru/topic_26164_0.html

                          My "Step by Step" instruction how to build applications without libstdc++-6.dll, libgcc_s_dw2-1.dll, Qt5Core.dll, Qt5Gui.dll and so on.

                          Tools:

                          Version of Qt: Qt 5.2.0 for Windows 32-bit (MinGW 4.8, OpenGL, 689 MB)

                          OS: Window 7

                          • download and install Qt 5.2.0 for Windows 32-bit (MinGW 4.8, OpenGL, 689 MB) (check Source Components) from here http://qt-project.org/downloads

                          • move to C:\Qt\Qt5.2.0\5.2.0\Src\qtbase\mkspecs\win32-g++ and open qmake.conf

                          • find QMAKE_LFLAGS in qmake.conf and rewrite it:

                          QMAKE_LFLAGS = -static -static-libgcc

                          • open console Start -> All Programs -> Qt 5.2.0 -> 5.2.0 -> MinGW 4.8 (32-bit) -> Qt 5.2.0 for Desktop (MinGW 4.8 32 bit)

                          cd c:\Qt\Qt5.2.0\5.2.0\Src\qtbase

                          configure -static -prefix "C:\Qt\Qt5.2.0_static" -opengl desktop -nomake examples -nomake tests

                          mingw32-make

                          mingw32-make install

                          • run QtCreator

                          • in menu Tools -> Options...

                          • Build & Run -> Qt Versions -> click "Add..." button -> select "C:\Qt\Qt5.2.0_static\bin\qmake.exe" -> click "Apply" button

                          • go to "Kits" tab -> click "Add" button

                          • write in the field "Name": Desktop Qt 5.2.0 Static MinGW 32 bit

                          • select in "Qt version": static Qt virsion

                          • click Ok

                          • create a test project, for this:

                          • in menu "File" -> "New File or Project" -> "Applications" -> "Qt Widgets Application" -> click "Choose" button

                          • enter the "Name": Hello_Static_Qt -> enter the "Create in": D:\QtProjects -> click "Next" -> select "Desktop Qt 5.2.0 Static MinGW 32 bit" -> click "Next" -> click "Next" -> click "Finish"

                          • click "Projects" in the right panel

                          • click "Desktop Qt 5.2.0 Static MinGW 32 bit" on the top

                          • select "Edit build configuration": Release

                          • in the "Build Steps" in "qmake" expend "Details"

                          • select "qmake build configuration": Release

                          • enter "Additional arguments": "CONFIG += release" (in double quotes)

                          • in "Menu" -> click "Build" -> "Build Project 'Hello_static_Qt'"

                          • go to "D:\QtProjects\build-Hello_Static_Qt-Desktop_Qt_5_2_0_Static_MinGW_32bit-Release\release"

                          • run your static application: Hello_Static_Qt.exe

                          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