noloader / cryptopp-cmake

CMake files for Crypto++ project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Apple Silicon support - cryptest-cmake.sh fails

TheSlowGrowth opened this issue · comments

  • cmake v3.19.1
  • Xcode 12.2, macOS Big Sur
  • Apple M1 arm64
  • cryptopp commit 49157a3 (current master)
  • cryptopp-cmake commit 33e33e9 (current master)

cryptest-cmake.sh fails compiling Crypto++/crc_simd.cpp

error: use of undeclared identifier '__crc32b'
error: use of undeclared identifier '__crc32w'
error: use of undeclared identifier '__crc32cb'
error: use of undeclared identifier '__crc32cw'

Not sure what to check, tbh. Suspecting a configuration error, so I'm asking here.
Any hints would be much appreciated!

After further investigation it seems like this should actually be solved in Crypto++ not in the cmake integration. Disabling all intrinsics with CRYPTOPP_DISABLE_ASM makes the error go away.

Thanks @TheSlowGrowth.

error: use of undeclared identifier '__crc32b' ...

It looks like the Cmake files are getting into the x86 code paths.

I'm not sure how to fix it. I don't have access to the environment. I planned on waiting until I found an used M1 machine.

I suspect the problem is in CmakeFileList.txt : 298 (modulo Clang):

# Thanks to Anonimal for MinGW; see http://github.com/weidai11/cryptopp/issues/466
DumpMachine(CRYPTOPP_AMD64 "(x86_64)|(AMD64|amd64)")
DumpMachine(CRYPTOPP_I386 "^i.86$")
DumpMachine(CRYPTOPP_MINGW32 "^mingw32")
DumpMachine(CRYPTOPP_MINGW64 "(w64-mingw32)|(mingw64)")
DumpMachine(CRYPTOPP_X32 "(x32)")
DumpMachine(CRYPTOPP_AARCH32 "^aarch32")
DumpMachine(CRYPTOPP_AARCH64 "^aarch64")
DumpMachine(CRYPTOPP_ARMHF "(armhf)|(arm7l)|(eabihf)")
DumpMachine(CRYPTOPP_ARM "^arm")

Clang factors into the equation because the compiler does not identify itself properly. I seem to recall clang -dumpmachine lies to us. This is a recurring problem with Apple and Clang.

@TheSlowGrowth,

I bought an Apple M1. I be testing/fixing this shortly.

We already fixed the makefiles.

It looks like we have cleared this issue already.

If possible, use Crypto++ 8.5 or Master. Master is stable.