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

Qt doesn't work if compiled with LTO

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.9.0
    • Core: Other
    • None
    • Arch Linux 64-bit

    Description

      It's hard to tell how long this bug has existed for, but I've only recently discovered it.
      It's most likely the issue is with gold linker, but I wouldn't be able to provide good information to the Gold linker devs.

      So far only myself and one other user have experienced this bug, both on Arch Linux.
      If your interested in how Qt 5.9 is built on Arch Linux, the build script is here: https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/qt5-base#n68

      Dolphin-emu seems to be aware of this bug: https://github.com/dolphin-emu/dolphin/wiki/Building-With-Qt which mentions that building with lto will break qt.

      The console outputs something like the following whenever you try to launch a Qt application built with LTO.

      QObject::connect: signal not found in QPAEventDispatcherGlib 
      QObject::connect: signal not found in QCommandLinkButton 
      QObject::connect: signal not found in QCommandLinkButton 
      QObject::connect: signal not found in QPushButton

      I've been able to reproduce the issue with: 
      https://github.com/RoboJackets/qt-example/tree/completed 

      using the following cmake flags:

       

      cmake ../ -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-flto" -DCMAKE_C_FLAGS=" -flto" -DCMAKE_CXX_COMPILER=clang

       

       

      and adding target_link_libraries(example -lstdc++) on line 21 of CMakeLists.txt

      It would be great if we could reproduce this on different distros.

      Also, would appreciate guidance if this is the wrong component. 

       

      Additional version information: 

      Intel i7 4770
      KDE Plasma running on X11
      Distro-provided Qt 5.9
      gcc (GCC) 7.1.1 20170528

      clang version 4.0.1 (tags/RELEASE_401/final)

      binutils 2.28.0-3 (provider of gold linker)

      GNU gold (GNU Binutils 2.28.0.20170506) 1.14

      cmake version 3.8.2

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            hcorion Zion Nimchuk
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes