botan icon indicating copy to clipboard operation
botan copied to clipboard

Compile error on PPC64 (E6500)

Open dharanlinux opened this issue 3 years ago • 2 comments

I could able to build the Botan-2.12.1 for E6500 target with --disable-modules='aes_power8,p9_darn'.

But while I am using the Botan-2.18.1 for the same target with '--disable-powercrypto', facing the below build issue.

Configure output:

INFO: Autodetected platform information: OS="Linux" machine="x86_64" proc="x86_64" INFO: Using /etc/ssl/certs/ca-certificates.crt as system certificate store INFO: Canonicalized CPU target powerpc64 to ppc64 INFO: Auto-detected compiler version 5.5 INFO: Auto-detected compiler arch ppc64 INFO: Target is gcc:5.5-linux-ppc64 INFO: Assuming target ppc64 is big endian INFO: Skipping (incompatible CPU): aes_armv8 aes_ni aes_power8 aes_vperm chacha_avx2 ghash_cpu ghash_vperm idea_sse2 rdrand_rng rdseed serpent_avx2 sha1_armv8 sha1_sse2 sha1_x86 sha2_32_armv8 sha2_32_bmi2 sha2_32_x86 sha2_64_bmi2 sha3_bmi2 shacal2_avx2 shacal2_x86 simd_avx2 sm4_armv8 threefish_512_avx2 INFO: Skipping (incompatible OS): certstor_system_macos certstor_system_windows commoncrypto getentropy win32_stats INFO: Enabling use of external dependency boost INFO: Enabling use of external dependency bzip2 INFO: Enabling use of external dependency lzma INFO: Enabling use of external dependency openssl INFO: Enabling use of external dependency sqlite3 INFO: Enabling use of external dependency tpm INFO: Enabling use of external dependency zlib INFO: Loading modules: adler32 aead aes aont argon2 aria asio asn1 auto_rng base base32 base58 base64 bcrypt bcrypt_pbkdf bigint blake2 block blowfish boost bzip2 camellia cascade cast128 cast256 cbc cbc_mac ccm cecpq1 certstor_flatfile certstor_sql certstor_sqlite3 certstor_system cfb chacha chacha20poly1305 chacha_rng chacha_simd32 checksum cmac comb4p compression cpuid crc24 crc32 cryptobox ctr curve25519 des dev_random dh dl_algo dl_group dlies dsa dyn_load eax ec_group ecc_key ecdh ecdsa ecgdsa ecies eckcdsa ed25519 elgamal eme_oaep eme_pkcs1 eme_raw emsa1 emsa_pkcs1 emsa_pssr emsa_raw emsa_x931 entropy fd_unix ffi filters fpe_fe1 gcm ghash gmac gost_28147 gost_3410 gost_3411 hash hash_id hex hkdf hmac hmac_drbg hotp http_util idea iso9796 kasumi kdf kdf1 kdf1_iso18033 kdf2 keccak keypair lion locking_allocator lzma mac mce mceies md4 md5 mdx_hash mem_pool mgf1 misty1 mode_pad modes mp newhope nist_keywrap noekeon noekeon_simd numbertheory ocb ofb openssl par_hash passhash9 pbes2 pbkdf pbkdf1 pbkdf2 pem pgp_s2k pk_pad pkcs11 poly1305 poly_dbl prf_tls prf_x942 proc_walk processor_rng psk_db pubkey rc4 rfc3394 rfc6979 rmd160 rng roughtime rsa salsa20 scrypt seed serpent serpent_simd sessions_sql sessions_sqlite3 sha1 sha2_32 sha2_64 sha3 shacal2 shacal2_simd shake shake_cipher simd siphash siv skein sm2 sm3 sm4 socket sodium sp800_108 sp800_56a sp800_56c sqlite3 srp6 stateful_rng stream streebog system_rng thread_utils threefish_512 tiger tls tls_10 tls_cbc tpm tss twofish utils uuid whirlpool x509 x919_mac xmss xtea xts zlib INFO: Using symlink to link files into build dir (use --link-method to change) INFO: Botan 2.18.1 (revision git:d4bd416702a65eddcc14ee06b9c1b674631e6ae3) (release dated 20210509) build setup is complete

Build error:

