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. Compile a Qt Application without .dll dependencies

Compile a Qt Application without .dll dependencies

Scheduled Pinned Locked Moved Unsolved General and Desktop
dllwindowsrelease
13 Posts 4 Posters 11.7k 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
    Julius Aetherwing
    wrote on 4 Dec 2015, 14:57 last edited by
    #3

    OK, so I downloaded that script and executed it and it ran into an error.
    This is the log:

    Building static Qt version 5.5.1
    Using MinGW from C:\MinGW
    Downloading http://download.qt.io/official_releases/qt/5.5/5.5.1/single/qt-everywhere-opensource-src-5.5.1.7z ...
    Expanding C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1.7z ...
    
    
    7-Zip [64] 15.12 : Copyright (c) 1999-2015 Igor Pavlov : 2015-11-19
    
    Scanning the drive for archives:
    1 file, 312170178 bytes (298 MiB)
    
    --
    Path = C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1.7z
    Type = 7z
    Physical Size = 312170178
    Headers Size = 1755218
    Method = LZMA:24 BCJ
    Solid = +
    Blocks = 3
    
    Everything is Ok
    
    Folders: 14226
    Files: 139086
    Size:       1641714645
    Compressed: 312170178
    Patching C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\mkspecs\win32-g++\qmake.conf ...
    + cd qtbase
    + C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\configure.bat -top-level -static -debug-and-release -platform win32-g++ -prefix C:\Qt\Static\5.5.1         -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sql-sqlite -no-openssl         -opensource -confirm-license         -make libs -nomake tools -nomake examples -nomake tests
    
    This is the Qt for Windows Open Source Edition.
    
    You have already accepted the terms of the license.
    
    Creating qmake...
    g++ -c -o project.o -DUNICODE -ffunction-sections -g  -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/library -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/unix -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/win32 -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/mac -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/integrity -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\include -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\include/QtCore -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\include/QtCore/5.5.1 -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\include/QtCore/5.5.1/QtCore -I../src/corelib/global -DHAVE_QCONFIG_CPP -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\mkspecs\win32-g++ -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/tools/shared -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY -DQT_NO_STANDARDPATHS C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/project.cpp
    Makefile:201: recipe for target 'project.o' failed
    mingw32-make: *** [project.o] Error 1
    del /f project.o option.o property.o main.o ioutils.o proitems.o qmakevfs.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 msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o cesdkhandler.o qtextcodec.o qutfcodec.o qstring.o qstring_compat.o qstringbuilder.o qtextstream.o qiodevice.o qdebug.o qmalloc.o qglobal.o qarraydata.o qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlist.o qfiledevice.o qfile.o qfilesystementry.o qfilesystemengine.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 qabstractfileengine.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 qjson.o qjsondocument.o qjsonparser.o qjsonarray.o qjsonobject.o qjsonvalue.o qfilesystemengine_win.o qfilesystemiterator_win.o qfsfileengine_win.o qlocale_win.o qsettings_win.o qsystemlibrary.o registry.o
    C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\qmake\project.o konnte nicht gefunden werden
    g++ -c -o project.o -DUNICODE -ffunction-sections -g  -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/library -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/unix -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/win32 -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/mac -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/integrity -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\include -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\include/QtCore -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\include/QtCore/5.5.1 -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\include/QtCore/5.5.1/QtCore -I../src/corelib/global -DHAVE_QCONFIG_CPP -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\mkspecs\win32-g++ -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/tools/shared -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY -DQT_NO_STANDARDPATHS C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/project.cpp
    Makefile:201: recipe for target 'project.o' failed
    mingw32-make: *** [project.o] Error 1
    Building qmake failed, return code 2
    
    mingw32-make: *** No targets specified and no makefile found.  Stop.
    mingw32-make: *** No rule to make target 'install'.
    Out-File : Ein Teil des Pfades "C:\Qt\Static\5.5.1\mkspecs\win32-g++\qmake.conf" konnte nicht gefunden werden.
    In C:\Users\Julian\Desktop\windows-build-qt-static.ps1:178 Zeichen:6
    + "@ | Out-File -Append $File -Encoding Ascii
    +      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : OpenError: (:) [Out-File], DirectoryNotFoundException
        + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand
    
    Drücken Sie die Eingabetaste, um den Vorgang fortzusetzen...:
    

    Do you know what happened here and what I can do about this?

    K 1 Reply Last reply 4 Dec 2015, 16:25
    0
    • J Julius Aetherwing
      4 Dec 2015, 14:57

      OK, so I downloaded that script and executed it and it ran into an error.
      This is the log:

      Building static Qt version 5.5.1
      Using MinGW from C:\MinGW
      Downloading http://download.qt.io/official_releases/qt/5.5/5.5.1/single/qt-everywhere-opensource-src-5.5.1.7z ...
      Expanding C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1.7z ...
      
      
      7-Zip [64] 15.12 : Copyright (c) 1999-2015 Igor Pavlov : 2015-11-19
      
      Scanning the drive for archives:
      1 file, 312170178 bytes (298 MiB)
      
      --
      Path = C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1.7z
      Type = 7z
      Physical Size = 312170178
      Headers Size = 1755218
      Method = LZMA:24 BCJ
      Solid = +
      Blocks = 3
      
      Everything is Ok
      
      Folders: 14226
      Files: 139086
      Size:       1641714645
      Compressed: 312170178
      Patching C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\mkspecs\win32-g++\qmake.conf ...
      + cd qtbase
      + C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\configure.bat -top-level -static -debug-and-release -platform win32-g++ -prefix C:\Qt\Static\5.5.1         -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sql-sqlite -no-openssl         -opensource -confirm-license         -make libs -nomake tools -nomake examples -nomake tests
      
      This is the Qt for Windows Open Source Edition.
      
      You have already accepted the terms of the license.
      
      Creating qmake...
      g++ -c -o project.o -DUNICODE -ffunction-sections -g  -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/library -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/unix -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/win32 -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/mac -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/integrity -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\include -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\include/QtCore -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\include/QtCore/5.5.1 -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\include/QtCore/5.5.1/QtCore -I../src/corelib/global -DHAVE_QCONFIG_CPP -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\mkspecs\win32-g++ -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/tools/shared -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY -DQT_NO_STANDARDPATHS C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/project.cpp
      Makefile:201: recipe for target 'project.o' failed
      mingw32-make: *** [project.o] Error 1
      del /f project.o option.o property.o main.o ioutils.o proitems.o qmakevfs.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 msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o cesdkhandler.o qtextcodec.o qutfcodec.o qstring.o qstring_compat.o qstringbuilder.o qtextstream.o qiodevice.o qdebug.o qmalloc.o qglobal.o qarraydata.o qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlist.o qfiledevice.o qfile.o qfilesystementry.o qfilesystemengine.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 qabstractfileengine.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 qjson.o qjsondocument.o qjsonparser.o qjsonarray.o qjsonobject.o qjsonvalue.o qfilesystemengine_win.o qfilesystemiterator_win.o qfsfileengine_win.o qlocale_win.o qsettings_win.o qsystemlibrary.o registry.o
      C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\qmake\project.o konnte nicht gefunden werden
      g++ -c -o project.o -DUNICODE -ffunction-sections -g  -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/library -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/unix -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/win32 -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/mac -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/integrity -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\include -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\include/QtCore -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\include/QtCore/5.5.1 -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\include/QtCore/5.5.1/QtCore -I../src/corelib/global -DHAVE_QCONFIG_CPP -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\mkspecs\win32-g++ -IC:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/tools/shared -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY -DQT_NO_STANDARDPATHS C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/project.cpp
      Makefile:201: recipe for target 'project.o' failed
      mingw32-make: *** [project.o] Error 1
      Building qmake failed, return code 2
      
      mingw32-make: *** No targets specified and no makefile found.  Stop.
      mingw32-make: *** No rule to make target 'install'.
      Out-File : Ein Teil des Pfades "C:\Qt\Static\5.5.1\mkspecs\win32-g++\qmake.conf" konnte nicht gefunden werden.
      In C:\Users\Julian\Desktop\windows-build-qt-static.ps1:178 Zeichen:6
      + "@ | Out-File -Append $File -Encoding Ascii
      +      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : OpenError: (:) [Out-File], DirectoryNotFoundException
          + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand
      
      Drücken Sie die Eingabetaste, um den Vorgang fortzusetzen...:
      

      Do you know what happened here and what I can do about this?

      K Offline
      K Offline
      koahnig
      wrote on 4 Dec 2015, 16:25 last edited by
      #4

      @Julius-Aetherwing

      This script is new. I have never used it so far.

      In the past you had to download the zip archive and unzipped it on your own.

      There should be all the content already unzipped and readily available for compilation.

      Is a file "C:\Qt\Static\5.5.1\mkspecs\win32-g++\qmake.conf" already there?
      This seems to be missing.

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

      J K 2 Replies Last reply 4 Dec 2015, 17:54
      0
      • K koahnig
        4 Dec 2015, 16:25

        @Julius-Aetherwing

        This script is new. I have never used it so far.

        In the past you had to download the zip archive and unzipped it on your own.

        There should be all the content already unzipped and readily available for compilation.

        Is a file "C:\Qt\Static\5.5.1\mkspecs\win32-g++\qmake.conf" already there?
        This seems to be missing.

        J Offline
        J Offline
        Julius Aetherwing
        wrote on 4 Dec 2015, 17:54 last edited by Julius Aetherwing 12 Apr 2015, 17:55
        #5

        @koahnig It seems like the build process failed at some point and terminated completely (Don't know why). Then the script tries to do some final patches, which fail because the files are not existent.

        Do you have any idea what I can do instead?

        1 Reply Last reply
        0
        • K koahnig
          4 Dec 2015, 16:25

          @Julius-Aetherwing

          This script is new. I have never used it so far.

          In the past you had to download the zip archive and unzipped it on your own.

          There should be all the content already unzipped and readily available for compilation.

          Is a file "C:\Qt\Static\5.5.1\mkspecs\win32-g++\qmake.conf" already there?
          This seems to be missing.

          K Offline
          K Offline
          koahnig
          wrote on 4 Dec 2015, 18:10 last edited by
          #6

          @koahnig said:

          Is a file "C:\Qt\Static\5.5.1\mkspecs\win32-g++\qmake.conf" already there?

          Is this already created?

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

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Julius Aetherwing
            wrote on 5 Dec 2015, 09:21 last edited by
            #7

            No it isnt. The folder Qt\Static\5.5.1 is completely empty.

            K 1 Reply Last reply 5 Dec 2015, 11:36
            0
            • J Julius Aetherwing
              5 Dec 2015, 09:21

              No it isnt. The folder Qt\Static\5.5.1 is completely empty.

              K Offline
              K Offline
              koahnig
              wrote on 5 Dec 2015, 11:36 last edited by
              #8

              @Julius-Aetherwing
              I have never used that script. In the output I do not see where it broke.

              Basically it was not very difficult to do all the stuff without the script. However, I cannot find the proper wiki entries anymore.
              Only this one I have googled.
              The configure is basically the essential part after unzippuing the stuff. The configure does give some guidelines during its execution.
              However, I am not completely sure if this is enough to through it completely.

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

              J 1 Reply Last reply 5 Dec 2015, 14:54
              0
              • K koahnig
                5 Dec 2015, 11:36

                @Julius-Aetherwing
                I have never used that script. In the output I do not see where it broke.

                Basically it was not very difficult to do all the stuff without the script. However, I cannot find the proper wiki entries anymore.
                Only this one I have googled.
                The configure is basically the essential part after unzippuing the stuff. The configure does give some guidelines during its execution.
                However, I am not completely sure if this is enough to through it completely.

                J Offline
                J Offline
                Julius Aetherwing
                wrote on 5 Dec 2015, 14:54 last edited by
                #9

                @koahnig OK, so I looked into the script and it does relatively simple stuff.

                • Downloading and extracting the code,
                • patching the file \qtbase\mkspecs\win32-g++\qmake.conf, adding this to the end:
                # [QT-STATIC-PATCH]
                QMAKE_LFLAGS += -static -static-libgcc
                QMAKE_CFLAGS_RELEASE -= -O2
                QMAKE_CFLAGS_RELEASE += -Os -momit-leaf-frame-pointer
                DEFINES += QT_STATIC_BUILD
                
                • Calling configure with these arguments: (where $QtDir is C:\Qt\Static\5.5.1)
                configure.bat -static -debug-and-release -platform win32-g++ -prefix $QtDir
                 -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sql-sqlite -no-openssl
                -opensource -confirm-license
                -make libs -nomake tools -nomake examples -nomake tests
                
                • Calling
                mingw32-make -k -j4
                
                • And calling
                mingw32-make -k install
                
                • Finally patching the qmake.conf file again, this time adding this:
                CONFIG += static
                

                I tried to invoke configure with the arguments mentioned in the other article you linked, but it yelled at me saying there is no option -no-exceptions.
                Running without this option printed something, but errored saying this:

                In file included from C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/makefiledeps.cpp:40:0:
                C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\mkspecs\win32-g++/qplatformdefs.h:47:19: fatal error: tchar.h: No such file or directory
                 #include <tchar.h>
                                   ^
                compilation terminated.
                Makefile:222: recipe for target 'makefiledeps.o' failed
                mingw32-make: *** [makefiledeps.o] Error 1
                Building qmake failed, return code 2
                

                Running with the options in the script (which is where it failed before, I think) lead to the same error.

                K 1 Reply Last reply 5 Dec 2015, 18:26
                0
                • R Offline
                  R Offline
                  Rondog
                  wrote on 5 Dec 2015, 15:02 last edited by
                  #10

                  You don't need to distribute all the Qt dll files with your application (your reference to 'tonnes of dll's'). You need the platform plugin folder (with 'qwindows.dll') and a few others such as Qt5Widgets, Qt5Core, Qt5Gui, and two or three for the c++ runtime (mingw dependencies). Usually it is under 10 files.

                  You likely should compile Qt yourself from source and remove a few things you probably don't need. The 'icu*.dll' files that are related to webkit come to mind. These files are huge relatively speaking.

                  For Windows I can usually get a basic application to be around 15 mb (total of all files required) on Windows.

                  There is a utility program from Microsoft called 'depends.exe' (Dependency Viewer) that you can use to see which DLL files your application requires. At a minimum if you run the program Windows will tell you which dll file it couldn't find (don't do this on your development pc as you may have dll files or path settings that make this unreliable).

                  J 1 Reply Last reply 6 Dec 2015, 11:03
                  0
                  • J Julius Aetherwing
                    5 Dec 2015, 14:54

                    @koahnig OK, so I looked into the script and it does relatively simple stuff.

                    • Downloading and extracting the code,
                    • patching the file \qtbase\mkspecs\win32-g++\qmake.conf, adding this to the end:
                    # [QT-STATIC-PATCH]
                    QMAKE_LFLAGS += -static -static-libgcc
                    QMAKE_CFLAGS_RELEASE -= -O2
                    QMAKE_CFLAGS_RELEASE += -Os -momit-leaf-frame-pointer
                    DEFINES += QT_STATIC_BUILD
                    
                    • Calling configure with these arguments: (where $QtDir is C:\Qt\Static\5.5.1)
                    configure.bat -static -debug-and-release -platform win32-g++ -prefix $QtDir
                     -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sql-sqlite -no-openssl
                    -opensource -confirm-license
                    -make libs -nomake tools -nomake examples -nomake tests
                    
                    • Calling
                    mingw32-make -k -j4
                    
                    • And calling
                    mingw32-make -k install
                    
                    • Finally patching the qmake.conf file again, this time adding this:
                    CONFIG += static
                    

                    I tried to invoke configure with the arguments mentioned in the other article you linked, but it yelled at me saying there is no option -no-exceptions.
                    Running without this option printed something, but errored saying this:

                    In file included from C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase/qmake/generators/makefiledeps.cpp:40:0:
                    C:\Qt\Static\src\qt-everywhere-opensource-src-5.5.1\qtbase\mkspecs\win32-g++/qplatformdefs.h:47:19: fatal error: tchar.h: No such file or directory
                     #include <tchar.h>
                                       ^
                    compilation terminated.
                    Makefile:222: recipe for target 'makefiledeps.o' failed
                    mingw32-make: *** [makefiledeps.o] Error 1
                    Building qmake failed, return code 2
                    

                    Running with the options in the script (which is where it failed before, I think) lead to the same error.

                    K Offline
                    K Offline
                    koahnig
                    wrote on 5 Dec 2015, 18:26 last edited by
                    #11

                    @Julius-Aetherwing
                    My guess is that this may have something to do with the path environment. I believe there were a couple of settings to be made. However, as mentioned before I could not find the wiki entries, they were holding more information. Also the configure stuff may have changed.

                    When you are right that the failure might be in the same place as with the script, it may also be that there is a setting missing you should added upfront.

                    My static compilations go a couple of years back. With Qt 5 I did not have the need for static libs anymore.

                    You may also reconsider and follow @Rondog advice. He is completely right that there are not so many dlls. Furthermore, you have to be aware of the license implication when using a static compilation.

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

                    1 Reply Last reply
                    0
                    • R Rondog
                      5 Dec 2015, 15:02

                      You don't need to distribute all the Qt dll files with your application (your reference to 'tonnes of dll's'). You need the platform plugin folder (with 'qwindows.dll') and a few others such as Qt5Widgets, Qt5Core, Qt5Gui, and two or three for the c++ runtime (mingw dependencies). Usually it is under 10 files.

                      You likely should compile Qt yourself from source and remove a few things you probably don't need. The 'icu*.dll' files that are related to webkit come to mind. These files are huge relatively speaking.

                      For Windows I can usually get a basic application to be around 15 mb (total of all files required) on Windows.

                      There is a utility program from Microsoft called 'depends.exe' (Dependency Viewer) that you can use to see which DLL files your application requires. At a minimum if you run the program Windows will tell you which dll file it couldn't find (don't do this on your development pc as you may have dll files or path settings that make this unreliable).

                      J Offline
                      J Offline
                      Julius Aetherwing
                      wrote on 6 Dec 2015, 11:03 last edited by Julius Aetherwing 12 Jun 2015, 12:41
                      #12

                      @Rondog You surely have a point here.

                      I think, i'm trying the dll stuff again, maybe this will lead to a reasonable application size..

                      EDIT: Just recognized that the only the "Debug" dlls are that huge in size, the normal "Release" dlls are about a fifth or a tenth of the size.. That's great :)

                      1 Reply Last reply
                      0
                      • J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 7 Dec 2015, 05:59 last edited by
                        #13

                        You should check this: http://doc.qt.io/qt-5/windows-deployment.html
                        Especially the "The Windows Deployment Tool" part.

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0

                        12/13

                        6 Dec 2015, 11:03

                        • Login

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