randombit / botan

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

Botan 2.1.0 can't compile under Windows10 with mingw gcc 5.3.0 #1120

Closed yutianzhe30 closed 7 years ago

yutianzhe30 commented 7 years ago

Platform: Windows 10 AMD64 toolchain: mingw (GNU coreutils) 5.3.0 I have also tried python configure.py --cc=gcc --cpu=x86 --os=mingw --disable-share python configure.py --cc=gcc --cpu=i686 --os=mingw --disable-share but the results are the same

### D:\Botan-2.1.0>python configure.py --cc=gcc --os=mingw --cpu=i386
   INFO: configure.py invoked with options "--cc=gcc --os=mingw --cpu=i386"
   INFO: Platform: OS="Windows" machine="AMD64" proc="Intel64 Family 6 Model 23 Stepping 6, GenuineIntel"
   INFO: Canonicalizized CPU target i386 to x86_32/i386
   INFO: Target is gcc-mingw-x86_32-i386
WARNING: Shared libs not supported on mingw, disabling shared lib support
   INFO: Skipping, dependency failure - certstor_sqlite3 pkcs11 sessions_sqlite3
   INFO: Skipping, incompatible OS - darwin_secrandom dev_random dyn_load getentropy locking_allocator proc_walk
   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_ni aes_ssse3 aont asn1 auto_rng base base64 bcrypt bigint blake2 block blowfish camellia cascade cast cbc cbc_mac ccm cecpq1 certstor_sql cfb chacha chacha20poly1305 chacha_sse2 clmul cmac codec_filt comb4p crc24 crc32 cryptoapi_rng cryptobox ctr curve25519 des dh dl_algo dl_group dlies dsa eax ec_gfp ec_group ecc_key ecdh ecdsa ecgdsa ecies eckcdsa 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 http_util idea idea_sse2 iso9796 kasumi kdf kdf1 kdf1_iso18033 kdf2 keccak keypair lion mac mce mceies md4 md5 mdx_hash mgf1 misty1 mode_pad modes mp newhope noekeon noekeon_simd numbertheory ocb ofb par_hash passhash9 pbes2 pbkdf pbkdf1 pbkdf2 pem pk_pad poly1305 prf_tls prf_x942 pubkey rc4 rdrand rdrand_rng rdseed rfc3394 rfc6979 rmd160 rng rsa salsa20 seed serpent serpent_simd sessions_sql sha1 sha1_sse2 sha2_32 sha2_64 sha3 shake shake_cipher simd siphash siv skein sp800_108 sp800_56c srp6 stateful_rng stream system_rng threefish threefish_avx2 tiger tls tls_cbc tss twofish utils whirlpool win32_stats x509 x919_mac xmss xtea xts
   INFO: Assuming CPU is little endian
   INFO: Assuming unaligned memory access works
   INFO: Using copy to link files into build dir (use --link-method to change)
   INFO: Botan 2.1.0 (VC git:7bdffd52a96e08e9452d1985258376a3925a497b) (released dated 20170404) build setup is complete

D:\Botan-2.1.0>mingw32-make
g++ -fstack-protector -pthread  -std=c++11 -D_REENTRANT -O3 -mtune=generic -momit-leaf-frame-pointer -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Wnon-virtual-dtor -Ibuild\include -c src\lib\asn1\alg_id.cpp -o build\obj\lib\asn1_alg_id.o
g++ -fstack-protector -pthread  -std=c++11 -D_REENTRANT -O3 -mtune=generic -momit-leaf-frame-pointer -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Wnon-virtual-dtor -Ibuild\include -c src\lib\asn1\asn1_alt_name.cpp -o build\obj\lib\asn1_alt_name.o
g++ -fstack-protector -pthread  -std=c++11 -D_REENTRANT -O3 -mtune=generic -momit-leaf-frame-pointer -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Wnon-virtual-dtor -Ibuild\include -c src\lib\asn1\asn1_attribute.cpp -o build\obj\lib\asn1_attribute.o
g++ -fstack-protector -pthread  -std=c++11 -D_REENTRANT -O3 -mtune=generic -momit-leaf-frame-pointer -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Wnon-virtual-dtor -Ibuild\include -c src\lib\asn1\asn1_obj.cpp -o build\obj\lib\asn1_obj.o
g++ -fstack-protector -pthread  -std=c++11 -D_REENTRANT -O3 -mtune=generic -momit-leaf-frame-pointer -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Wnon-virtual-dtor -Ibuild\include -c src\lib\asn1\asn1_oid.cpp -o build\obj\lib\asn1_oid.o
g++ -fstack-protector -pthread  -std=c++11 -D_REENTRANT -O3 -mtune=generic -momit-leaf-frame-pointer -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Wnon-virtual-dtor -Ibuild\include -c src\lib\asn1\asn1_str.cpp -o build\obj\lib\asn1_str.o
g++ -fstack-protector -pthread  -std=c++11 -D_REENTRANT -O3 -mtune=generic -momit-leaf-frame-pointer -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Wnon-virtual-dtor -Ibuild\include -c src\lib\asn1\asn1_time.cpp -o build\obj\lib\asn1_time.o
g++ -fstack-protector -pthread  -std=c++11 -D_REENTRANT -O3 -mtune=generic -momit-leaf-frame-pointer -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Wnon-virtual-dtor -Ibuild\include -c src\lib\asn1\ber_dec.cpp -o build\obj\lib\asn1_ber_dec.o
In file included from build\include/botan/rng.h:14:0,
                 from build\include/botan/bigint.h:12,
                 from src\lib\asn1\ber_dec.cpp:10:
