Building for Windows Intel on ARM hardware: crash on run (mfc140ud)
-
Using
Qt6.8.0-beta1
(with VS2022), i am building and debugging an Intel target on my ARM device (running Windows 11). UsingQt6.7.x
(With VS2019), this was no issue: I could build, debug, and deploy release versions, without any problem. However, with Qt6.8, attempting to run, i get this:with the call stack simply showing this:
now, a gracious guru @hskoglund has kindly responded (on a thread with the wrong topic) that0xC000026f
is likely due to mixing ARM and Intel libraries:Hi, 0xc000026f usually means one or more of the dlls your Intel x64 app tries to load is for the ARM architecture (or the other way around), so maybe check what flavor of mfc140ud your path is set for.
Other than only installing the
(x86 and x64)
versions ofmfc140
when running the VS Installer (and NOT installing(ARM)
versions), how do i determine if the flavor ofmfc140ud
is in fact correct? get info on the lib doesn't tell me if the binary is ARM vs Intel.On mac (building on an ARM computer) i can specify in the QMake panel which "ABIs" i want: x86 and/or ARM. But on windows, there is no such UI switch. i'm not sure where else to look, or how to determine which is being selected when linking / deploying?
-
oh wow! the solution was to manually stage
mfc140u(d).dll
when executing the deploy phase. I did that and bingo, it all works. Huh. i guess this is a new requirement with VS2022. -
Check your Qt 6.8 Kit for the right compilers. On an Arm64 you would want to use the
arm64_amd64
cross-compiler, so that you won't go through the emulation.You can then on your Project right click and open Open Command Prompt With > Build Environment.
In the environment you can do a:
$ set | findstr LIB LIB=C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.40.33807\ATLMFC\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.40.33807\lib\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64
This way you could figure out if the correct
LIB
environment variable is being used.Lastly you can open the
Makefile
and look into it, to see what's going on. Who is linking to what. -
These are the available compilers:
This is what i see when i do the command you suggested (separated by lines for easier reading):
Z:\depot\kJams\Development\qt\kJams>set | findstr LIB LIB= C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\ATLMFC\lib\x64; C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\lib\x64; C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64; C:\Program Files (x86)\Windows Kits\10\lib\10.0.26100.0\ucrt\x64; C:\Program Files (x86)\Windows Kits\10\\lib\10.0.26100.0\\um\x64 LIBPATH= C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\ATLMFC\lib\x64; C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\lib\x64; C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\lib\x86\store\references; C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.26100.0; C:\Program Files (x86)\Windows Kits\10\References\10.0.26100.0; C:\Windows\Microsoft.NET\Framework64\v4.0.30319
When you say
MakeFile
, do you mean.qmake.stash
? If so, this is the contents:QMAKE_CXX.QT_COMPILER_STDCXX = 199711L QMAKE_CXX.QMAKE_MSC_VER = 1940 QMAKE_CXX.QMAKE_MSC_FULL_VER = 194033811 QMAKE_CXX.COMPILER_MACROS = \ QT_COMPILER_STDCXX \ QMAKE_MSC_VER \ QMAKE_MSC_FULL_VER QMAKE_CXX.INCDIRS = \ "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.40.33807\\include" \ "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.40.33807\\ATLMFC\\include" \ "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\VS\\include" \ "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.26100.0\\ucrt" \ "C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.26100.0\\\\um" \ "C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.26100.0\\\\shared" \ "C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.26100.0\\\\winrt" \ "C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.26100.0\\\\cppwinrt" \ "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\include\\um" QMAKE_CXX.LIBDIRS = \ "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.40.33807\\ATLMFC\\lib\\x64" \ "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.40.33807\\lib\\x64" \ "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\lib\\um\\x64" \ "C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.26100.0\\ucrt\\x64" \ "C:\\Program Files (x86)\\Windows Kits\\10\\\\lib\\10.0.26100.0\\\\um\\x64"
I have ensured that my packaging scripts use the correct SDK version
10.0.26100.0
, and the correct MSVC version:14.40.33807
, yet i still get the same issue. can you glean anything from the above information? -
@davecotter I see you have selected
amd64
, not arm? I -
thanks @artwaw, above, @cristian-adam suggested that i should use use the
arm64_amd64
compiler, however, i do not see that in my list of choices?my apologies if i'm missing something that seems obvious to you, please forgive me, and can you just point it out? thanks so much for your time and attention.
-
Your environment looks correct.
LIB
has:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\ATLMFC\lib\x64
I would suggest renaming the
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\ATLMFC\lib\arm64
directory to something else, and see who will then complain that the library is not found for linking. -
Regarding the native
arm64
compilers, I would suggest you to have them installed (including ninja and CMake) so that you have the best compilation times on the Arm64 machine.You need to open Visual Studio Installer, then click on Modify for your installation and then click on the Individiual Components and there type
arm64
. -
@cristian-adam said in Building for Windows Intel on ARM hardware: crash on run (mfc140ud):
I would suggest renaming the
...\arm64
directoryI have done this (named it
x arm64
), but it behaves exactly the same. it compiles, links, deploys, launches, crashes in the same spot.@cristian-adam said in Building for Windows Intel on ARM hardware: crash on run (mfc140ud):
I would suggest you to have [native arm64 compliers] installed
i typed
arm64
into the search box under "individual components", but i've no idea which thing to install. What we want is a cross compiler, right? one that is ARM native yet emits intel instructions, right? so which one do i pick?You also suggest:
including ninja and CMake
but don't they auto-install when i run
QT Maintenance Tool
? -
have done this (named it x arm64), but it behaves exactly the same. it compiles, links, deploys, launches, crashes in the same spot.
You'll have to see where the
mfc140ud.dll
is being loaded. You can manually copy it from"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.40.33807\debug_nonredist\x64\Microsoft.VC143.DebugMFC\mfc140ud.dll"
to your build directory and see if it loads. -
oh wow! the solution was to manually stage
mfc140u(d).dll
when executing the deploy phase. I did that and bingo, it all works. Huh. i guess this is a new requirement with VS2022. -
-
This post is deleted!