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

qmake -qtconf … -query crashes on arm64 when qtconf has Qml2Imports setting

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • None
    • 6.6.2, 6.7.2
    • Build tools: qmake
    • None
    • Linux/X11

    Description

      In Debian, we are passing a qtconf file to qmake to make sure it produces the correct result when cross-building. On arm64, this file has the following content:

      (experimental_arm64-dchroot)mitya57@amdahl:~/qtbase-everywhere-src-6.7.2$ cat /usr/lib/aarch64-linux-gnu/qt6/qt6.conf
      [Paths]
      Prefix=/usr
      ArchData=lib/aarch64-linux-gnu/qt6
      Binaries=lib/qt6/bin
      Data=share/qt6
      Documentation=share/qt6/doc
      Headers=include/aarch64-linux-gnu/qt6
      HostBinaries=lib/qt6/bin
      HostData=lib/aarch64-linux-gnu/qt6
      HostLibraries=lib/aarch64-linux-gnu
      HostLibraryExecutables=lib/qt6/libexec
      Libraries=lib/aarch64-linux-gnu
      LibraryExecutables=lib/qt6/libexec
      Plugins=lib/aarch64-linux-gnu/qt6/plugins
      Qml2Imports=lib/aarch64-linux-gnu/qt6/qml
      Settings=/etc/xdg
      Translations=share/qt6/translations
      

      Recently, qmake -query started crashing on arm64 (aarch64) when a qtconf file is passed. Here is a gdb session:

      (experimental_arm64-dchroot)mitya57@amdahl:~/qtbase-everywhere-src-6.7.2$ gdb /usr/lib/qt6/bin/qmake
      GNU gdb (Debian 15.1-1) 15.1
      Copyright (C) 2024 Free Software Foundation, Inc.
      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
      Type "show copying" and "show warranty" for details.
      This GDB was configured as "aarch64-linux-gnu".
      Type "show configuration" for configuration details.
      For bug reporting instructions, please see:
      <https://www.gnu.org/software/gdb/bugs/>.
      Find the GDB manual and other documentation resources online at:
          <http://www.gnu.org/software/gdb/documentation/>.
      
      For help, type "help".
      Type "apropos word" to search for commands related to "word"...
      Reading symbols from /usr/lib/qt6/bin/qmake...
      Reading symbols from /usr/lib/debug/.build-id/6e/8118917128e07f0824c299fefb042251626a1c.debug...
      (gdb) r -qtconf /usr/lib/aarch64-linux-gnu/qt6/qt6.conf -query QT_INSTALL_PLUGINS
      Starting program: /usr/lib/qt6/bin/qmake -qtconf /usr/lib/aarch64-linux-gnu/qt6/qt6.conf -query QT_INSTALL_PLUGINS
      [Thread debugging using libthread_db enabled]
      Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
      
      Program received signal SIGSEGV, Segmentation fault.
      _q_resolveEntryAndCreateLegacyEngine_recursive (entry=..., data=..., engine=@0xffffffffe678: 0x0, resolvingEntry=resolvingEntry@entry=false) at ./src/corelib/io/qfilesystemengine.cpp:108
      108             QChar const ch = filePath[prefixSeparator];
      (gdb) bt
      #0  _q_resolveEntryAndCreateLegacyEngine_recursive (entry=..., data=..., engine=@0xffffffffe678: 0x0, resolvingEntry=resolvingEntry@entry=false)
          at ./src/corelib/io/qfilesystemengine.cpp:108
      #1  0x0000fffff7b4880c in QFileSystemEngine::resolveEntryAndCreateLegacyEngine (entry=..., data=...) at ./src/corelib/io/qfilesystemengine.cpp:161
      #2  0x0000fffff7b48ba0 in QFileInfoPrivate::QFileInfoPrivate (this=0xaaaaaac2b710, file=...) at ./src/corelib/io/qfileinfo_p.h:69
      #3  QFileInfo::QFileInfo (this=<optimized out>, path=..., this=<optimized out>, path=...) at ./src/corelib/io/qfileinfo.cpp:368
      #4  0x0000fffff7b377f8 in QDir::isRelativePath (path=...) at ./src/corelib/io/qdir.cpp:2412
      #5  0x0000aaaaaaab5e64 in QMakeLibraryInfo::rawLocation (loc=loc@entry=7, group=<optimized out>, group@entry=QMakeLibraryInfo::EffectiveSourcePaths) at ./qmake/qmakelibraryinfo.cpp:249
      #6  0x0000aaaaaaab68b8 in QMakeProperty::reload (this=<optimized out>) at ./qmake/property.cpp:62
      #7  0x0000aaaaaabbbd2c in QMakeProperty::QMakeProperty (this=0xffffffffeb10) at ./qmake/property.cpp:53
      #8  runQMake (argc=<optimized out>, argv=argv@entry=0xfffffffff418) at ./qmake/main.cpp:485
      #9  0x0000aaaaaaaaf9d8 in main (argc=<optimized out>, argv=0xfffffffff418) at ./qmake/main.cpp:578
      (gdb) up 5
      #5  0x0000aaaaaaab5e64 in QMakeLibraryInfo::rawLocation (loc=loc@entry=7, group=<optimized out>, group@entry=QMakeLibraryInfo::EffectiveSourcePaths) at ./qmake/qmakelibraryinfo.cpp:249
      249         if (!ret.isEmpty() && QDir::isRelativePath(ret)) {
      (gdb) p ret
      $1 = {d = {d = 0x0, ptr = 0x0, size = 29}, static _empty = 0 u'\000'}
      

      As you can see here, it crashes when loc == 7, which means QmlImportsPath (see LibraryPath enum). It is the only property for which there is a fallbackKey, so line 199 of qmake/qmakelibraryinfo.cpp is triggered.

      It looks like the resulting string has the correct size allocated (29 matches length of lib/aarch64-linux-gnu/qt6/qml), however the string content is null. Probably this has something to do with QVariant to QString conversion, however I failed to produce a minimal example of this behavior.

      I am happy to provide any additional debug info if needed.

      Attachments

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

        Activity

          People

            qtbuildsystem Qt Build System Team
            mandriver Dmitry Shachnev
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes