Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-88463

static build not executing the initialisation code of qml plugins

    XMLWordPrintable

    Details

    • Commits:
      e99cfb21d6018b36cdbc9832f9ce107569a92bf3 (qt/qtquickcontrols2/dev)

      Description

      The current method to ensure the initialisation of qml plugins with static builds is insufficient, and might skip the initialisation of them.

      The main issue is that currently the registration code is just a registration function and a static const variable that initialises a QQmlModuleRegistration that does the registration.

      The issue is that if no symbols from a compilation unit from a .a library are used, then the linker is free not to include it (this is not the case for an explicitly linked .o file).
      This is for example the case for example for

      libqtquickcontrols2macosstyleplugin.a(qtquickcontrols2macosstyleplugin_qmltyperegistrations.cpp.o):
      0000000000000050 s _GLOBAL_sub_I_qtquickcontrols2macosstyleplugin_qmltyperegistrations.cpp
      U __Z17qmlRegisterModulePKcii
      0000000000000000 T __Z41qml_register_types_QtQuick_Controls_macOSv
      0000000000005898 b __ZL12registration
      U __ZN22QQmlModuleRegistrationC1EPKcPFvvE
      U __ZN22QQmlModuleRegistrationD1Ev
      U ___cxa_atexit
      U ___dso_handle

      Indeed it might be surprising that this was not seen before, but there is another things that hides it and makes it work in many occasions: the registration of QMetaTypes, templates or other stuff fro .h files that then make the module "used" and thus trigger its inclusion in the final binary.

      To fix this one we need to either include an explicit external symbol from there, explicitly call the initialisation function or similar approaches.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            fawzi Fawzi Mohamed
            Reporter:
            fawzi Fawzi Mohamed
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes