botan icon indicating copy to clipboard operation
botan copied to clipboard

Unable to configure for different cpu arch/compiler/os with version 2.12

Open pgp opened this issue 6 years ago • 3 comments

Example command (run from Linux, trying to configure for Windows):

python configure.py --os=mingw --cpu=x86 --cc=gcc

Output:

   INFO: configure.py invoked with options "--os=mingw --cpu=x86 --cc=gcc"
   INFO: Configuring to build Botan 2.12.1 (revision git:1a6ad661ce64287ccbe26460ccc3aa4247d86ba8)
   INFO: Running under 3.7.4 (default, Oct  4 2019, 17:26:22) [GCC 9.2.0]
   INFO: Autodetected platform information: OS="Linux" machine="x86_64" proc=""
   INFO: Using /etc/ssl/certs/ca-certificates.crt as system certificate store
   INFO: Canonicalized CPU target x86 to x86_32
   INFO: Shared libs not supported on mingw, disabling shared lib support
   INFO: Auto-detected compiler version 9.2
   INFO: Auto-detected compiler arch x86_64
  ERROR: Configured target is x86_32 but compiler probe indicates x86_64

The above worked fine in version 2.11 and previous ones; it seems command line options are ignored or overriden by auto-detect...

pgp avatar Oct 14 '19 14:10 pgp

To confirm my understanding: you're trying to configure a build for MinGW but pointing to a non-cross Linux compiler, with the idea that later you'll build the configured sources with the compiler on another system.

It would be better if possible to point to the compiler you will use to build. But if that is not possible, use option --disable-cc-tests.

I think in 2.11 and prior if you look at the output you will see there was a warning due to the mismatch. This was upgraded to a hard error because much of the time when it happens it indicates a broken/misconfigured build, and then people are confused and open issues. The one exception (afaik) would be what (I think) you are trying to do here, creating a build "blind".

randombit avatar Oct 14 '19 15:10 randombit

Yes, the intention was to perform a blind configure for multiple target systems, and then copy the generated files onto the target systems. It actually works now with the --disable-cc-tests switch.

pgp avatar Oct 14 '19 15:10 pgp

Hi guys, sorry for reopening this issue after years, but I just noticed that, starting from that version (2.12.0) and still in the current botan2 one (2.19.5), even if I use --disable-cc-tests, the ARMv8 AES and SHA extensions are not enabled for aarch64 cpu target (they were enabled in 2.11.0 instead, even without --disable-cc-tests) -- see the line Skipping (incompatible compiler) in the two configure outputs:

2.11.0:

python configure.py --amalgamation --single-amalgamation-file --disable-modules=pkcs11,tls_10 --cpu=aarch64 --os=linux --cc=clang
   INFO: Configuring to build Botan 2.11.0 (revision git:16a726c3ad10316bd8d37b6118a5cc52894e8e8f)
   INFO: Running under 3.10.13 | packaged by conda-forge | (main, Dec 23 2023, 15:36:39) [GCC 12.3.0]
   INFO: ./configure.py invoked with options "--amalgamation --single-amalgamation-file --disable-modules=pkcs11,tls_10 --cpu=aarch64 --os=linux --cc=clang"
   INFO: Autodetected platform information: OS="Linux" machine="x86_64" proc=""
   INFO: Using /etc/ssl/certs/ca-certificates.crt as system certificate store
   INFO: Canonicalized CPU target aarch64 to arm64
   INFO: Auto-detected compiler version 18.1
   INFO: Auto-detected compiler arch x86_64
WARNING: Configured target is arm64 but compiler probe indicates x86_64
   INFO: Target is clang:18.1-linux-arm64
WARNING: Disabled module not found: tls_10
   INFO: Skipping (dependency failure): asio certstor_sqlite3 rdrand sessions_sqlite3
   INFO: Skipping (disabled by user): pkcs11
   INFO: Skipping (incompatible CPU): aes_ni aes_power8 aes_ssse3 chacha_avx2 clmul clmul_ssse3 idea_sse2 rdrand_rng rdseed serpent_avx2 sha1_sse2 sha1_x86 sha2_32_bmi2 sha2_32_x86 sha2_64_bmi2 sha3_bmi2 shacal2_x86 simd_avx2 threefish_512_avx2
   INFO: Skipping (incompatible OS): certstor_system_macos certstor_system_windows commoncrypto getentropy win32_stats
   INFO: Skipping (incompatible compiler): sm4_armv8   ######## fine, I don't care about sm4
   INFO: Skipping (no enabled compression schemes): compression
   INFO: Skipping (not requested): dyn_load
   INFO: Skipping (requires external dependency): bearssl boost bzip2 lzma openssl sqlite3 tpm zlib
   INFO: Loading modules: adler32 aead aes aes_armv8 aont argon2 aria asn1 auto_rng base base32 base58 base64 bcrypt bcrypt_pbkdf bigint blake2 block blowfish camellia cascade cast128 cast256 cbc cbc_mac ccm cecpq1 certstor_flatfile certstor_sql certstor_system cfb chacha chacha20poly1305 chacha_rng chacha_simd32 checksum cmac codec_filt comb4p cpuid crc24 crc32 cryptobox ctr curve25519 des dev_random dh dl_algo dl_group dlies dsa 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 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 mac mce mceies md4 md5 mdx_hash mem_pool mgf1 misty1 mode_pad modes mp newhope nist_keywrap noekeon noekeon_simd numbertheory ocb ofb par_hash passhash9 pbes2 pbkdf pbkdf1 pbkdf2 pem pgp_s2k pk_pad pmull poly1305 poly_dbl prf_tls prf_x942 proc_walk psk_db pubkey rc4 rfc3394 rfc6979 rmd160 rng rsa salsa20 scrypt seed serpent serpent_simd sessions_sql sha1 sha1_armv8 sha2_32 sha2_32_armv8 sha2_64 sha3 shacal2 shacal2_simd shake shake_cipher simd siphash siv skein sm2 sm3 sm4 socket sodium sp800_108 sp800_56a sp800_56c srp6 stateful_rng stream streebog system_rng thread_utils threefish_512 tiger tls tls_cbc tss twofish utils uuid whirlpool x509 x919_mac xmss xtea xts
   INFO: Defaulting to assuming little endian
   INFO: Using symlink to link files into build dir (use --link-method to change)
   INFO: Writing amalgamation header to botan_all.h
   INFO: Writing amalgamation header to botan_all_internal.h
   INFO: Writing amalgamation source to botan_all.cpp
   INFO: Botan 2.11.0 (revision git:16a726c3ad10316bd8d37b6118a5cc52894e8e8f) (unreleased undated) build setup is complete

