Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Crash when initializing QGuiApplication object under Windows ARM64

Qt Crash when initializing QGuiApplication object under Windows ARM64

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 372 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    just_a_developer
    wrote on last edited by
    #1

    I built Qt 5.15.7 myself for Windows ARM64 using a patch :

    diff --git a/qtbase/configure.bat b/qtbase/configure.bat
    index b34e146f5..ca2827b6e 100644
    --- a/qtbase/configure.bat
    +++ b/qtbase/configure.bat
    @@ -96,6 +96,9 @@ goto doneargs
         if /i "%~1" == "-make-tool" goto maketool
         if /i "%~1" == "--make-tool" goto maketool
     
    +    if /i "%~1" == "-external-hostbindir" goto hosttools
    +    if /i "%~1" == "--external-hostbindir" goto hosttools
    +
     :nextarg
         shift
         goto doargs
    @@ -144,6 +147,11 @@ goto doneargs
         set MAKE=%~1
         goto nextarg
     
    +:hosttools
    +    shift
    +    set CFG_HOST_QT_TOOLS_PATH=%~1
    +    goto nextarg
    +
     :doneargs
     
     rem Find various executables
    @@ -276,7 +284,9 @@ cd ..
     
     rem Generate qt.conf
     
    -> "%QTDIR%\bin\qt.conf" (
    +set QTCONFFILE=%QTDIR%\bin\qt.conf
    +
    +> "%QTCONFFILE%" (
         @echo [EffectivePaths]
         @echo Prefix=..
         @echo [Paths]
    @@ -284,7 +294,7 @@ rem Generate qt.conf
         @echo HostSpec=%PLATFORM%
     )
     if not "%QTDIR%" == "%QTSRC%" (
    -    >> "%QTDIR%\bin\qt.conf" (
    +    >> "%QTCONFFILE%" (
             @echo [EffectiveSourcePaths]
             @echo Prefix=%QTSRC:\=/%
         )
    @@ -293,4 +303,8 @@ if not "%QTDIR%" == "%QTSRC%" (
     rem Launch qmake-based configure
     
     cd "%TOPQTDIR%"
    -"%QTDIR%\bin\qmake.exe" "%TOPQTSRC%" -- %ARGS%
    +if "%CFG_HOST_QT_TOOLS_PATH%" == "" (
    +       "%QTDIR%\bin\qmake.exe" "%TOPQTSRC%" -- %ARGS%
    +) else (
    +       "%CFG_HOST_QT_TOOLS_PATH%\qmake.exe" -qtconf "%QTCONFFILE%" "%TOPQTSRC%" -- %ARGS%
    +)
    diff --git a/qtbase/mkspecs/common/msvc-desktop.conf b/qtbase/mkspecs/common/msvc-desktop.conf
    index f5d12f445..9e4a99e6d 100644
    --- a/qtbase/mkspecs/common/msvc-desktop.conf
    +++ b/qtbase/mkspecs/common/msvc-desktop.conf
    @@ -25,6 +25,10 @@ contains(QMAKE_TARGET.arch, x86_64) {
         DEFINES += WIN64
         QMAKE_COMPILER_DEFINES += _WIN64
     }
    +contains(QMAKE_TARGET.arch, arm64) {
    +    DEFINES += WIN64
    +    QMAKE_COMPILER_DEFINES += _WIN64
    +}
     
     QMAKE_CFLAGS_OPTIMIZE_DEBUG = -Od
     QMAKE_CFLAGS_OPTIMIZE      = -O2
    diff --git a/qtbase/mkspecs/win32-arm64-msvc2019/qmake.conf b/qtbase/mkspecs/win32-arm64-msvc2019/qmake.conf
    new file mode 100644
    index 000000000..63ff0590c
    --- /dev/null
    +++ b/qtbase/mkspecs/win32-arm64-msvc2019/qmake.conf
    @@ -0,0 +1,15 @@
    +#
    +# qmake configuration for win32-arm64-msvc2019
    +#
    +# Written for Microsoft C/C++ Optimizing Compiler targeting arm64.
    +#
    +
    +include(../common/msvc-desktop.conf)
    +
    +WINSDK_VER              = 10.0
    +VCPROJ_ARCH             = ARM64
    +
    +DEFINES += WIN64
    +QMAKE_COMPILER_DEFINES += _WIN64
    +
    +load(qt_config)
    diff --git a/qtbase/mkspecs/win32-arm64-msvc2019/qplatformdefs.h b/qtbase/mkspecs/win32-arm64-msvc2019/qplatformdefs.h
    new file mode 100644
    index 000000000..8a3afa763
    --- /dev/null
    +++ b/qtbase/mkspecs/win32-arm64-msvc2019/qplatformdefs.h
    @@ -0,0 +1,40 @@
    +/****************************************************************************
    +**
    +** Copyright (C) 2016 The Qt Company Ltd.
    +** Contact: https://www.qt.io/licensing/
    +**
    +** This file is part of the qmake spec of the Qt Toolkit.
    +**
    +** $QT_BEGIN_LICENSE:LGPL$
    +** Commercial License Usage
    +** Licensees holding valid commercial Qt licenses may use this file in
    +** accordance with the commercial license agreement provided with the
    +** Software or, alternatively, in accordance with the terms contained in
    +** a written agreement between you and The Qt Company. For licensing terms
    +** and conditions see https://www.qt.io/terms-conditions. For further
    +** information use the contact form at https://www.qt.io/contact-us.
    +**
    +** GNU Lesser General Public License Usage
    +** Alternatively, this file may be used under the terms of the GNU Lesser
    +** General Public License version 3 as published by the Free Software
    +** Foundation and appearing in the file LICENSE.LGPL3 included in the
    +** packaging of this file. Please review the following information to
    +** ensure the GNU Lesser General Public License version 3 requirements
    +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
    +**
    +** GNU General Public License Usage
    +** Alternatively, this file may be used under the terms of the GNU
    +** General Public License version 2.0 or (at your option) the GNU General
    +** Public license version 3 or any later version approved by the KDE Free
    +** Qt Foundation. The licenses are as published by the Free Software
    +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
    +** included in the packaging of this file. Please review the following
    +** information to ensure the GNU General Public License requirements will
    +** be met: https://www.gnu.org/licenses/gpl-2.0.html and
    +** https://www.gnu.org/licenses/gpl-3.0.html.
    +**
    +** $QT_END_LICENSE$
    +**
    +****************************************************************************/
    +
    +#include "../win32-msvc/qplatformdefs.h"
    diff --git a/qtbase/mkspecs/win32-arm64-msvc2022/qmake.conf b/qtbase/mkspecs/win32-arm64-msvc2022/qmake.conf
    new file mode 100644
    index 000000000..63ff0590c
    --- /dev/null
    +++ b/qtbase/mkspecs/win32-arm64-msvc2022/qmake.conf
    @@ -0,0 +1,15 @@
    +#
    +# qmake configuration for win32-arm64-msvc2019
    +#
    +# Written for Microsoft C/C++ Optimizing Compiler targeting arm64.
    +#
    +
    +include(../common/msvc-desktop.conf)
    +
    +WINSDK_VER              = 10.0
    +VCPROJ_ARCH             = ARM64
    +
    +DEFINES += WIN64
    +QMAKE_COMPILER_DEFINES += _WIN64
    +
    +load(qt_config)
    diff --git a/qtbase/mkspecs/win32-arm64-msvc2022/qplatformdefs.h b/qtbase/mkspecs/win32-arm64-msvc2022/qplatformdefs.h
    new file mode 100644
    index 000000000..8a3afa763
    --- /dev/null
    +++ b/qtbase/mkspecs/win32-arm64-msvc2022/qplatformdefs.h
    @@ -0,0 +1,40 @@
    +/****************************************************************************
    +**
    +** Copyright (C) 2016 The Qt Company Ltd.
    +** Contact: https://www.qt.io/licensing/
    +**
    +** This file is part of the qmake spec of the Qt Toolkit.
    +**
    +** $QT_BEGIN_LICENSE:LGPL$
    +** Commercial License Usage
    +** Licensees holding valid commercial Qt licenses may use this file in
    +** accordance with the commercial license agreement provided with the
    +** Software or, alternatively, in accordance with the terms contained in
    +** a written agreement between you and The Qt Company. For licensing terms
    +** and conditions see https://www.qt.io/terms-conditions. For further
    +** information use the contact form at https://www.qt.io/contact-us.
    +**
    +** GNU Lesser General Public License Usage
    +** Alternatively, this file may be used under the terms of the GNU Lesser
    +** General Public License version 3 as published by the Free Software
    +** Foundation and appearing in the file LICENSE.LGPL3 included in the
    +** packaging of this file. Please review the following information to
    +** ensure the GNU Lesser General Public License version 3 requirements
    +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
    +**
    +** GNU General Public License Usage
    +** Alternatively, this file may be used under the terms of the GNU
    +** General Public License version 2.0 or (at your option) the GNU General
    +** Public license version 3 or any later version approved by the KDE Free
    +** Qt Foundation. The licenses are as published by the Free Software
    +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
    +** included in the packaging of this file. Please review the following
    +** information to ensure the GNU General Public License requirements will
    +** be met: https://www.gnu.org/licenses/gpl-2.0.html and
    +** https://www.gnu.org/licenses/gpl-3.0.html.
    +**
    +** $QT_END_LICENSE$
    +**
    +****************************************************************************/
    +
    +#include "../win32-msvc/qplatformdefs.h"
    diff --git a/qtxmlpatterns/src/xmlpatterns/xmlpatterns.pro b/qtxmlpatterns/src/xmlpatterns/xmlpatterns.pro
    index eae2ea8a1..994712286 100644
    --- a/qtxmlpatterns/src/xmlpatterns/xmlpatterns.pro
    +++ b/qtxmlpatterns/src/xmlpatterns/xmlpatterns.pro
    @@ -3,7 +3,7 @@ CONFIG += exceptions
     QT = core-private network
     
     DEFINES += QT_NO_USING_NAMESPACE QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST
    -win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x61000000
    +msvc:equals(QT_ARCH, i386):QMAKE_LFLAGS += /BASE:0x61000000
     
     QMAKE_DOCS = $$PWD/doc/qtxmlpatterns.qdocconf
     
    
    

    I have this crash when the QGuiApplication object is getting initialized under Windows, ARM64, using Visual Studio 2022.

    Do you have any advice on how this could be fixed?

    desc 1
    desc 2
    desc 3
    desc 4
    desc 5
    desc 6

    1 Reply Last reply
    0
    • J Offline
      J Offline
      just_a_developer
      wrote on last edited by just_a_developer
      #3

      In the end I turned to using Qt 6.3.1 instead, which solved this crash for Windows ARM64.
      I didn't turn to using Clang. I am still using MSVC.

      (Thanks god I am using CMake + Conan so I have the ability to easily use different Qt version for
      Windows(10-11) Arm64 (which restricts me to Qt6)
      and
      Windows(7-8-10-11) x86/x64. (which restricts me to Qt5 - in Qt6 the x86 and the Win7 support have been dropped)
      )

      1 Reply Last reply
      1
      • cristian-adamC Online
        cristian-adamC Online
        cristian-adam
        wrote on last edited by
        #2

        Arm64 using MSVC is a bit experimental and Qt applications are known to crash due to the compiler being broken, see QTBUG-101473.

        MSVC 2019 has got a fix and might work. MSVC 2022 should be also fixed, but I have had issues with it and a static build of Qt.

        I've overcome the problems by using LLVM's clang-cl. https://github.com/llvm/llvm-project/releases

        I've build Qt Creator 8, Qt 6.3.1, with clang-cl 14 for Arm64.

        1 Reply Last reply
        2
        • J Offline
          J Offline
          just_a_developer
          wrote on last edited by just_a_developer
          #3

          In the end I turned to using Qt 6.3.1 instead, which solved this crash for Windows ARM64.
          I didn't turn to using Clang. I am still using MSVC.

          (Thanks god I am using CMake + Conan so I have the ability to easily use different Qt version for
          Windows(10-11) Arm64 (which restricts me to Qt6)
          and
          Windows(7-8-10-11) x86/x64. (which restricts me to Qt5 - in Qt6 the x86 and the Win7 support have been dropped)
          )

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved