c++qt

Issue with building Qt 5.15.16 for WinRT arm


I am trying to build Qt 5.15.16 for WinRT arm - winrt-arm-msvc2019. According to this documentation: https://wiki.qt.io/WinRTBuild

From docs:

No matter what your target (PC, Surface, Phone, etc.), ALWAYS USE the "x86 Native tools command prompt". This is because the command prompt will first build host tools (qmake, moc, rcc, etc.) and then cross-compile the Qt libraries. Do not open the Windows Phone command prompt, for instance, as it will not be able to build the host tools.

So, I tried the x86 Native Tools Command Prompt for VS 2019 to build: winrt-arm-msvc2019

Configure command:

configure.bat -top-level -debug-and-release -xplatform "winrt-arm-msvc2019" -confirm-license -mp -c+std c+17 -opensource -nomake examples -no-ltcg -skip qtwebengine -prefix "C:\Qt\5.15.16\winrt_armv7_msvc2019"

I get the following issue:

...
cl -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch -c -Fo./ -Fdqmake.pdb  -W2 -nologo -O2  /MP /wd4577   -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\qmake -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\qmake\library -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\qmake\generators -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\qmake\generators\unix -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\qmake\generators\win32 -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\qmake\generators\mac  -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase/src/3rdparty/tinycbor/src  -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase/include -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase/include\QtCore -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase/include\QtCore\5.15.16 -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase/include\QtCore\5.15.16\QtCore  -I..\src\corelib\global  -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\mkspecs\win32-msvc   -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS  -DQT_VERSION_STR=\"5.15.16\" -DQT_VERSION_MAJOR=5 -DQT_VERSION_MINOR=15 -DQT_VERSION_PATCH=16  -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL  -DQT_NO_FOREACH -DUNICODE -D_ENABLE_EXTENDED_ALIGNED_STORAGE  C:\QtBuild\qt-everywhere-src-5.15.16\qtbase\src\corelib\serialization\qjsonvalue.cpp
qjsonvalue.cpp
        cl -c -Fo./ -Fdqmake.pdb  -W2 -nologo -O2  /MP /wd4577   -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\qmake -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\qmake\library -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\qmake\generators -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\qmake\generators\unix -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\qmake\generators\win32 -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\qmake\generators\mac  -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase/src/3rdparty/tinycbor/src  -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase/include -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase/include\QtCore -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase/include\QtCore\5.15.16 -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase/include\QtCore\5.15.16\QtCore  -I..\src\corelib\global  -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\mkspecs\win32-msvc   -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS  -DQT_VERSION_STR=\"5.15.16\" -DQT_VERSION_MAJOR=5 -DQT_VERSION_MINOR=15 -DQT_VERSION_PATCH=16  -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL  -DQT_NO_FOREACH -DUNICODE -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DQT_BUILD_QMAKE_BOOTSTRAP C:\QtBuild\qt-everywhere-src-5.15.16\qtbase\src\corelib\global\qlibraryinfo.cpp
qlibraryinfo.cpp
        link  /OUT:..\bin\qmake.exe project.obj main.obj ioutils.obj proitems.obj qmakevfs.obj  qmakeglobals.obj qmakeparser.obj qmakeevaluator.obj qmakebuiltins.obj  makefile.obj unixmake.obj unixmake2.obj mingw_make.obj  option.obj winmakefile.obj projectgenerator.obj property.obj meta.obj  makefiledeps.obj metamakefile.obj xmloutput.obj  msvc_nmake.obj msvc_vcproj.obj msvc_vcxproj.obj  msvc_objectmodel.obj msbuild_objectmodel.obj registry.obj qbitarray.obj  qbuffer.obj  qcryptographichash.obj  qfilesystementry.obj  qfilesystemengine.obj  qfilesystemengine_win.obj  qfilesystemiterator_win.obj  qfsfileengine.obj  qfsfileengine_iterator.obj  qarraydata.obj  qbytearray.obj  qbytearraylist.obj  qvsnprintf.obj  qbytearraymatcher.obj  qcalendar.obj  qdatetime.obj  qdir.obj  qdiriterator.obj  qfiledevice.obj  qfile.obj  qtemporaryfile.obj  qabstractfileengine.obj  qfsfileengine_win.obj  qsystemlibrary.obj  qfileinfo.obj  qendian.obj  qglobal.obj  qgregoriancalendar.obj  qhash.obj  qiodevice.obj  qringbuffer.obj  qdebug.obj  qlist.obj  qlocale.obj  qlocale_tools.obj  qlocale_win.obj  qversionnumber.obj  qmalloc.obj  qmap.obj  qoperatingsystemversion.obj  qoperatingsystemversion_win.obj  qregexp.obj  qromancalendar.obj  qutfcodec.obj  qstring.obj  qstringlist.obj  qstringbuilder.obj  qsystemerror.obj  qtextstream.obj  qdatastream.obj  quuid.obj  qrandom.obj  qsettings.obj  qvariant.obj  qsettings_win.obj  qmetatype.obj  qxmlstream.obj  qxmlutils.obj  qnumeric.obj  qlogging.obj  qcborstreamwriter.obj  qcborvalue.obj  qjsoncbor.obj  qjsondocument.obj  qjsonparser.obj  qjsonarray.obj  qjsonobject.obj  qjsonvalue.obj qlibraryinfo.obj qmake_pch.obj ole32.lib advapi32.lib shell32.lib netapi32.lib
