Skip to content

MSVC compiler error when building for ARM64 with Visual Studio 2022 #1156

Closed
@abdes

Description

Operating system and version

Windows 11, Version 21H2 (OS Build 22000.978)

Compiler

Visual Studio 2022
Microsoft (R) C/C++ Optimizing Compiler Version 19.33.31630 for x64

Crypto++ library

v8.7.0

How you built the library

CMake (https://github.com/abdes/cryptopp-cmake)

Please note that the base cryptopp project provided .sln file does not have the option to cross-build for ARM64 on WIN32 using MSVC.

Make sure you have installed the ARM and ARM64 build tools for Visual Studio.

git clone https://github.com/abdes/cryptopp-cmake
cd cryptopp-cmake
mkdir cmake-build-arm64
cd cmake-build-arm64
cmake -G "Visual Studio 17 2022" -A ARM64 ..
cmake --build .

Compiler output

MSBuild version 17.3.1+2badb37d1 for .NET Framework
  crc_simd.cpp
D:\dev\projects\cryptopp-cmake\cmake-build-arm64\_deps\cryptopp\arm_simd.h(323,1): error C2057: expected constant expression (compiling source file D:\dev\projects\cryptopp-cmake\cmak
e-build-arm64\_deps\cryptopp\crc_simd.cpp) [D:\dev\projects\cryptopp-cmake\cmake-build-arm64\cryptopp\cryptopp.vcxproj]
  gcm_simd.cpp
D:\dev\projects\cryptopp-cmake\cmake-build-arm64\_deps\cryptopp\arm_simd.h(323,1): error C2057: expected constant expression (compiling source file D:\dev\projects\cryptopp-cmake\cmak
e-build-arm64\_deps\cryptopp\gcm_simd.cpp) [D:\dev\projects\cryptopp-cmake\cmake-build-arm64\cryptopp\cryptopp.vcxproj]
  gf2n_simd.cpp
D:\dev\projects\cryptopp-cmake\cmake-build-arm64\_deps\cryptopp\arm_simd.h(323,1): error C2057: expected constant expression (compiling source file D:\dev\projects\cryptopp-cmake\cmak
e-build-arm64\_deps\cryptopp\gf2n_simd.cpp) [D:\dev\projects\cryptopp-cmake\cmake-build-arm64\cryptopp\cryptopp.vcxproj]

To do the same for ARM32, just change the commands to:

mkdir cmake-build-arm32
cd cmake-build-arm32
cmake -G "Visual Studio 17 2022" -A ARM ..
cmake --build .

Clearly state the undesired behavior (and state the expected behavior)

The same build for ARM32 does not generate errors but for ARM64 it does.
Expected: both work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions