Static Compilation of Qt 5.1.1 on Windows 7 64-bit with mingw32



  • Dear Qt friends/developers,

    I know this has been discussed again and again and indeed I read the f* manual already. I did a static built of my Qt 5.1.1 installation according to the documentation at

    http://qt-project.org/doc/qt-5.1/qtdoc/deployment-windows.html

    The compilation was successful, however my application still doesn't get linked statically to the Qt libraries, although the linker flags clearly state "-static -static-libgcc".

    I checked the directory structure in my Qt installation and was wondering about the location of different libraries. Right after the installation of the Qt SDK I have 77 libraries (*.a) in the folder

    <SOME_PATH>\Qt5\5.1.1\mingw48_32\lib

    When I built Qt statically I get 27 libraries (*.a) in the folder:

    <SOME_PATH>\Qt5\5.1.1\Src\qtbase\lib

    I added the following two lines in my project file:

    @
    QMAKE_LFLAGS += -static -static-libgcc
    CONFIG += static
    @

    However, when it comes to linking my application, I can still see that Qt Creator tries to link against the libraries found in the "mingw48_32/lib" directory rather than the newly built ones in "Src\qtbase\lib".

    @
    -LC:\Programme_x86\Qt5\5.1.1\mingw48_32\lib -lQt5Multimedia -lQt5Widgets -lQt5Network -lQt5Gui -lQt5Core
    @

    I would appreciate if anybody could shed some light on this.

    Thanks in advance,
    Markus

    PS.: I know the license implications for static linking.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Just some point to go through:

    Did you add your static build to the known Qt version in Qt Creator ?

    Did you make a Kit with it ?

    Do you use that kit to build your project ?



  • Dear SGaist,

    thanks for your reply. I have been already missing the first point. I tried to add the static built to the Qt versions in Qt Creator. The Qt version is being recognized, however Qt Creator prints something like (translated from German) the following warning:

    "qmlscene is not installed, no qmlviewer installed"

    Do I have to manually built these tools?

    Thanks and with best regards,
    Markus

    PS.: I also noticed that the Qt multimedia module has not been built. I configured Qt with the following command:

    configure -static -nomake examples -debug-and-release -opengl desktop

    Any comments on this?


  • Lifetime Qt Champion

    IIRC you should be able to build them in the helps panel under the list of Qt versions.

    Thats surprising, you can try to build it my hand, go to your build directory/qtmultimedia and call qmake path_to_qt_multimedia_sources then build



  • Ok, I compiled & installed the multimedia module manually according to https://qt-project.org/forums/viewthread/31352/

    Then I added "QMAKE_LFLAGS += -static -static-libgcc" to my *.pro file and now I am able to completely link my QtWidget based application statically. I am still wondering why I had to manually built the multimedia module.

    Furthermore, there is still the warning in Qt Creator regarding the missing qmlscene and qmlviewser. I don't know what you mean by "helps panel under the list of Qt versions". As far as I know there you can only built the Debugging-Helpers.
    What kind of modules do I have to built additionally to get rid of the missing qmlscene/qmlviewer message? I tried building qtdeclarative but it gives me the following error message:

    Project ERROR: Unknown module(s) in QT_PRIVATE: v8

    Seems like I would also have to rebuilt the V8 Javascript engine, right?

    Thanks for your advice and with best regards,
    Markus


  • Lifetime Qt Champion

    If you select a Qt version you have under the tree view a set of boxes with informations, the last one is call Helpers, if you click on show details you'll see more information about them.



  • Sorry, but I don't get it. I can see the helpers box but I am not able to see any connection to either the automatic building of the Qt Multimedia module or the qmlscene/qmlviewer message. I repeat my question:

    What kind of modules do I have to built additionally to get rid of the "missing qmlscene/qmlviewer" message? I tried building qtdeclarative but it gives me the following error message:

    Project ERROR: Unknown module(s) in QT_PRIVATE: v8

    Seems like I would also have to rebuilt the V8 Javascript engine, right?

    Thanks for your advice and with best regards,
    Markus


  • Lifetime Qt Champion

    Depending on the Qt version, you won't have them (they have been replaced), so the warning stays but is not armful.

    IIRC, the v8 engine is found in the qtdeclarative module


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.