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

CMake subarch extraction does not always succeed

    XMLWordPrintable

Details

    • e7457ff17 (dev), fa41643a7 (6.7), 493c596a6 (6.6)

    Description

      QtBaseConfigureTests.cmake contains a Sub-architecture string length check that stops working if the string grabbed by CMake does not start with the desired ==Qt... snippet. This makes the configuration fail, running into

      -- Configuring submodule 'qtbase'
      -- Warning: Did not find file Compiler/-ASM
                  -DCMAKE_C_FLAGS_DEBUG=-g
                  -DCMAKE_C_FLAGS_RELEASE=-O3 -DNDEBUG
                  -DCMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -g -DNDEBUG
                  -DCMAKE_CXX_FLAGS=-O3
                  -DCMAKE_CXX_FLAGS_DEBUG=-g
                  -DCMAKE_CXX_FLAGS_RELEASE=-O3 -DNDEBUG
                  -DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O2 -g -DNDEBUG
                  -DCMAKE_OBJCOPY=/usr/bin/llvm-objcopy
                  -DCMAKE_TOOLCHAIN_FILE=/home/dev/.conan/data/emsdk/3.1.50/bje/stable/package/1b9cae620f52583dcb25f37430b509cc22615199/bin/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
                  -DCMAKE_C_STANDARD=11
                  -DCMAKE_C_STANDARD_REQUIRED=ON
                  -DCMAKE_CXX_STANDARD=17
                  -DCMAKE_CXX_STANDARD_REQUIRED=ON
                  -DCMAKE_MODULE_PATH:STRING=/home/dev/.conan/data/qt/6.6.1/bje/stable/source/qt6/qtbase/cmake/platforms
      CMake Error at qtbase/cmake/QtBaseConfigureTests.cmake:78 (string):
        string begin index: 35 is out of range 0 - 34
      

      A fix could be to test for the string ending instead. Or add _pos to the lenght check, but that are probably more lines of code:

      diff -Naur a/qtbase/cmake/QtBaseConfigureTests.cmake b/qtbase/cmake/QtBaseConfigureTests.cmake
      --- a/qtbase/cmake/QtBaseConfigureTests.cmake   2023-11-15 14:58:42.000000000 +0100
      +++ b/qtbase/cmake/QtBaseConfigureTests.cmake   2023-12-14 13:55:07.064656261 +0100
      @@ -73,7 +73,7 @@
                   string(SUBSTRING "${_line}" ${_pos} -1 _architecture)
               endif()
               string(FIND "${_line}" "==Qt=magic=Qt== Sub-architecture:" _pos)
      -        if (_pos GREATER -1 AND ${lineLength} GREATER 33)
      +        if (_pos GREATER -1 AND NOT _line MATCHES "Sub-architecture:$")
                   math(EXPR _pos "${_pos}+34")
                   string(SUBSTRING "${_line}" ${_pos} -1 _sub_architecture)
                   string(REPLACE " " ";" _sub_architecture "${_sub_architecture}")
      

      The attached architecture_test.wasm file demonstrates the problem.

      Attachments

        For Gerrit Dashboard: QTBUG-120125
        # Subject Branch Project Status CR V

        Activity

          People

            qtbuildsystem Qt Build System Team
            cajus Cajus Pollmeier
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There is 1 open Gerrit change