2.12.0:

python ./configure.py --amalgamation --single-amalgamation-file --disable-modules=pkcs11,tls_10 --disable-cc-tests --cpu=aarch64 --os=linux --cc=clang
   INFO: ./configure.py invoked with options "--amalgamation --single-amalgamation-file --disable-modules=pkcs11,tls_10 --disable-cc-tests --cpu=aarch64 --os=linux --cc=clang"
   INFO: Configuring to build Botan 2.12.0 (revision git:4a02f36076edfc861fa19c660ba7230eab2d3d73)
   INFO: Running under 3.10.13 | packaged by conda-forge | (main, Dec 23 2023, 15:36:39) [GCC 12.3.0]
   INFO: Autodetected platform information: OS="Linux" machine="x86_64" proc=""
   INFO: Using /etc/ssl/certs/ca-certificates.crt as system certificate store
   INFO: Canonicalized CPU target aarch64 to arm64
   INFO: Target is clang:0.0-linux-arm64
   INFO: Assuming target arm64 is little endian
WARNING: Disabled module not found: tls_10
   INFO: Skipping (dependency failure): asio certstor_sqlite3 rdrand sessions_sqlite3
   INFO: Skipping (disabled by user): pkcs11
   INFO: Skipping (incompatible CPU): aes_ni aes_power8 chacha_avx2 clmul_ssse3 idea_sse2 p9_darn rdrand_rng rdseed serpent_avx2 sha1_sse2 sha1_x86 sha2_32_bmi2 sha2_32_x86 sha2_64_bmi2 sha3_bmi2 shacal2_x86 simd_avx2 threefish_512_avx2
   INFO: Skipping (incompatible OS): certstor_system_macos certstor_system_windows commoncrypto getentropy win32_stats
   INFO: Skipping (incompatible compiler): aes_armv8 clmul_cpu sha1_armv8 sha2_32_armv8 sm4_armv8   ######## ************ definitely not OK ************
   INFO: Skipping (no enabled compression schemes): compression
   INFO: Skipping (not requested): dyn_load
   INFO: Skipping (requires external dependency): boost bzip2 lzma openssl sqlite3 tpm zlib
   INFO: Loading modules: adler32 aead aes aes_vperm aont argon2 aria asn1 auto_rng base base32 base58 base64 bcrypt bcrypt_pbkdf bigint blake2 block blowfish camellia cascade cast128 cast256 cbc cbc_mac ccm cecpq1 certstor_flatfile certstor_sql certstor_system cfb chacha chacha20poly1305 chacha_rng chacha_simd32 checksum cmac codec_filt comb4p cpuid crc24 crc32 cryptobox ctr curve25519 des dev_random dh dl_algo dl_group dlies dsa 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 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 mac mce mceies md4 md5 mdx_hash mem_pool mgf1 misty1 mode_pad modes mp newhope nist_keywrap noekeon noekeon_simd numbertheory ocb ofb par_hash passhash9 pbes2 pbkdf pbkdf1 pbkdf2 pem pgp_s2k pk_pad poly1305 poly_dbl prf_tls prf_x942 proc_walk psk_db pubkey rc4 rfc3394 rfc6979 rmd160 rng rsa salsa20 scrypt seed serpent serpent_simd sessions_sql 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 srp6 stateful_rng stream streebog system_rng thread_utils threefish_512 tiger tls tls_cbc tss twofish utils uuid whirlpool x509 x919_mac xmss xtea xts
   INFO: Using symlink to link files into build dir (use --link-method to change)
   INFO: Writing amalgamation header to botan_all.h
   INFO: Writing amalgamation header to botan_all_internal.h
   INFO: Writing amalgamation source to botan_all.cpp
   INFO: Botan 2.12.0 (revision git:4a02f36076edfc861fa19c660ba7230eab2d3d73) (unreleased undated) build setup is complete

The real issue here is that I'm selecting --cpu=aarch64, and, as far as I know, on aarch64 hardware (at least on Android devices) those instructions should always be available...

Now, I know botan version 2 is almost EOL, so I ask you, is there at least a way to force enabling those instructions unconditionally, without the need to modify the configure script or other files? In configure.py --help I can find --disable-armv8crypto, but not the counterpart to always enable them.

pgp avatar Oct 17 '24 08:10 pgp