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. Cannot make static application (Windows).
Forum Updated to NodeBB v4.3 + New Features

Cannot make static application (Windows).

Scheduled Pinned Locked Moved Installation and Deployment
7 Posts 2 Posters 4.4k 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.
  • G Offline
    G Offline
    Gourmand
    wrote on last edited by
    #1

    I successfully created static app with Qt4.5. Now I changed to 4.7 and I'm unable create it. I installed Qt on new machine and clearly followed all instructions from [url=http://developer.qt.nokia.com/wiki/How_to_build_a_static_Qt_version_for_Windows_with_gcc]this page[/url]. Qt assembled as static and I see libraries. Then I ported my project. It compiles as well but assembles as dynamically linked.

    Project consists of 2 parts: static library subproject and main application subproject. Following are settings for each project:

    Static library:
    QtCreator settings:
    [quote]Build configuration: Release
    Build steps\qmake\Additional arguments: -spec i:/qt/2010.05s/qt/mkspecs/win32-g++ CONFIG+=release CONFIG+=create_prl CONFIG+=static[/quote]

    At .pro file beginning:
    @
    static {
    CONFIG += staticlib
    DEFINES += STATIC
    message( "-----------STATIC-----------" )
    QMAKE_LFLAGS += -static
    }
    @

    Main application
    QtCreator settings:
    [quote]Build configuration: Release
    Build steps\qmake\Additional arguments: -spec i:/qt/2010.05s/qt/mkspecs/win32-g++ CONFIG+=link_prl CONFIG+=static (CONFIG+=release added automatically to effective qmake call)[/quote]

    At .pro file beginning:
    @
    static {
    CONFIG += static
    DEFINES += STATIC
    message( "-----------STATIC-----------" )
    QMAKE_LFLAGS += -static
    }
    @

    At the end of .pro file there is:
    @
    CONFIG( release, release|debug ) {
    LIBS += <path and name of static library>
    PRE_TARGETDEPS += <path and name of static library>
    message( "------------RELEASE------------" )
    }
    @

    Projects create static library and application without debugging info. But application is dynamically linked and depends from mingwm10.dll, msvcrt.dll, QtCore4.dll, QtGui4.dll. What is wrong and how can I assemble static application without dependence from Qt libraries?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      is it possible that you use a different Qt version for building? especially, if it relates on msvcrt.dll... This is MSVS build.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Gourmand
        wrote on last edited by
        #3

        I found there was setting from older installation. When I removed it I've got error message about throw used but exceptions was prohibited. Now I remembered - I need exceptions allowed for this project. Have to rebuild Qt4 from source again...

        I'd recommend add something in the article. If exceptions are strongly needed, than -no-exceptions options must not be used. But mingw32.dll will be mandatory distributed with application. Not so heavy task. This library is very small.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          If you use exceptions, there were some minor things with mingw static libs do not work I think. could be this mingw32.dll or whatever the name was.

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0
          • G Offline
            G Offline
            Gourmand
            wrote on last edited by
            #5

            With Qt4.5 it worked well. Hope with 4.7 will work too.

            1 Reply Last reply
            0
            • G Offline
              G Offline
              giesbert
              wrote on last edited by
              #6

              In general it works. I used it for some apps, and they need no other dll, but I didn't use exceptions. The thing with the dll is from mingw version, not from qt version :-)

              Nokia Certified Qt Specialist.
              Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

              1 Reply Last reply
              0
              • G Offline
                G Offline
                Gourmand
                wrote on last edited by
                #7

                SOLVED. After Qt was rebuild with exceptions and properly tuned - program works but requires small 12 KB mingwm10.dll to support exceptions. Not a problem.

                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