abdes/cryptopp-cmake

Problem with building for Android armv7-a

botanegg opened this issue · 0 comments

Hi everyone
I used 15798ac of cryptopp-cmake with cryptopp v8.7.0

-- [cryptopp] CMake version 3.22.1-g37088a8
-- [cryptopp] System Android
-- [cryptopp] Processor armv7-a
-- [cryptopp] CMAKE_HOST_SYSTEM_PROCESSOR : x86_64
-- [cryptopp]      CMAKE_SYSTEM_PROCESSOR : armv7-a
-- [cryptopp] Target architecture detected as: arm -> CRYPTOPP_ARM32
-- [cryptopp] Performing Test CRYPTOPP_ARM_NEON_HEADER
-- [cryptopp] Performing Test CRYPTOPP_ARM_NEON_HEADER - Success
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_NEON
-- [cryptopp] Performing Test CRYPTOPP_HAVE_ARM_NEON - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- [cryptopp] Platform: ARM-32
-- [cryptopp] NEON: TRUE
-- [cryptopp] Compiler definitions:  CRYPTOPP_DATA_DIR="<PATH>/cryptopp";CRYPTOPP_ARM_NEON_HEADER=1
-- [cryptopp] Compiler options: -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security    
-- [cryptopp] Build type: RelWithDebInfo

And after thousands of lines

  ld: error: undefined symbol: cryptogams_AES_set_encrypt_key
  >>> referenced by rijndael.cpp:351 (<PATH>/cryptopp/rijndael.cpp:351)
  >>>               rijndael.cpp.o:(CryptoPP::Rijndael::Base::UncheckedSetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_AES_set_decrypt_key
  >>> referenced by rijndael.cpp:355 (<PATH>/cryptopp/rijndael.cpp:355)
  >>>               rijndael.cpp.o:(CryptoPP::Rijndael::Base::UncheckedSetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_AES_encrypt_block
  >>> referenced by rijndael.cpp:359 (<PATH>/cryptopp/rijndael.cpp:359)
  >>>               rijndael.cpp.o:(CryptoPP::Rijndael::Enc::ProcessAndXorBlock(unsigned char const*, unsigned char const*, unsigned char*) const) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_sha1_block_data_order_neon
  >>> referenced by sha.cpp:352 (<PATH>/cryptopp/sha.cpp:352)
  >>>               sha.cpp.o:(CryptoPP::SHA1::HashMultipleBlocks(unsigned int const*, unsigned int)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_sha1_block_data_order
  >>> referenced by sha.cpp:359 (<PATH>/cryptopp/sha.cpp:359)
  >>>               sha.cpp.o:(CryptoPP::SHA1::HashMultipleBlocks(unsigned int const*, unsigned int)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_sha256_block_data_order_neon
  >>> referenced by sha.cpp:940 (<PATH>/cryptopp/sha.cpp:940)
  >>>               sha.cpp.o:(CryptoPP::SHA256::HashMultipleBlocks(unsigned int const*, unsigned int)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  
  ld: error: undefined symbol: cryptogams_sha256_block_data_order
  >>> referenced by sha.cpp:947 (<PATH>/cryptopp/sha.cpp:947)
  >>>               sha.cpp.o:(CryptoPP::SHA256::HashMultipleBlocks(unsigned int const*, unsigned int)) in archive <PATH>/cryptopp-cmake-modern/cryptopp/libcryptopp.a
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  ninja: build stopped: subcommand failed.

Related to: 3a24749
and possible #38

CRYPTOGAMS_ARM_AES defined in config_asm.h:377 and not used any cmake based variable except CRYPTOPP_DISABLE_ARM_NEON but related to preprocessor __linux__ variable