cryptopp
cryptopp copied to clipboard
Compilation fails using MSYS2 CLANGARM64 toolchain
Operating System: Windows 11 (ARM64)
Crypto++ Version: 8.9
Toolchain: MSYS2 CLANGARM64
Summary:
When compiling with MSYS2 CLANGARM64, there are a number of compiler errors unless ASM is disabled. For example:
[278/2185] Building CXX object externals/cryptopp-cmake/cryptopp/CMakeFiles/cryptopp.dir/__/__/cryptopp/rijndael_simd.cpp.obj
FAILED: externals/cryptopp-cmake/cryptopp/CMakeFiles/cryptopp.dir/__/__/cryptopp/rijndael_simd.cpp.obj
C:\msys64\clangarm64\bin\c++.exe -DBOOST_ASIO_DISABLE_CONCEPTS -DBOOST_DATE_TIME_NO_LIB -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_REGEX_NO_LIB -DBOOST_SYSTEM_NO_LIB -DCRYPTOPP_ARM_ACLE_HEADER=1 -DCRYPTOPP_ARM_NEON_HEADER=1 -DCRYPTOPP_DISABLE_ARM_CRC32=1 -DCRYPTOPP_DISABLE_ARM_PMULL=1 -Iexternals/cryptopp -Iexternals -O3 -DNDEBUG -std=gnu++20 -fvisibility=default -w -march=armv8-a+crypto -MD -MT externals/cryptopp-cmake/cryptopp/CMakeFiles/cryptopp.dir/__/__/cryptopp/rijndael_simd.cpp.obj -MF externals\cryptopp-cmake\cryptopp\CMakeFiles\cryptopp.dir\__\__\cryptopp\rijndael_simd.cpp.obj.d -o externals/cryptopp-cmake/cryptopp/CMakeFiles/cryptopp.dir/__/__/cryptopp/rijndael_simd.cpp.obj -c externals/cryptopp/rijndael_simd.cpp
externals/cryptopp/rijndael_simd.cpp:117:14: error: unknown type name 'sigset_t'
117 | volatile sigset_t oldMask;
| ^
externals/cryptopp/rijndael_simd.cpp:118:34: error: use of undeclared identifier 'sigset_t'
118 | if (sigprocmask(0, NULLPTR, (sigset_t*)&oldMask))
| ^
externals/cryptopp/rijndael_simd.cpp:118:43: error: expected expression
118 | if (sigprocmask(0, NULLPTR, (sigset_t*)&oldMask))
| ^
externals/cryptopp/rijndael_simd.cpp:138:31: error: use of undeclared identifier 'sigset_t'
138 | sigprocmask(SIG_SETMASK, (sigset_t*)&oldMask, NULLPTR);
| ^
externals/cryptopp/rijndael_simd.cpp:138:40: error: expected expression
138 | sigprocmask(SIG_SETMASK, (sigset_t*)&oldMask, NULLPTR);
| ^
externals/cryptopp/rijndael_simd.cpp:138:17: error: use of undeclared identifier 'SIG_SETMASK'
138 | sigprocmask(SIG_SETMASK, (sigset_t*)&oldMask, NULLPTR);
| ^
6 errors generated.
[287/2185] Building CXX object externals/cryptopp-cmake/cryptopp/CMakeFiles/cryptopp.dir/__/__/cryptopp/scrypt.cpp.obj
ninja: build stopped: subcommand failed.
(Yes, this is with cryptopp-cmake, but this seems to be an upstream cryptopp issue.)
It seems that the ARM implementation has two paths: one with Microsoft-style inline assembly and one without. However, the path without seems to assume it's not being compiled for Windows, meaning if you use Windows with a non-MSVC compiler it will fail.