build\include/botan/mutex.h:20:14: error: 'mutex' in namespace 'std' does not name a type
 typedef std::mutex mutex_type;
              ^
In file included from build\include/botan/bigint.h:12:0,
                 from src\lib\asn1\ber_dec.cpp:10:
build\include/botan/rng.h:256:15: error: 'mutex_type' does not name a type
       mutable mutex_type m_mutex;
               ^
build\include/botan/rng.h: In member function 'virtual void Botan::Serialized_RNG::randomize(uint8_t*, std::size_t)':
build\include/botan/rng.h:216:26: error: 'mutex_type' was not declared in this scope
          lock_guard_type<mutex_type> lock(m_mutex);
                          ^
build\include/botan/rng.h:216:36: error: template argument 1 is invalid
          lock_guard_type<mutex_type> lock(m_mutex);
                                    ^
build\include/botan/rng.h:216:43: error: 'm_mutex' was not declared in this scope
          lock_guard_type<mutex_type> lock(m_mutex);
                                           ^
build\include/botan/rng.h:216:38: warning: unused variable 'lock' [-Wunused-variable]
          lock_guard_type<mutex_type> lock(m_mutex);
                                      ^
build\include/botan/rng.h: In member function 'virtual bool Botan::Serialized_RNG::is_seeded() const':
build\include/botan/rng.h:222:26: error: 'mutex_type' was not declared in this scope
          lock_guard_type<mutex_type> lock(m_mutex);
                          ^
build\include/botan/rng.h:222:36: error: template argument 1 is invalid
          lock_guard_type<mutex_type> lock(m_mutex);
                                    ^
build\include/botan/rng.h:222:43: error: 'm_mutex' was not declared in this scope
          lock_guard_type<mutex_type> lock(m_mutex);
                                           ^
build\include/botan/rng.h:222:38: warning: unused variable 'lock' [-Wunused-variable]
          lock_guard_type<mutex_type> lock(m_mutex);
                                      ^
build\include/botan/rng.h: In member function 'virtual void Botan::Serialized_RNG::clear()':
build\include/botan/rng.h:228:26: error: 'mutex_type' was not declared in this scope
          lock_guard_type<mutex_type> lock(m_mutex);
                          ^
build\include/botan/rng.h:228:36: error: template argument 1 is invalid
          lock_guard_type<mutex_type> lock(m_mutex);
                                    ^
build\include/botan/rng.h:228:43: error: 'm_mutex' was not declared in this scope
          lock_guard_type<mutex_type> lock(m_mutex);
                                           ^
build\include/botan/rng.h:228:38: warning: unused variable 'lock' [-Wunused-variable]
          lock_guard_type<mutex_type> lock(m_mutex);
                                      ^
build\include/botan/rng.h: In member function 'virtual std::__cxx11::string Botan::Serialized_RNG::name() const':
build\include/botan/rng.h:234:26: error: 'mutex_type' was not declared in this scope
          lock_guard_type<mutex_type> lock(m_mutex);
                          ^
build\include/botan/rng.h:234:36: error: template argument 1 is invalid
          lock_guard_type<mutex_type> lock(m_mutex);
                                    ^
build\include/botan/rng.h:234:43: error: 'm_mutex' was not declared in this scope
          lock_guard_type<mutex_type> lock(m_mutex);
                                           ^
build\include/botan/rng.h:234:38: warning: unused variable 'lock' [-Wunused-variable]
          lock_guard_type<mutex_type> lock(m_mutex);
                                      ^
build\include/botan/rng.h: In member function 'virtual std::size_t Botan::Serialized_RNG::reseed(Botan::Entropy_Sources&, std::size_t, std::chrono::milliseconds)':
build\include/botan/rng.h:242:26: error: 'mutex_type' was not declared in this scope
          lock_guard_type<mutex_type> lock(m_mutex);
                          ^
build\include/botan/rng.h:242:36: error: template argument 1 is invalid
          lock_guard_type<mutex_type> lock(m_mutex);
                                    ^
build\include/botan/rng.h:242:43: error: 'm_mutex' was not declared in this scope
          lock_guard_type<mutex_type> lock(m_mutex);
                                           ^
build\include/botan/rng.h:242:38: warning: unused variable 'lock' [-Wunused-variable]
          lock_guard_type<mutex_type> lock(m_mutex);
                                      ^
build\include/botan/rng.h: In member function 'virtual void Botan::Serialized_RNG::add_entropy(const uint8_t*, std::size_t)':
build\include/botan/rng.h:248:26: error: 'mutex_type' was not declared in this scope
          lock_guard_type<mutex_type> lock(m_mutex);
                          ^
build\include/botan/rng.h:248:36: error: template argument 1 is invalid
          lock_guard_type<mutex_type> lock(m_mutex);
                                    ^
build\include/botan/rng.h:248:43: error: 'm_mutex' was not declared in this scope
          lock_guard_type<mutex_type> lock(m_mutex);
                                           ^
build\include/botan/rng.h:248:38: warning: unused variable 'lock' [-Wunused-variable]
          lock_guard_type<mutex_type> lock(m_mutex);
                                      ^
Makefile:472: recipe for target 'build\obj\lib\asn1_ber_dec.o' failed
mingw32-make: *** [build\obj\lib\asn1_ber_dec.o] Error 1
randombit commented 7 years ago

It seems that stock MinGW does not support the C++11 thread APIs (why this is the case, I have no idea). It seems some alternate builds such as http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/rubenvb/ do support threads.

Further background at

https://stackoverflow.com/questions/17551722/getting-stdthread-mutex-to-work-under-win7-with-mingw-and-g-4-7-2 https://wiki.qt.io/MinGW-64-bit