Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Why does my application become 25 times bigger!



  • Hi,
    I am an embedded developer and develop C++ application for ARM7TDMI 32-bit RISC microcontroller. Size of application ~800K. Our company decided to change the microcontroller platform to SoM + linux + Qt + QtCreator. I have ported application using Qt library. I was very surprised when I saw the size of my application - 25 megabytes! The application has increased more than 25 times! I have a free version of Qt so I use Qt as lib * .so from / usr / lib. Maybe it is not? How can I tell Qt Creator to link the library at runtime?


  • Lifetime Qt Champion

    Hi,

    Are you using a static build of Qt ?



  • I user Qt Creator. How can I to known?



  • This is example my *.pro file

    #-------------------------------------------------

    Project created by QtCreator 2019-07-25T21:40:13

    #-------------------------------------------------

    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = WidgetProbe
    TEMPLATE = app

    The following define makes your compiler emit warnings if you use

    any feature of Qt which has been marked as deprecated (the exact warnings

    depend on your compiler). Please consult the documentation of the

    deprecated API in order to know how to port your code away from it.

    DEFINES += QT_DEPRECATED_WARNINGS

    You can also make your code fail to compile if you use deprecated APIs.

    In order to do so, uncomment the following line.

    You can also select to disable deprecated APIs only up to a certain version of Qt.

    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

    CONFIG += c++11

    SOURCES +=
    main.cpp
    mainwindow.cpp

    HEADERS +=
    mainwindow.h

    FORMS +=
    mainwindow.ui

    Default rules for deployment.

    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target



  • Sorry

    #-------------------------------------------------
    #
    # Project created by QtCreator 2019-07-25T21:40:13
    #
    #-------------------------------------------------
    
    QT       += core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = WidgetProbe
    TEMPLATE = app
    
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which has been marked as deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    
    # You can also make your code fail to compile if you use deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    CONFIG += c++11
    
    SOURCES += \
            main.cpp \
            mainwindow.cpp
    
    HEADERS += \
            mainwindow.h
    
    FORMS += \
            mainwindow.ui
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    

  • Lifetime Qt Champion

    Check the Qt version used by the Kit you are using to build your application. Go in the corresponding folder and see if there are only .a lib files.



  • Thanks for the quick response! I'll look tomorrow. I do not have a project at hand.



  • Can I tell Qt Creator to explicitly use dynamic layout?



  • @SGaist
    Well, I blunted! Build for debugging. Need to switch to Release



  • @LyzV
    Debug builds can be a bit bigger than Release ones ;-)

    You may still be a bit optimistic if you expect to "port your application from non-Qt to Qt" and not see any difference in final size.


Log in to reply