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. Creating a static linked exe - what did I miss?
Forum Updated to NodeBB v4.3 + New Features

Creating a static linked exe - what did I miss?

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
12 Posts 2 Posters 3.0k Views 2 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.
  • Z Offline
    Z Offline
    Zeblote
    wrote on 5 Dec 2017, 21:27 last edited by
    #3

    @SGaist said in Creating a static linked exe - what did I miss?:

    Hi,

    1. The usual way to build and install Qt is to use an out of source build and call nmake/mingw32-make install when done.
    2. Don't know, not enough details
    3. You are using a static build of Qt and I assume you are using a QWidget so you have three modules linked: core, gui and widgets.
      Static builds do not make smaller applications executable. It pulls in every bit of code need from all the dependencies of said executable.

    I see. I've tried changing the build command to build to another folder with the prefix thing, but it did not compile. Is something missing?

    • configure.bat -prefix C:\Qt\5.9.3\static -debug-and-release -opensource -static -static-runtime -nomake examples -nomake tests -no-icu -optimize-size -confirm-license
    • C:\Qt\Jom\jom.exe

    https://www.dropbox.com/s/al9x7wgg9vggwfh/log.txt?dl=0

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 5 Dec 2017, 21:37 last edited by
      #4

      You called configure in the same folder without cleaning first ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Z 1 Reply Last reply 5 Dec 2017, 21:38
      0
      • S SGaist
        5 Dec 2017, 21:37

        You called configure in the same folder without cleaning first ?

        Z Offline
        Z Offline
        Zeblote
        wrote on 5 Dec 2017, 21:38 last edited by Zeblote 12 May 2017, 21:39
        #5

        @SGaist said in Creating a static linked exe - what did I miss?:

        You called configure in the same folder without cleaning first ?

        I used C:\Qt\Jom\jom.exe distclean first, is that still the correct command?


        Edit: I forgot to switch to the new "static" folder before running the build command. It compiled fine this time.

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          Zeblote
          wrote on 5 Dec 2017, 21:46 last edited by Zeblote 12 May 2017, 21:49
          #6

          That took care of the installed build warning, but the one about a missing qmlscene remains.

          alt text

          Is this a problem if I'm not using any qml? I assume it can be ignored.

          -optimize-size also reduced the size of the exe to 13MB, which can be further reduced to 5MB with UPX. This seems fine for now considering it's with a static runtime and everything.

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            Zeblote
            wrote on 5 Dec 2017, 21:54 last edited by
            #7

            That still didn't solve the problem with the debug build though. It will instantly show this error:

            alt text

            Not a major problem as I can just debug it with the default, non-static version, but still curious what could cause it? I have no idea what kind of log files Qt writes that might be relevant here.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 5 Dec 2017, 22:00 last edited by
              #8

              No it's not, it's only used for QML.

              Did you check the backtrace ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              Z 1 Reply Last reply 5 Dec 2017, 22:04
              0
              • S SGaist
                5 Dec 2017, 22:00

                No it's not, it's only used for QML.

                Did you check the backtrace ?

                Z Offline
                Z Offline
                Zeblote
                wrote on 5 Dec 2017, 22:04 last edited by
                #9

                @SGaist said in Creating a static linked exe - what did I miss?:

                Did you check the backtrace ?

                It breaks here:

                alt text

                alt text

                1 Reply Last reply
                0
                • Z Offline
                  Z Offline
                  Zeblote
                  wrote on 5 Dec 2017, 22:13 last edited by Zeblote 12 May 2017, 22:18
                  #10

                  I just noticed that this testapp_plugin_import.cpp loads a whole bunch of stuff that I don't use.

                  alt text

                  Could this be a reason for the exe file being huge?
                  I tried disabling them in the .pro file using QTPLUGIN -= qgif, but it changed nothing (this file still looks the same after rebuild).

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 5 Dec 2017, 22:21 last edited by
                    #11

                    Did you re-run qmake before building ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    Z 1 Reply Last reply 5 Dec 2017, 22:25
                    0
                    • S SGaist
                      5 Dec 2017, 22:21

                      Did you re-run qmake before building ?

                      Z Offline
                      Z Offline
                      Zeblote
                      wrote on 5 Dec 2017, 22:25 last edited by Zeblote 12 May 2017, 22:26
                      #12

                      @SGaist said in Creating a static linked exe - what did I miss?:

                      Did you re-run qmake before building ?

                      Yes, I even deleted the entire build folder to make sure. It re-writes the plugin imports exactly the same.
                      Manually editing this file to remove the unnecessary plugins shrinks the exe by 1MB (or 300KB after packing), so it doesn't change all that much

                      1 Reply Last reply
                      0

                      12/12

                      5 Dec 2017, 22:25

                      • Login

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