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. Static Builds not Working
QtWS25 Last Chance

Static Builds not Working

Scheduled Pinned Locked Moved Solved General and Desktop
static buildstatic5.10.1nmakemsvc2015
19 Posts 3 Posters 8.1k 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.
  • E Offline
    E Offline
    ed-wright
    wrote on last edited by
    #6

    @raven-worx Thanks for your reply

    1. If I uncomment the line CONFIG += static, should this make my project statically compiled?
    2. Is this a download or do i have to build this. I have a Qt Commercial licence.
    3. So if i want to statically link QNetwork for example do add QTPLUGIN += qnetwork (i am reading the link you sent as we speak)

    @mrjj Thanks again for your reply, I do have a commercial licence but i happy to stay on here if it helps someone else in the future.
    What is the process for statically linking Qt into my project?

    What I ultimately want is a stand-alone application (just an .exe) that i can run to start my application no DLLs

    mrjjM 1 Reply Last reply
    0
    • E ed-wright

      @raven-worx Thanks for your reply

      1. If I uncomment the line CONFIG += static, should this make my project statically compiled?
      2. Is this a download or do i have to build this. I have a Qt Commercial licence.
      3. So if i want to statically link QNetwork for example do add QTPLUGIN += qnetwork (i am reading the link you sent as we speak)

      @mrjj Thanks again for your reply, I do have a commercial licence but i happy to stay on here if it helps someone else in the future.
      What is the process for statically linking Qt into my project?

      What I ultimately want is a stand-alone application (just an .exe) that i can run to start my application no DLLs

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #7

      @ed-wright
      Hi
      Then you have to build a static Qt version.
      I have seen static pre-build for Qt Device Creation but im not sure
      if they have one for Desktop. (I would ask, it takes quite some time to compile
      a full Qt unless your pc is epic)
      this is a good start read
      https://wiki.qt.io/Build_Standalone_Qt_Application_for_Windows
      and also
      http://amin-ahmadi.com/2016/09/22/how-to-build-qt-5-7-statically-using-msvc14-microsoft-visual-studio-2015/
      but first start with
      http://doc.qt.io/qt-5/build-sources.html
      and make sure you install all it mentions from
      http://doc.qt.io/qt-5/windows-requirements.html
      perl, and also python i recall. This is a must do or
      it will compile for long time and then fail.
      Also, use a good pc. Dual core 1.5 ghz slim laptop will take ages.

      1 Reply Last reply
      1
      • E Offline
        E Offline
        ed-wright
        wrote on last edited by
        #8

        @mrjj

        Back to your original comment, I manually moved over all the Qt5*.dll from C:\QT\Qt5.10.1\5.10.1\msvc2015_64\bin and then ran windeployqt.exe it now executes.

        Changes
        It is now the release version
        My pro is now changed to uncomment the line "#CONFIG += static"
        My C:/QT folder is not currently called this as per your recommendation

        mrjjM 1 Reply Last reply
        0
        • E ed-wright

          @mrjj

          Back to your original comment, I manually moved over all the Qt5*.dll from C:\QT\Qt5.10.1\5.10.1\msvc2015_64\bin and then ran windeployqt.exe it now executes.

          Changes
          It is now the release version
          My pro is now changed to uncomment the line "#CONFIG += static"
          My C:/QT folder is not currently called this as per your recommendation

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #9

          @ed-wright
          Ok, so you successfully made a deployment folder.
          Good work. Its also handy to have to check out stuff.

          But its not static as that is some more work before thats possible,

          1 Reply Last reply
          1
          • E Offline
            E Offline
            ed-wright
            wrote on last edited by
            #10

            @mrjj

            I have gone into my Qt account and started downloading qt-everywhere-src-5.10.1.zip, i hope this is the correct download for the static build of Qt. Its Description is, Qt Source Package, Full Framework with Windows style line endings.

            mrjjM 1 Reply Last reply
            0
            • E ed-wright

              @mrjj

              I have gone into my Qt account and started downloading qt-everywhere-src-5.10.1.zip, i hope this is the correct download for the static build of Qt. Its Description is, Qt Source Package, Full Framework with Windows style line endings.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #11

              @ed-wright
              Yes, that is the source code. But there is also Qt 5.11
              but i assume you been using 5.10.1 ? ( its perfectly fine)
              You will then compile a static version from it.
              Make sure to reads docs carefully as else it fails and you been wasting hours looking at it compiling.

              E 1 Reply Last reply
              1
              • mrjjM mrjj

                @ed-wright
                Yes, that is the source code. But there is also Qt 5.11
                but i assume you been using 5.10.1 ? ( its perfectly fine)
                You will then compile a static version from it.
                Make sure to reads docs carefully as else it fails and you been wasting hours looking at it compiling.

                E Offline
                E Offline
                ed-wright
                wrote on last edited by
                #12

                @mrjj
                As im currently using Qt5.10.1 on Qt Creator so i thought i would stick to the same version.

                mrjjM 1 Reply Last reply
                0
                • E ed-wright

                  @mrjj
                  As im currently using Qt5.10.1 on Qt Creator so i thought i would stick to the same version.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #13

                  @ed-wright
                  That is fine. Not an issue. just wanted to be clear up front as the
                  compiling time is not trivial .)

                  1 Reply Last reply
                  1
                  • E Offline
                    E Offline
                    ed-wright
                    wrote on last edited by ed-wright
                    #14

                    I have been trying to compile the static version of Qt now and have run into a few issues.
                    Following http://doc.qt.io/qt-5/windows-building.html to try to build the
                    static version of Qt.

                    STEP 1
                    As i use Qt Creator and i have put the License into the prompt this step is
                    done

                    STEP 2
                    I already have a directory called C:\QT\Qt5.10.1, but from the downloads page
                    in my account i also have downloaded (Qt Source Package, Full Framework with
                    Windows style line endings ) and it is unpacked and located at C:\QT\qt-
                    everywhere-src-5.10.1, my project is currently using the first path.

                    STEP 3
                    With the environment variables, in my PATH i have
                    C:\QT\vs2015\qt5.6.1-64\5.6\msvc2015_64\bin, i do not think this is correct as
                    i want to be using 5.10.1 with msvs2015 so i think it needs to be.
                    C:\QT\Qt5.10.1\5.10.1\msvc2015_64\bin is this correct?

                    Anyway, following the guide my file qt5vars.cmd has the following:

                    REM Set up \Microsoft Visual Studio 14, where <arch> is \c amd64, \c
                    x86, etc.
                    CALL "C:\Program Files (x86)\Microsoft Visual Studio
                    14.0\VC\vcvarsall.bat" amd64
                    SET _ROOT=C:\QT\qt-everywhere-src-5.10.1
                    SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
                    REM Uncomment the below line when using a git checkout of the source
                    repository
                    REM SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
                    SET _ROOT=

                    NOTE: i am trying to use the downloaded (Qt Source Package, Full Framework
                    with Windows style line endings) not the normal 5.10.1 build.

                    NOTE2: This produces the following when running in the cmd off the shortcut on
                    the desktop:

                    C:\WINDOWS>REM Set up \Microsoft Visual Studio 14, where <arch> is \c
                    amd64, \c
                    x86, etc.

                    C:\WINDOWS>CALL "C:\Program Files (x86)\Microsoft Visual Studio
                    14.0\VC\vcvarsal
                    l.bat" amd64

                    STEP 4

                    Using the Developer Command Prompt for VS2015 i navigate to C:\QT\qt-
                    everywhere-src-5.10.1

                    and run the following configure -debug -nomake examples -nomake tests -skip
                    qtwebengine -opensource

                    i get the following errors

                    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual
                    Studio 14.0
                    \VC\BIN\cl.EXE"' : return code '0x2'

                    1 Reply Last reply
                    0
                    • E Offline
                      E Offline
                      ed-wright
                      wrote on last edited by ed-wright
                      #15

                      @mrjj

                      Okay an update, Still not working but got a little further.

                      I have added the line:
                      set CL=/I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt"

                      to the file, C:\QT\qt-everywhere-src-5.10.1\configure.bat

                      it now progresses further BUT now i get this error:

                      LINK : fatal error LNK1104: cannot open file 'libucrt.lib'
                      NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\link.EXE"' : return code '0x450'
                      Stop.

                      im trying to find libucrt.lib as we speak

                      mrjjM 1 Reply Last reply
                      0
                      • E ed-wright

                        @mrjj

                        Okay an update, Still not working but got a little further.

                        I have added the line:
                        set CL=/I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt"

                        to the file, C:\QT\qt-everywhere-src-5.10.1\configure.bat

                        it now progresses further BUT now i get this error:

                        LINK : fatal error LNK1104: cannot open file 'libucrt.lib'
                        NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\link.EXE"' : return code '0x450'
                        Stop.

                        im trying to find libucrt.lib as we speak

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #16

                        Hi
                        Good work.
                        I have not seen that one before, but it seems to be related to static linking
                        https://stackoverflow.com/questions/35805113/visual-studio-2015-run-time-dependencies-or-how-to-get-rid-of-universal-crt

                        1 Reply Last reply
                        1
                        • E Offline
                          E Offline
                          ed-wright
                          wrote on last edited by ed-wright
                          #17

                          @mrjj

                          Adding the following to my configure.bat located in the C:\QT\qt-everywhere-src-5.10.1 directory allowed me to overcome this problem.

                          set INCLUDE=%INCLUDE%;C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt
                          set LIB=%LIB%;C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x86
                          

                          Onto the next issue now.

                          I have successfully run the command

                          configure -debug -nomake examples -nomake tests -skip qtwebengine -opensource -static
                          

                          The next part of the guide states that the following command should be run.

                          nmake
                          

                          Once running it went for a few minutes and then produced the following error

                          Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
                          Copyright (C) Microsoft Corporation.  All rights reserved.
                          
                                  cl -c -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zi -MDd -utf-8 -W0 /Fd..\..\..\lib\qtpcre2d.pdb -DUNICODE -D_UNICODE -DWIN32 -DPCRE2_CODE_UNIT_WIDTH=16 -DPCRE2_STATIC -DQT_NO_NARROWING_CONVER
                          SIONS_IN_CONNECT -DHAVE_CONFIG_H -DQT_NO_DYNAMIC_CAST -DQT_NO_EXCEPTIONS -I. -Isrc -I..\..\..\mkspecs\win32-msvc -Fo.obj\debug\ @C:\Users\T0187208\AppData\Local\Temp\nmF7A.tmp
                          pcre2_auto_possess.c
                          pcre2_chartables.c
                          pcre2_compile.c
                          pcre2_config.c
                          pcre2_context.c
                          pcre2_dfa_match.c
                          pcre2_error.c
                          pcre2_find_bracket.c
                          pcre2_jit_compile.c
                          pcre2_maketables.c
                          pcre2_match.c
                          pcre2_match_data.c
                          pcre2_newline.c
                          pcre2_ord2utf.c
                          pcre2_pattern_info.c
                          pcre2_serialize.c
                          pcre2_string_utils.c
                          pcre2_study.c
                          pcre2_substitute.c
                          pcre2_substring.c
                          Generating Code...
                          Compiling...
                          pcre2_tables.c
                          pcre2_ucd.c
                          pcre2_valid_utf.c
                          pcre2_xclass.c
                          Generating Code...
                                  lib /NOLOGO  /OUT:..\..\..\lib\qtpcre2d.lib @C:\Users\T0187208\AppData\Local\Temp\nm1B7D.tmp
                                  cd corelib\ && ( if not exist Makefile C:\QT\qt-everywhere-src-5.10.1\qtbase\bin\qmake.exe -o Makefile C:\QT\qt-everywhere-src-5.10.1\qtbase\src\corelib\corelib.pro ) && "C:\Program Files (x86
                          )\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f Makefile
                          ASSERT: "isAbsolutePath(baseDir)" in file C:\QT\qt-everywhere-src-5.10.1\qtbase\qmake\library\ioutils.cpp, line 106
                          NMAKE : fatal error U1077: 'cd' : return code '0x3'
                          Stop.
                          NMAKE : fatal error U1077: 'cd' : return code '0x2'
                          Stop.
                          NMAKE : fatal error U1077: 'cd' : return code '0x2'
                          Stop.
                          

                          This is omitting some of the previous command line output that all worked correctly, this is where it crashed.

                          Do you have any idea?

                          1 Reply Last reply
                          0
                          • E Offline
                            E Offline
                            ed-wright
                            wrote on last edited by
                            #18

                            So part of the problem was that my default prefix for the configure command was incorrect.

                            So going back and running the following worked.

                            configure -debug -nomake examples -nomake tests -skip qtwebengine -opensource -static -prefix C:\QT\qt-everywhere-src-5.10.1 -redo -recheck-all
                            

                            Then to Build

                            nmake
                            
                            1 Reply Last reply
                            1
                            • mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by
                              #19

                              Super good work.
                              Thanks for updating on the way. will be helpful for others.

                              1 Reply Last reply
                              1

                              • Login

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