D_REENTRANT -Os -g -pipe -DBOTAN_IS_BEING_BUILT -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Wnon-virtual-dtor -Ibuild/include -Ibuild/include/external -c src/lib/block/serpent/serpent.cpp -o build/obj/lib/block_serpent.o In file included from build/include/botan/build.h:449:0, from build/include/botan/types.h:13, from build/include/botan/secmem.h:11, from build/include/botan/symkey.h:11, from build/include/botan/sym_algo.h:11, from build/include/botan/block_cipher.h:11, from build/include/botan/noekeon.h:11, from src/lib/block/noekeon/noekeon_simd/noekeon_simd.cpp:8: build/include/botan/compiler.h:75:59: error: target attribute or pragma changes single precision floating point #define BOTAN_FUNC_ISA(isa) attribute ((target(isa))) ^ build/include/botan/internal/simd_32.h:612:36: note: in expansion of macro 'BOTAN_FUNC_ISA' native_simd_type raw() const BOTAN_FUNC_ISA(BOTAN_SIMD_ISA) { return m_simd; } ^ build/include/botan/compiler.h:75:59: error: target attribute or pragma changes double precision floating point #define BOTAN_FUNC_ISA(isa) attribute ((target(isa))) ^ build/include/botan/internal/simd_32.h:612:36: note: in expansion of macro 'BOTAN_FUNC_ISA' native_simd_type raw() const BOTAN_FUNC_ISA(BOTAN_SIMD_ISA) { return m_simd; } ^ build/include/botan/compiler.h:75:59: error: target attribute or pragma changes single precision floating point #define BOTAN_FUNC_ISA(isa) attribute ((target(isa))) ^ build/include/botan/internal/simd_32.h:612:36: note: in expansion of macro 'BOTAN_FUNC_ISA' native_simd_type raw() const BOTAN_FUNC_ISA(BOTAN_SIMD_ISA) { return m_simd; } ^ build/include/botan/compiler.h:75:59: error: target attribute or pragma changes double precision floating point #define BOTAN_FUNC_ISA(isa) attribute ((target(isa))) ^ build/include/botan/internal/simd_32.h:612:36: note: in expansion of macro 'BOTAN_FUNC_ISA' native_simd_type raw() const BOTAN_FUNC_ISA(BOTAN_SIMD_ISA) { return m_simd; } ^ make[1]: *** [build/obj/lib/block_noekeon_simd.o] Error 1 make[1]: *** Waiting for unfinished jobs....


  1. The E6500 processor has altivec support. Could you please check on the above issue?

  2. Even if I disable the altivec support ' --disable-altivec', facing the below build issue with 'processor_rng' module.

Error Log:

-std=c++11 -D_REENTRANT  -Os -g -pipe -DBOTAN_IS_BEING_BUILT -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Wnon-virtual-dtor -mcpu=power9 -Ibuild/include -Ibuild/include/external -c src/lib/rng/processor_rng/processor_rng.cpp -o build/obj/lib/rng_processor_rng.o

powerpc64-linux-gnu-g++: error: unrecognized argument in option '-mcpu=power9'

powerpc64-linux-gnu-g++: note: valid arguments to '-mcpu=' are: 401 403 405 405fp 440 440fp 464 464fp 476 476fp 505 601 602 603 603e 604 604e 620 630 740 7400 7450 750 801 821 823 8540 8548 860 970 G3 G4 G5 a2 cell e300c2 e300c3 e500mc e500mc64 e5500 e6500 ec603e native power3 power4 power5 power5+ power6 power6x power7 power8 powerpc powerpc64 powerpc64le rs64 titan
make[1]: *** [build/obj/lib/rng_processor_rng.o] Error 1

dharanlinux avatar Jun 23 '21 16:06 dharanlinux

For AltiVec "target attribute or pragma changes single precision floating point" I am not really sure but it looks like it may be this GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68028 which is still open, but a comment indicates it could not be reproduced in GCC 8. It may be that target attributes just don't work on e6500 with gcc 5. Best bet may be just --disable-altivec, unless it's possible for you to upgrade your compiler.

OK I think there is a missing version dependency on the DARN support. But since the E6500 probably doesn't have it anyway you can add --disable-modules=processor_rng. We should have detected this automatically and disabled it.

randombit avatar Jun 24 '21 11:06 randombit

Botan-2.18.1 build with altivec in gcc-8.1 and need to disable processor_rng module.

   INFO: Auto-detected compiler version 8.1
   INFO: Auto-detected compiler arch ppc64
   INFO: Target is gcc:8.1-linux-ppc64
   INFO: Assuming target ppc64 is big endian
   INFO: Skipping (dependency failure): asio certstor_sqlite3 sessions_sqlite3
   INFO: Skipping (disabled by user): boost bzip2 lzma openssl processor_rng sqlite3 tpm zlib
   INFO: Skipping (incompatible CPU): aes_armv8 aes_ni aes_power8 aes_vperm chacha_avx2 ghash_cpu ghash_vperm idea_sse2 rdrand_rng rdseed serpent_avx2 sha1_armv8 sha1_sse2 sha1_x86 sha2_32_armv8 sha2_32_bmi2 sha2_32_x86 sha2_64_bmi2 sha3_bmi2 shacal2_avx2 shacal2_x86 simd_avx2 sm4_armv8 threefish_512_avx2

Can you update the gcc version requirement for PPC64 in the doc folder?

dharanlinux avatar Jun 24 '21 12:06 dharanlinux

Updated the docs

randombit avatar Jan 14 '23 15:01 randombit