ARM64 build error after VS update
I updated VS 2022 from version 17.11.3 to 17.12.3. Now I cannot compile a C++ DLL for ARM64 for a UWP app which is already in Store anymore. I get the following output:
1>------ Rebuild All started: Project: FontAccess, Configuration: Release ARM64 ------
1>pch.cpp
1>(compiling source file 'pch.cpp')
1>DWriteFonts.cpp
1>(compiling source file 'DWriteFonts.cpp')
1>ARM64\Release\DWriteFonts.obj : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'ARM64'
1>Done building project "FontAccess.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
The OS is Windows 11 Pro x64.
What can I do? Do I have to install new components in VS Installer? I tried something, but it didn't help.
Visual Studio
Visual Studio Setup
-
David Lowndes 2,565 Reputation points • MVP
2024-12-14T23:45:11.24+00:00 From the error message it appears that your ARM64\Release\DWriteFonts.obj is an x86 build rather than ARM64. Have you accidentally changed some project setting since your previous successful build?
-
Heiko 1,286 Reputation points
2024-12-15T12:52:15.64+00:00 No, I have not changed anything for weeks in 2 C++ DLL projects in 2 different solutions. I have deleted all obj files and other generated files and compiled them again. The sln file has not been changed for a year. In the output of the compiler you can see that all cpp files are compiled for arm64.
Excerpt from the sln file:
{11E6E36B-225E-4A54-AE19-89D048830C90}.Release|Any CPU.ActiveCfg = Release|Win32
{11E6E36B-225E-4A54-AE19-89D048830C90}.Release|ARM.ActiveCfg = Release|ARM
{11E6E36B-225E-4A54-AE19-89D048830C90}.Release|ARM.Build.0 = Release|ARM
{11E6E36B-225E-4A54-AE19-89D048830C90}.Release|ARM64.ActiveCfg = Release|ARM64
{11E6E36B-225E-4A54-AE19-89D048830C90}.Release|ARM64.Build.0 = Release|ARM64
{11E6E36B-225E-4A54-AE19-89D048830C90}.Release|x64.ActiveCfg = Release|x64
{11E6E36B-225E-4A54-AE19-89D048830C90}.Release|x64.Build.0 = Release|x64
{11E6E36B-225E-4A54-AE19-89D048830C90}.Release|x86.ActiveCfg = Release|Win32
{11E6E36B-225E-4A54-AE19-89D048830C90}.Release|x86.Build.0 = Release|Win32Compiler output of another DLL project in a different solution:
1>------ Rebuild All started: Project: NativeHelpers, Configuration: Release ARM64 ------
1>pch.cpp
1>AssemblyInfo.cpp
1>PerMonitorDPIHelpers.cpp
1>PerMonitorDPIWindow.cpp
1>.NETFramework,Version=v4.8.AssemblyAttributes.cpp
1>Generating Code...
1>ARM64\Release\AssemblyInfo.obj : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'ARM64'
1>Done building project "NativeHelpers.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
========== Rebuild completed at 13:42 and took 08,084 seconds ========== -
David Lowndes 2,565 Reputation points • MVP
2024-12-15T13:51:10.93+00:00 Try running:
dumpbin /headers on your .obj file and see what it says the machine type is. -
Heiko 1,286 Reputation points
2024-12-15T15:32:54.5466667+00:00 **********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.12.3
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
C:\Program Files\Microsoft Visual Studio\2022\Community>d:
D:\>cd d:\VS Community 2022\MyProjects\UWP_MyApp_DWrite\FontAccess\ARM64\Release\
d:\VS Community 2022\MyProjects\UWP_MyApp_DWrite\FontAccess\ARM64\Release>dumpbin DWriteFonts.obj /headers
Microsoft (R) COFF/PE Dumper Version 14.38.33143.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file DWriteFonts.obj
File Type: ANONYMOUS OBJECT
ANON OBJECT HEADER VALUES
2 version
14C machine (x86)
675ECC1C time date stamp Sun Dec 15 13:31:24 2024
ClassID: {0CB3FE38-D9A5-4DAB-AC9B-D6B6222653C2}
3E2F48 size
8 flags
d:\VS Community 2022\MyProjects\UWP_MyApp_DWrite\FontAccess\ARM64\Release>
-
David Lowndes 2,565 Reputation points • MVP
2024-12-15T16:26:12.7566667+00:00 You've got a 32-bit x86 version there.
An ARM64 obj file should produce:AA64 machine (ARM64)
-
Heiko 1,286 Reputation points
2024-12-15T16:34:05.8633333+00:00 That's exactly the problem! Why does VS create an x86 file if it is supposed to compile for ARM64?
-
Heiko 1,286 Reputation points
2024-12-15T16:34:17.3033333+00:00 That's exactly the problem! Why does VS create an x86 file if it is supposed to compile for ARM64?
-
David Lowndes 2,565 Reputation points • MVP
2024-12-15T20:12:36.2733333+00:00 Have you got the ARM64 build tools installed?
In your VS project properties, see what the $(ClCompilerPath) shows up for when you have your build platform set for x86, x64, and ARM64. For example:
-
David Lowndes 2,565 Reputation points • MVP
2024-12-15T20:15:44.1466667+00:00 It might be quicker to check these settings change appropriately for your chosen platform:
-
Heiko 1,286 Reputation points
2024-12-16T12:40:27.5666667+00:00 I do not compile for Win32, but only for x64 Debug and arm64 Release.
-
David Lowndes 2,565 Reputation points • MVP
2024-12-16T12:49:31.44+00:00 I can't see anything wrong, so I'm at a loss to explain what's happening for you.
Try compiling just one source file in the ARM64 build and then use dumpbin to verify the .obj file is ARM64 (or not). If it produces an ARM64 obj file, then do a rebuild of the project and see if it then magically changes to x86 or if it builds OK.
Create a simple console project with an ARM64 configuration and see if that has the same issue. -
Heiko 1,286 Reputation points
2024-12-16T13:25:43.5966667+00:00 I think I found the problem. The compiler path for arm64 doesn't exist for version 14.38.33130.
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\bin\HostX86\arm64\cl.exe
Instead I have the existing path
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\bin\Hostx86\arm64\
In that folder I have all the tools including cl.exe.
In the pictures you can see that I still have many macros for version 14.38.33130 for arm64, whose directory no longer exists.
So the VS Installer didn't update all macros from the old version 14.38.33130 to the new version 14.42.34433, but only a few for the newer version. Any idea what I can do?
-
David Lowndes 2,565 Reputation points • MVP
2024-12-16T13:34:42.4533333+00:00 Maybe try removing the components from the install, then re-add them?
-
Heiko 1,286 Reputation points
2024-12-19T18:50:43.3933333+00:00 Thank you for your support. Unfortunately, uninstalling and reinstalling VS components for arm64 did not work. I have uninstalled and reinstalled VS 2022 and VS Installer. Now it works again.
-
Heiko 1,286 Reputation points
2024-12-19T18:52:47.6+00:00 Thank you for your support. Unfortunately, uninstalling and reinstalling VS components for arm64 did not work. I have uninstalled and reinstalled VS 2022 and VS Installer. Now it works again.
Sign in to comment