Microsoft (R) Incremental Linker Version 14.29.30157.0
Copyright (C) Microsoft Corporation.  All rights reserved.
Info: creating super cache file C:\QtBuild\qt-everywhere-src-5.15.16\qtBuild\.qmake.super
Info: creating cache file C:\QtBuild\qt-everywhere-src-5.15.16\qtBuild\.qmake.cache
Info: creating stash file C:\QtBuild\qt-everywhere-src-5.15.16\qtBuild\.qmake.stash
This is the Qt Open Source Edition.
You have already accepted the terms of the Open Source license.
Running configuration tests...
Checking for valid makespec... ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.
Check config.log for details.
C:\QtBuild\qt-everywhere-src-5.15.16\qtBuild> 

Config.log:

Command line: -debug-and-release -xplatform winrt-arm-msvc2019 -confirm-license -mp -c++std c++17 -opensource -nomake examples -no-ltcg -skip qtwebengine -prefix C:\Qt\5.15.16\winrt_armv7_msvc2019
executing config test verifyspec
+ cd /d C:\QtBuild\qt-everywhere-src-5.15.16\qtBuild\config.tests\verifyspec && C:\QtBuild\qt-everywhere-src-5.15.16\qtBuild\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch"  "QMAKE_LFLAGS += /ENTRY:main" -early "CONFIG += cross_compile" C:/QtBuild/qt-everywhere-src-5.15.16/qtbase/config.tests/verifyspec
+ cd /d C:\QtBuild\qt-everywhere-src-5.15.16\qtBuild\config.tests\verifyspec && set MAKEFLAGS=& jom
> jom 1.1.4 - empower your cores
>     cl -c -nologo -FS -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W0 -GR -EHsc -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQ_BYTE_ORDER=Q_LITTLE_ENDIAN -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP -DWINAPI_PARTITION_PHONE_APP=1 -DARM -D__ARM__ -D__arm__ -DNDEBUG -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\config.tests\verifyspec -I. -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\mkspecs\winrt-arm-msvc2019 -Fo @C:\Users\cobra\AppData\Local\Temp\verifyspec.obj.34368.0.jom
> verifyspec.cpp
>     link /NOLOGO /DYNAMICBASE /NXCOMPAT /NODEFAULTLIB:ole32.lib /APPCONTAINER /MACHINE:ARM /NODEFAULTLIB:kernel32.lib /ENTRY:main /INCREMENTAL:NO /SUBSYSTEM:WINDOWS /MANIFEST:NO /OUT:verifyspec.exe @C:\Users\cobra\AppData\Local\Temp\verifyspec.exe.34368.31.jom
> verifyspec.obj : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'ARM'
> jom: C:\QtBuild\qt-everywhere-src-5.15.16\qtBuild\config.tests\verifyspec\Makefile [verifyspec.exe] Error 1112

Any ideas how to fix this issue?


Solution

  • I removed the jom from PATH environment variable to use nmake to get the proper error message. I get the following issue:

    Running configuration tests...
    Checking for valid makespec...
    + cd /d C:\QtBuild\qt-everywhere-src-5.15.16\qtBuild\config.tests\verifyspec && C:\QtBuild\qt-everywhere-src-5.15.16\qtBuild\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch"  "QMAKE_LFLAGS += /ENTRY:main" -early "CONFIG += cross_compile" C:/QtBuild/qt-everywhere-src-5.15.16/qtbase/config.tests/verifyspec
    + cd /d C:\QtBuild\qt-everywhere-src-5.15.16\qtBuild\config.tests\verifyspec && set MAKEFLAGS=& nmake
    > Microsoft (R) Program Maintenance Utility Version 14.29.30158.0
    > Copyright (C) Microsoft Corporation.  All rights reserved.
    >       cl -c -nologo -FS -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W0 -GR -EHsc -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQ_BYTE_ORDER=Q_LITTLE_ENDIAN -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP -DWINAPI_PARTITION_PHONE_APP=1 -DARM -D__ARM__ -D__arm__ -DNDEBUG -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\config.tests\verifyspec -I. -IC:\QtBuild\qt-everywhere-src-5.15.16\qtbase\mkspecs\winrt-arm-msvc2019 -Fo @C:\Users\cobra\AppData\Local\Temp\nm3D22.tmp
    > verifyspec.cpp
    >       link /NOLOGO /DYNAMICBASE /NXCOMPAT /NODEFAULTLIB:ole32.lib /APPCONTAINER /MACHINE:ARM /NODEFAULTLIB:kernel32.lib /ENTRY:main /INCREMENTAL:NO /SUBSYSTEM:WINDOWS /MANIFEST:NO /OUT:verifyspec.exe @C:\Users\cobra\AppData\Local\Temp\nm3D71.tmp
    > LINK : fatal error LNK1181: cannot open input file 'ucrt.lib'
    > NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX86\ARM\link.EXE"' : return code '0x49d'
    > Stop.
    ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.
    C:\QtBuild\qt-everywhere-src-5.15.16\qtBuild>
    

    The problem was with > LINK : fatal error LNK1181: cannot open input file 'ucrt.lib'.

    I found out that this issue is causing the latest Windows SDK - 10.0.26100.0: https://discussions.unity.com/t/info-link-fatal-error-lnk1181-cannot-open-input-file-ucrt-lib-hololens-2-build-issue/950584/3

    So, I used the following Windows SDK: 10.0.22621.0 and run: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat" 10.0.22621.0

    Now, it completed the configuration and I successfully built Qt 5.15.16 for winrt-arm-msvc2019 architecture. This issue is resolved. Thanks.