[Interest] Installation Sizes for Applications using Qt

Konstantin Tokarev annulen at yandex.ru
Sun Aug 29 23:52:18 CEST 2021



28.08.2021, 04:06, "Ben Cottrell" <bencot at windowslive.com>:
> Yes, I've tried configure with these command line arguments:
>    ./configure -opensource -confirm-license -platform linux-g++ -prefix
>    /opt/6.1.2-linux-g++-static -static
>
> I got lots of errors after running configure, about missing XCB
> libraries, so following the Ubuntu CI script, I installed them with:
>    apt install "^libxcb.*"
>
> I installed this on Debian 11.
>
> I managed to build a test project with cmake containing this code:
>    cmake_minimum_required(VERSION 3.20)
>    project(untitled)
>
>    set(CMAKE_CXX_STANDARD 17)
>    set(CMAKE_AUTOMOC ON)
>    set(CMAKE_AUTORCC ON)
>    set(CMAKE_AUTOUIC ON)
>    set(CMAKE_LINKER ld.gold)
>
>    set(CMAKE_PREFIX_PATH "/opt/6.1.2-linux-g++-static/lib/cmake")
>
>    find_package(Qt6 COMPONENTS
>            Core
>            Gui
>            Widgets
>            REQUIRED)
>
>    add_executable(untitled main.cpp)
>    target_link_libraries(untitled
>            Qt::Core
>            Qt::Gui
>            Qt::Widgets
>            )
>
> Here's the source to main.cpp:
>    #include <QApplication>
>    #include <QPushButton>
>
>    int main(int argc, char *argv[]) {
>        QApplication a(argc, argv);
>        QPushButton button("Hello world!", nullptr);
>        button.resize(200, 100);
>        button.show();
>        return QApplication::exec();
>    }
>
> Afterwards, I used strip on untitled, reducing the size to 16MB. If I
> give it to people, I'll provide the object file if they want to relink
> it.

If you do this for commercial or closed-source product, make sure you follow exact wording of the license.
IIRC you are required to make written offer to provide linking materials on request, but  as I said, check it
with the license text carefully.

-- 
Regards,
Konstantin


More information about the Interest mailing list