randombit / botan

Cryptography Toolkit
https://botan.randombit.net
BSD 2-Clause "Simplified" License
2.59k stars 567 forks source link

Unable to build for Android on Windows #2306

Closed IgorAkimov1995 closed 1 year ago

IgorAkimov1995 commented 4 years ago

I cannot understand how to build botan for android, according on the instruction: $ export CXX=/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android28-clang++ $ ./configure.py --os=android --cc=clang --cpu=arm64

i cannot understand how to use this commands on Windows, also reading previous issues did not help me, can you tell me how did you build this library on windows step-by-step, just your command examples?

randombit commented 4 years ago

I don't use Windows and am not able to test anything in this regard. But if you have Android NDK installed I think all you need is

export CXX=where-android-cc-is-installed ./configure.py --os=android --cc=clang --cpu=arm64

If this doesn't work please post output of configure.py and failing compiler invocation

IgorAkimov1995 commented 4 years ago

I don't use Windows and am not able to test anything in this regard. But if you have Android NDK installed I think all you need is

export CXX=where-android-cc-is-installed ./configure.py --os=android --cc=clang --cpu=arm64

If this doesn't work please post output of configure.py and failing compiler invocation

But there is no "export" command for Windows, what does do this command, and what analogue of it can i provide in Windows command prompt?

randombit commented 4 years ago

Oh yes I see. In that case you can use --cc-bin option of configure.py to specify the path to the compiler

IgorAkimov1995 commented 4 years ago

D:\Programming\Libraries\botanAndroid\botan-master>python configure.py --cc-bin=D:\Android\android-ndk-r19c\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi28-clang++ --os=android --cc=clang --cpu=armv7 INFO: configure.py invoked with options "--cc-bin=D:\Android\android-ndk-r19c\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi28-clang++ --os=android --cc=clang --cpu=armv7" INFO: Configuring to build Botan 2.14.0 (revision unknown) INFO: Running under 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] INFO: Autodetected platform information: OS="Windows" machine="AMD64" proc="Intel64 Family 6 Model 142 Stepping 10, GenuineIntel" INFO: Canonicalized CPU target armv7 to arm32 WARNING: Could not execute ['D:\Android\android-ndk-r19c\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi28-clang++', '-E', 'src\build-data\detect_version.cpp']: [WinError 193] %1 не является приложением Win32 WARNING: Tried to get clang version, but output '0.0' does not match expected version format WARNING: Could not execute ['D:\Android\android-ndk-r19c\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi28-clang++', '-E', '-fstack-protector', '-pthread', 'src\build-data\detect_arch.cpp']: [WinError 193] %1 не является приложением Win32 WARNING: Unable to detect target architecture via compiler macro checks INFO: Target is clang:0.0-android-arm32 INFO: Assuming target arm32 is little endian INFO: Skipping (dependency failure): asio certstor_sqlite3 rdrand sessions_sqlite3 INFO: Skipping (incompatible CPU): aes_armv8 aes_ni aes_power8 chacha_avx2 clmul_cpu clmul_ssse3 idea_sse2 p9_darn 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 proc_walk win32_stats INFO: Skipping (no enabled compression schemes): compression 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 comb4p 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 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 pkcs11 poly1305 poly_dbl prf_tls prf_x942 psk_db pubkey rc4 rfc3394 rfc6979 rmd160 rng roughtime 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_10 tls_cbc tss twofish utils uuid whirlpool x509 x919_mac xmss xtea xts INFO: Using hardlink to link files into build dir (use --link-method to change) INFO: Botan 2.14.0 (revision unknown) (unreleased undated) build setup is complete

It shows several warnings.

randombit commented 4 years ago

[WinError 193] %1 не является приложением Win32

What does this mean?

IgorAkimov1995 commented 4 years ago

[WinError 193] %1 не является приложением Win32

What does this mean?

is not an application of Win32

randombit commented 4 years ago

Weird. I assume if you invoke D:\Android\android-ndk-r19c\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi28-clang++ directly it works??

pgp commented 4 years ago

@IgorAkimov1995 , if it can help, even if I cross-compile for Android mainly from Linux, some months ago I tried also building botan for one of my projects, for Android from Windows. Only difference with your snippet is that I compile amalgamated code, and I did never use the android target (I started my build attempts before the android target existed), but rather the linux one. You may have a look here and here if you want to do some further attempts.

randombit commented 1 year ago

Closing as stale. If you are still having problems please open a new ticket.