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

Qt configured with "-ltcg" fails to build working apps

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • None
    • 6.7.3
    • Build System
    • None
    • (K)Ubuntu 24.04
    • WebAssembly

    Description

      I want to build for webassembly, and therefore file size is very important. I recently read https://www.qt.io/blog/reducing-binary-size-of-qt-applications-with-qt-6.8-part-2-coffee-machine-example and though that this should also apply for such builds.

      However, when i use my custom configured Qt build, I get linker warnings and the resulting wasm does not run.

      Configuration is done by
      Qt/6.7.3/wasm_custom$ ../Src/configure -qt-host-path /home/madam/bin/Qt/6.7.3/gcc_64/ -release -optimize-size -ltcg -make libs -no-widgets -platform wasm-emscripten -submodules qtdeclarative -feature-wasm-simd128 -feature-thread -feature-qui
      ck-canvas -no-feature-quick-designer -no-feature-quick-particles -no-feature-quick-sprite -no-feature-raster-64bit -no-feature-raster-fp  -prefix /home/madam/bin/Qt/6.7.3/wasm_custom/ && cmake --build . --parallel && cmake --install .

      The linker warnings are

      em++: warning: -pthread + ALLOW_MEMORY_GROWTH may run non-wasm code slowly, see https://github.com/WebAssembly/design/issues/1271 [-Wpthreads-mem-growth]
      cache:INFO: generating system asset: symbol_lists/3ea9a6f15ced4f99606e4cb792e8f80de3cd4e82.json... (this will be cached in "/home/madam/bin/emsdk/upstream/emscripten/cache/symbol_lists/3ea9a6f15ced4f99606e4cb792e8f80de3cd4e82.json" for subsequent builds)
      cache:INFO:  - ok
      wasm-ld: warning: function signature mismatch: _ZThn8_NK11QWasmScreen10logicalDpiEv
      >>> defined as () -> void in /home/madam/bin/Qt/6.7.3/wasm_custom/plugins/platforms/libqwasm.a(qwasmscreen.cpp.o)
      >>> defined as (i32, i32) -> void in lto.tmp

      wasm-ld: warning: function signature mismatch: _ZNK19QQuickCalendarModel9roleNamesEv
      >>> defined as () -> void in /home/madam/bin/Qt/6.7.3/wasm_custom/lib/libQt6QuickTemplates2.a(qquickcalendarmodel.cpp.o)
      >>> defined as (i32, i32) -> void in lto.tmp

      wasm-ld: warning: function signature mismatch: _ZNK19QAbstractProxyModel22mapSelectionFromSourceERK14QItemSelection
      >>> defined as () -> void in /home/madam/bin/Qt/6.7.3/wasm_custom/lib/libQt6Core.a(qabstractproxymodel.cpp.o)
      >>> defined as (i32, i32, i32) -> void in lto.tmp

      wasm-ld: warning: function signature mismatch: _ZN11QTlsPrivate22X509CertificateGeneric19certificatesFromDerERK10QByteArrayi
      >>> defined as () -> void in /home/madam/bin/Qt/6.7.3/wasm_custom/plugins/tls/libqcertonlybackend.a(qx509_generic.cpp.o)
      >>> defined as (i32, i32, i32) -> void in lto.tmp

      wasm-ld: warning: function signature mismatch: _ZNK19QAbstractProxyModel20mapSelectionToSourceERK14QItemSelection
      >>> defined as () -> void in /home/madam/bin/Qt/6.7.3/wasm_custom/lib/libQt6Core.a(qabstractproxymodel.cpp.o)
      >>> defined as (i32, i32, i32) -> void in lto.tmp

      wasm-ld: warning: function signature mismatch: _ZNK11QTlsPrivate19X509CertificateBase21subjectInfoAttributesEv
      >>> defined as () -> void in /home/madam/bin/Qt/6.7.3/wasm_custom/plugins/tls/libqcertonlybackend.a(qx509_base.cpp.o)
      >>> defined as (i32, i32) -> void in lto.tmp

      wasm-ld: warning: function signature mismatch: _ZNK11QWasmScreen10logicalDpiEv
      >>> defined as () -> void in /home/madam/bin/Qt/6.7.3/wasm_custom/plugins/platforms/libqwasm.a(qwasmscreen.cpp.o)
      >>> defined as (i32, i32) -> void in lto.tmp

      wasm-ld: warning: function signature mismatch: _ZN11QTlsPrivate22X509CertificateGeneric19certificatesFromPemERK10QByteArrayi
      >>> defined as () -> void in /home/madam/bin/Qt/6.7.3/wasm_custom/plugins/tls/libqcertonlybackend.a(qx509_generic.cpp.o)
      >>> defined as (i32, i32, i32) -> void in lto.tmp

      wasm-ld: warning: function signature mismatch: _ZNK11QTlsPrivate19X509CertificateBase20issuerInfoAttributesEv
      >>> defined as () -> void in /home/madam/bin/Qt/6.7.3/wasm_custom/plugins/tls/libqcertonlybackend.a(qx509_base.cpp.o)
      >>> defined as (i32, i32) -> void in lto.tmp

      wasm-ld: warning: function signature mismatch: _ZNK13QQmlListModel9roleNamesEv
      >>> defined as () -> void in /home/madam/bin/Qt/6.7.3/wasm_custom/lib/libQt6QmlModels.a(qqmllistmodel.cpp.o)
      >>> defined as (i32, i32) -> void in lto.tmp

      wasm-ld: warning: function signature mismatch: _ZNK11QTlsBackend17ellipticCurvesIdsEv
      >>> defined as () -> void in /home/madam/bin/Qt/6.7.3/wasm_custom/lib/libQt6Network.a(qtlsbackend.cpp.o)
      >>> defined as (i32, i32) -> void in lto.tmp

      wasm-ld: warning: function signature mismatch: _ZNK11QTlsBackend20systemCaCertificatesEv
      >>> defined as () -> void in /home/madam/bin/Qt/6.7.3/wasm_custom/lib/libQt6Network.a(qtlsbackend.cpp.o)
      >>> defined as (i32, i32) -> void in lto.tmp

      wasm-ld: warning: function signature mismatch: _ZN15QQmlObjectModel7releaseEP7QObjectN17QQmlInstanceModel12ReusableFlagE
      >>> defined as () -> void in /home/madam/bin/Qt/6.7.3/wasm_custom/lib/libQt6QmlModels.a(qqmlobjectmodel.cpp.o)
      >>> defined as (i32, i32, i32) -> i32 in lto.tmp

      wasm-ld: warning: function signature mismatch: _ZN17QQmlDelegateModel7releaseEP7QObjectN17QQmlInstanceModel12ReusableFlagE
      >>> defined as () -> void in /home/madam/bin/Qt/6.7.3/wasm_custom/lib/libQt6QmlModels.a(qqmldelegatemodel.cpp.o)
      >>> defined as (i32, i32, i32) -> i32 in lto.tmp

      wasm-ld: warning: function signature mismatch: _ZNK19QAbstractProxyModel9roleNamesEv
      >>> defined as () -> void in /home/madam/bin/Qt/6.7.3/wasm_custom/lib/libQt6Core.a(qabstractproxymodel.cpp.o)
      >>> defined as (i32, i32) -> void in lto.tmp

       

      and the runtime error is

      RuntimeError: indirect call to null
          _main http://localhost:30000/coffee.js:8
          callMain http://localhost:30000/coffee.js:8
          qtLoad http://localhost:30000/qtloader.js:229
          init http://localhost:30000/coffee.html:48
          onload http://localhost:30000/coffee.html:1
      coffee.html:66:25
          init http://localhost:30000/coffee.html:66
          onload http://localhost:30000/coffee.html:1

      If binary sizes get reduced by -ltcg, then that would be particularly important for release builds of webassembly. currently, the files are massive, e.g., the coffe example produces a 20mb file. yes, that get's compressed, but it still increases the time to app, as larger files mean longer compilation times in the browser.

      Attachments

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

        Activity

          People

            qt.webassembly qt.webassembly
            adamce Adam
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes