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

QtQuickCompiler, FileSelectors & MinGW Library Linker not compatible

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.11.1
    • QML: Compiler
    • None
    • Windows 10, stock Qt 5.11.1 MinGW installation from online installer
    • Windows

    Description

      There is a special case where current QtQuickCompiler breaks when building a library with provided MinGW 5.3 toolchain:

      Setup:

      • Create a project with more than 10 QML and/or C++ files
      • Add one QML file in a file selector subdirectory (e.g. "+selector/file.qml")
      • Use a QRC file for the project (default)
      • Enable QtQuickCompiler with "CONFIG += qtquickcompiler"
      • Build a static library with "TEMPLATE = lib" and "CONFIG += staticlib"
      • Build the project with prebuilt "Desktop Qt 5.11.1 MinGW 32bit" Kit

      Result:

      The build fails during linking with an error like: "ar: can't open file selector_file_qml.o".

       Reason:

      If providing more than 10 linker files, qmake creates a script file that's passed to ar instead of providing the object files on the command line (configured with QMAKE_LINK_OBJECT_MAX in mkspecs). This is to prevent an issue with hitting max. chars possible on command line on Windows.

      MinGW ar linker now reads in a line like "./debug+selector_file_qml.o". The "+" might be interpreted as a line separator, which results in reading in an incomplete filename. This might be related to MinGW bug: https://sourceforge.net/p/mingw/bugs/1429/ . The linker finally fails because of the malformed filename.

      This does not happen if you:

      • Increase QMAKE_LINK_OBJECT_MAX (might hit the maximum line length though)
      • Build a shared library or app (the resulting object_script file has different syntax then; INPUT() instead of ADDMOD lines)
      • Do not use file selectors or do not use QtQuickCompiler with MinGW obviously

      Another quickfix might be to strip out "+" chars from generated CPP files of qmlcachegen call (qmlCacheOutputName defineReplace method).

      Is that a known issue at the moment? Any workarounds despite the mentioned ones? Will this be fixed with upcoming MinGW 7 toolchain?

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            alexleutgoeb Alex Leutgöb
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes