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. How do you static link Qt (/MT) with visual studio 2013?
Forum Updated to NodeBB v4.3 + New Features

How do you static link Qt (/MT) with visual studio 2013?

Scheduled Pinned Locked Moved Installation and Deployment
22 Posts 2 Posters 17.6k 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.
  • J Offline
    J Offline
    John12341234
    wrote on last edited by
    #11
    1. There is already a libs folder full of *.lib files at C:\Qt\Qt5.3.1\5.3\msvc2013\lib. Does that mean static compilation has already been done? (That was the case with OpenCV. A forum member thought it had to be rebuilt but it already came with what was needed for an /MT build)

    If not:
    2. So I would edit the qmake.conf file in:
    C:\Qt\Qt5.3.1\5.3\msvc2013\mkspecs\win32-msvc2013 ?

    1. I would change the following lines:
      QMAKE_CFLAGS_RELEASE = -O2 -MD
      QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi
      QMAKE_CFLAGS_DEBUG = -Zi -MDd

    to:
    QMAKE_CFLAGS_RELEASE = -O2 -MT
    QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
    QMAKE_CFLAGS_DEBUG = -Zi -MTd

    ?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #12
      1. No, on windows static libraries and import libraries have the same extension.

      2. First download the sources, then edit that file in the sources

      3. Correct

      Then build

      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
      • J Offline
        J Offline
        John12341234
        wrote on last edited by
        #13

        I downloaded what was labeled as the source. It is a folder called "qt-everywhere-opensource-src-5.3.1" It seems to be non-specific and not designed for any particular IDE or anything which goes back to my original intuition. Almost every subfolder has a .qmake.conf file and none seem to have any mention of /MD switches. I'm guessing now that we're suddenly switching gears and using the source instead of the VS2013 specific Qt version that downloading the VS2013 version was a waste of time and should be deleted.

        1. What are the specific next steps after downloading the source?
          1a. What or which .qmake.conf files need to be edited and in what very very specific way?
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #14
          1. Download zip file (yes, the tar.gz is smaller but the line endings won't please windows)
          2. Uncompress zip file
          3. Edit qt-everywhere-opensource-src-5.3.1\mkspecs\win32-msvc2013\qmake.conf
          4. start a VS command line (64 or 32 bit depending on your needs)
          5. configure Qt with the options you want and -static, if you don't use webkit anywhere, don't build it it'll save you time. Also take extra care of what plugin you will want to use and build them in it will also simplify your life.
          6. call jom.exe (that you can find in your current Qt install) or nmake
          7. Enjoy you favorite beverage while Qt's compiling

          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
          1
          • J Offline
            J Offline
            John12341234
            wrote on last edited by
            #15

            Thank you very much for posting specific steps.

            1. I do not see a mkspecs folder. What is wrong here? (see attached image)
            2. Is there a link that outlines all of the different build options?

            !http://i.imgur.com/TcSarwP.png(pic)!

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

              Sorry, they are in qtbase

              configure --help will show you what you can do.

              I'd also recommend an out of source build so if something goes wrong you don't have to clean the sources.

              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
              • J Offline
                J Offline
                John12341234
                wrote on last edited by
                #17

                I've done up to step 5 but didn't know what options to use so I just ran "configure -static". Now I need to run nmake but what should the specific commands and flags be?
                nmake clean
                qmake ?
                namke ?

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

                  just nmake, it's like *nix make but from Visual Studio

                  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
                  • J Offline
                    J Offline
                    John12341234
                    wrote on last edited by
                    #19
                    1. Is the following error worth worrying about? (it looks like it is trying to run python for some reason..)
                    2. Is it intelligent enough to still try to compile everything else or did it stop and possibly not get to other things that would have successfully compiled?

                    C:/Users/John/Desktop/qt-everywhere-opensource-s
                    rc-5.3.1/qtbase/include/QtCore/5.3.1/QtCore -IC:/Users/John/Desktop/qt-everywhere-opensource-src-5.3.1/qtbase/include/QtCore jsapi\qjsengine.h -o .moc\debu
                    g\moc_qjsengine.cpp
                    python C:/Users/John/Desktop/qt-everywhere-opensource-src-5.3.1/qtdeclarative/src/3rdparty/masm/create_regex_tables > RegExpJitTables.h
                    'python' is not recognized as an internal or external command,
                    operable program or batch file.
                    NMAKE : fatal error U1077: 'python' : return code '0x1'
                    Stop.
                    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\nmake.exe"' : return code '0x2'
                    Stop.
                    NMAKE : fatal error U1077: 'cd' : return code '0x2'
                    Stop.
                    NMAKE : fatal error U1077: 'cd' : return code '0x2'
                    Stop.
                    NMAKE : fatal error U1077: 'cd' : return code '0x2'
                    Stop.

                    C:\Users\John\Desktop\qt-everywhere-opensource-src-5.3.1>

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

                      Sorry, I've been building it for so long that I forgot the requirements.

                      You'll find "here":http://qt-project.org/doc/qt-5/build-sources.html#windows the requirements as well as a more verbose set of instructions to build from source.

                      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
                      • J Offline
                        J Offline
                        John12341234
                        wrote on last edited by
                        #21

                        The overall goal here is to just be able to have an embedded OpenCV window, buttons, labels, checkboxes, sliders, etc in a GUI for a desktop application. The other requirement is that the desktop application not depend on any DLLs except what always comes with windows.

                        ActivePerl, Python and Ruby are needed for ANGLE and Webkit respectively. I don't think I need those.. What are the specific flags to bypass those and to just build what I need for what is described above?

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

                          If you just want the "base" configure and build only qtbase, to avoid ANGLE use -opengl desktop

                          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

                          • Login

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