[Development] Qt Static Package

Morten Sørvig Morten.Sorvig at qt.io
Wed Apr 24 12:21:02 CEST 2019


We’re successfully building Qt Quick Controls 2 statically for the WebAssembly target, so it should be possible. I don’t think we’re doing anything special. The test cases include the “gallery” example.

The generated qml_plugin_import.cpp file has the style plugins as well:

   Q_IMPORT_PLUGIN(QtQuickControls2Plugin)
   Q_IMPORT_PLUGIN(QtQuickControls2MaterialStylePlugin)
   Q_IMPORT_PLUGIN(QtQuickControls2UniversalStylePlugin)

Morten

> On 20 Apr 2019, at 02:56, Carlos Enrique Pérez Sánchez <ceperez1996 at gmail.com> wrote:
> 
> I invited Mitch Curtis to join the discussion. He may have a word on this since he is actively working on the Qt Quick Controls 2 module. Hope he can help us here. Making a working static build of Qt Quick Controls 2 can push forward the release of static packages.
> 
> El vie., 19 abr. 2019 a las 20:31, Carlos Enrique Pérez Sánchez (<ceperez1996 at gmail.com>) escribió:
> By the way. I have made no changes to my .pro file after build my static version of Qt. The reason is that the Qt Doc says (https://doc.qt.io/qt-5/plugins-howto.html#static-plugins):
> Plugins can be linked statically into your application. If you build the static version of Qt, this is the only option for including Qt's predefined plugins. Using static plugins makes the deployment less error-prone, but has the disadvantage that no functionality from plugins can be added without a complete rebuild and redistribution of the application.
> To link plugins statically, you need to add the required plugins to your build using QTPLUGIN.
> 
> In the .pro file for your application, you need the following entry:
> 
> 
>   QTPLUGIN     += qjpeg \
>                    qgif \
>                    qkrcodecs
> 
> qmake automatically adds the plugins to QTPLUGIN that are typically needed by the Qt modules used (see QT), while more specialized plugins need to be added manually.
> 
> So, according with this, I have no need of importing Qt plugind related to Qt Quick Controls 2. Also, I have checked that the qmlimportscanner works appropriatelly. 
> 
> The page Deploying Qt Quick Controls 2 Applications says the following about static linking:
> For dynamically built applications, it is not necessary to import a specific style that should be usable by that application. For statically built applications, Qt's build system must be involved to ensure that QML plugins function as expected. Specifically, qmake uses qmlimportscanner to scan the QML files in your application for import statements. For this reason, any styles that should be usable by a statically built application must explicitly import that style. Where the import occurs is up to the developer, but it is recommended to follow the approach mentioned in the Deploying an Application with Several Styles section, so that only the minimum set of files that are necessary for a particular device are deployed.
> 
> So, they should be built QQC2 statically before (because if not, document that makes no sense) and they says that the only requirement is explicitly importing the style plugin. Sadly, that does not work for me.
> 
> El vie., 19 abr. 2019 a las 19:45, Carlos Enrique Pérez Sánchez (<ceperez1996 at gmail.com>) escribió:
> Thanks, Thiago. I will build Qt statically today on Windows, and I will try using the system version. Same with Linux. However, I really don't think that doing that solves the problem with the static linking of QtQuick Controls 2 module. Thanks in advance.
> 
> El jue., 18 abr. 2019 a las 23:23, Thiago Macieira (<thiago.macieira at intel.com>) escribió:
> On Friday, 19 April 2019 08:11:41 +08 Carlos Enrique Pérez Sánchez wrote:
> > ```
> > ./configure -prefix "/somePath/Qt512Static" -static -release -opensource
> > -confirm-license -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -fontconfig
> > -qt-xcb -opengl desktop -sql-sqlite -make libs -make tools -nomake examples
> > -nomake tests -skip qtwebengine
> > ```
> 
> Please note the -qt-zlib option and family: if you choose to use the bundled 
> versions from Qt, you'll need to monitor those upstreams for security issues 
> and, if any is found, rebuild your application after applying the fix to the 
> sources bundled in Qt.
> 
> Far better to use -system-zlib and family.
> 
> -- 
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel System Software Products
> 
> 
> 
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development



More information about the Development mailing list