HorizenOfficial / zend_oo

This repository is archived, Zendoo is out of beta and has been included in https://github.com/HorizenOfficial/zen.
https://github.com/HorizenOfficial/zen
Other
34 stars 22 forks source link

Regression in Windows MinGW build #152

Open cronicc opened 3 years ago

cronicc commented 3 years ago

MinGW build failing with:

/bin/bash ../libtool  --tag=CXX   --mode=link /mnt/build/depends/x86_64-w64-mingw32/share/../native/bin/ccache x86_64-w64-mingw32-g++ -std=c++11  -Wformat -Wformat-security -Wstack-protector -fstack-protector-all   -DBITCOIN_TX -pipe -O2 -g -fopenmp -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Wreturn-type -pthread   -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -L/mnt/build/depends/x86_64-w64-mingw32/share/../lib  -o zcash/CreateJoinSplit.exe zcash/zcash_CreateJoinSplit-CreateJoinSplit.o primitives/zcash_CreateJoinSplit-transaction.o primitives/zcash_CreateJoinSplit-certificate.o sc/zcash_CreateJoinSplit-sidechaintypes.o sc/zcash_CreateJoinSplit-proofverifier.o sc/zcash_CreateJoinSplit-sidechain.o libzcash.a snark/libsnark.a libbitcoin_util.a crypto/libbitcoin_crypto.a -L/mnt/build/depends/x86_64-w64-mingw32/share/../lib -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread -lboost_chrono -lgmp -lgmpxx -lboost_system -lcrypto -lsodium -lrustzcash -lzendoo_mc -lssp -luserenv -lcrypt32 -liphlpapi -lshlwapi -lmswsock -lws2_32 -ladvapi32 -lrpcrt4 -luuid -loleaut32 -lole32 -lcomctl32 -lshell32 -lwinmm -lwinspool -lcomdlg32 -lgdi32 -luser32 -lkernel32 -lmingwthrd
libtool: link: /mnt/build/depends/x86_64-w64-mingw32/share/../native/bin/ccache x86_64-w64-mingw32-g++ -std=c++11 -Wformat -Wformat-security -Wstack-protector -fstack-protector-all -pipe -O2 -g -fopenmp -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Wreturn-type -pthread -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -static -o zendoo/mcTest.exe zendoo/zendoo_mcTest-mcTestCall.o zendoo_mcTest-uint256.o zendoo_mcTest-utilstrencodings.o  -L/mnt/build/depends/x86_64-w64-mingw32/share/../lib -lzendoo_mc -lpthread -lssp -luserenv -lcrypt32 -liphlpapi -lshlwapi -lmswsock -lws2_32 -ladvapi32 -lrpcrt4 -luuid -loleaut32 -lole32 -lcomctl32 -lshell32 -lwinmm -lwinspool -lcomdlg32 -lgdi32 -luser32 -lkernel32 -lmingwthrd -pthread -fopenmp
libtool: link: /mnt/build/depends/x86_64-w64-mingw32/share/../native/bin/ccache x86_64-w64-mingw32-g++ -std=c++11 -Wformat -Wformat-security -Wstack-protector -fstack-protector-all -DBITCOIN_TX -pipe -O2 -g -fopenmp -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Wreturn-type -pthread -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -o zcash/.libs/CreateJoinSplit.exe zcash/zcash_CreateJoinSplit-CreateJoinSplit.o primitives/zcash_CreateJoinSplit-transaction.o primitives/zcash_CreateJoinSplit-certificate.o sc/zcash_CreateJoinSplit-sidechaintypes.o sc/zcash_CreateJoinSplit-proofverifier.o sc/zcash_CreateJoinSplit-sidechain.o  -L/mnt/build/depends/x86_64-w64-mingw32/share/../lib libzcash.a snark/libsnark.a libbitcoin_util.a crypto/libbitcoin_crypto.a -lboost_filesystem -lboost_program_options -lboost_thread -lboost_chrono -L/mnt/build/depends/x86_64-w64-mingw32/lib /mnt/build/depends/x86_64-w64-mingw32/lib/libgmpxx.a /mnt/build/depends/x86_64-w64-mingw32/lib/libgmp.a -lboost_system -lcrypto /mnt/build/depends/x86_64-w64-mingw32/lib/libsodium.a -lrustzcash -lzendoo_mc -lssp -luserenv -lcrypt32 -liphlpapi -lshlwapi -lmswsock -lws2_32 -ladvapi32 -lrpcrt4 -luuid -loleaut32 -lole32 -lcomctl32 -lshell32 -lwinmm -lwinspool -lcomdlg32 -lgdi32 -luser32 -lkernel32 -lmingwthrd -pthread -fopenmp
libtool: link: /mnt/build/depends/x86_64-w64-mingw32/share/../native/bin/ccache x86_64-w64-mingw32-g++ -std=c++11 -Wformat -Wformat-security -Wstack-protector -fstack-protector-all -pipe -O2 -g -fopenmp -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Wreturn-type -pthread -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -static -o zen-cli.exe zen_cli-bitcoin-cli.o bitcoin-cli-res.o  -L/mnt/build/depends/x86_64-w64-mingw32/share/../lib libbitcoin_cli.a univalue/.libs/libunivalue.a libbitcoin_util.a -lboost_filesystem -lboost_program_options -lboost_thread -lboost_chrono -lssl /mnt/build/depends/x86_64-w64-mingw32/lib/libevent.a -L/mnt/build/depends/x86_64-w64-mingw32/lib libzcash.a libzencash.a snark/libsnark.a crypto/libbitcoin_crypto.a /mnt/build/depends/x86_64-w64-mingw32/lib/libgmpxx.a /mnt/build/depends/x86_64-w64-mingw32/lib/libgmp.a -lboost_system -lcrypto /mnt/build/depends/x86_64-w64-mingw32/lib/libsodium.a -lrustzcash -lzendoo_mc -lssp -luserenv -lcrypt32 -liphlpapi -lshlwapi -lmswsock -lws2_32 -ladvapi32 -lrpcrt4 -luuid -loleaut32 -lole32 -lcomctl32 -lshell32 -lwinmm -lwinspool -lcomdlg32 -lgdi32 -luser32 -lkernel32 -lmingwthrd -pthread -fopenmp
libtool: link: /mnt/build/depends/x86_64-w64-mingw32/share/../native/bin/ccache x86_64-w64-mingw32-g++ -std=c++11 -Wformat -Wformat-security -Wstack-protector -fstack-protector-all -DBITCOIN_TX -pipe -O2 -g -fopenmp -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Wreturn-type -pthread -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -static -o zen-tx.exe zen_tx-bitcoin-tx.o primitives/zen_tx-transaction.o primitives/zen_tx-certificate.o sc/zen_tx-sidechainTxsCommitmentBuilder.o sc/zen_tx-sidechaintypes.o sc/zen_tx-proofverifier.o sc/zen_tx-sidechain.o zen_tx-coins.o script/zen_tx-interpreter.o script/zen_tx-standard.o bitcoin-tx-res.o  -L/mnt/build/depends/x86_64-w64-mingw32/share/../lib univalue/.libs/libunivalue.a libbitcoin_common.a libbitcoin_util.a secp256k1/.libs/libsecp256k1.a libzcash.a libzencash.a snark/libsnark.a crypto/libbitcoin_crypto.a -L/mnt/build/depends/x86_64-w64-mingw32/lib /mnt/build/depends/x86_64-w64-mingw32/lib/libgmpxx.a /mnt/build/depends/x86_64-w64-mingw32/lib/libgmp.a /mnt/build/depends/x86_64-w64-mingw32/lib/libsodium.a -lrustzcash -lzendoo_mc -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread -lboost_chrono -lcrypto -lssp -luserenv -lcrypt32 -liphlpapi -lshlwapi -lmswsock -lws2_32 -ladvapi32 -lrpcrt4 -luuid -loleaut32 -lole32 -lcomctl32 -lshell32 -lwinmm -lwinspool -lcomdlg32 -lgdi32 -luser32 -lkernel32 -lmingwthrd -pthread -fopenmp
libtool: link: /mnt/build/depends/x86_64-w64-mingw32/share/../native/bin/ccache x86_64-w64-mingw32-g++ -std=c++11 -Wformat -Wformat-security -Wstack-protector -fstack-protector-all -pipe -O2 -g -fopenmp -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Wreturn-type -pthread -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -static -o zend.exe zend-bitcoind.o bitcoind-res.o  -L/mnt/build/depends/x86_64-w64-mingw32/share/../lib libbitcoin_server.a libbitcoin_common.a univalue/.libs/libunivalue.a libbitcoin_util.a libzcash.a libzencash.a snark/libsnark.a ./leveldb/libleveldb.a ./leveldb/libmemenv.a secp256k1/.libs/libsecp256k1.a libbitcoin_zmq.a /mnt/build/depends/x86_64-w64-mingw32/lib/libzmq.a -L/mnt/build/depends/x86_64-w64-mingw32/lib libbitcoin_wallet.a -lboost_filesystem -lboost_program_options -lboost_thread -lboost_chrono -ldb_cxx-6.2 -lssl /mnt/build/depends/x86_64-w64-mingw32/lib/libevent.a crypto/libbitcoin_crypto.a /mnt/build/depends/x86_64-w64-mingw32/lib/libgmpxx.a /mnt/build/depends/x86_64-w64-mingw32/lib/libgmp.a -lboost_system -lcrypto /mnt/build/depends/x86_64-w64-mingw32/lib/libsodium.a -lrustzcash -lzendoo_mc -lssp -luserenv -lcrypt32 -liphlpapi -lshlwapi -lmswsock -lws2_32 -ladvapi32 -lrpcrt4 -luuid -loleaut32 -lole32 -lcomctl32 -lshell32 -lwinmm -lwinspool -lcomdlg32 -lgdi32 -luser32 -lkernel32 -lmingwthrd -pthread -fopenmp
/mnt/build/depends/x86_64-w64-mingw32/share/../lib/libzendoo_mc.a(getrandom-ab38333cc7a9ecae.getrandom.e4w98cj7-cgu.0.rcgu.o):getrandom.e4w98cj7:(.text+0x502): undefined reference to `BCryptGenRandom'
collect2: error: ld returned 1 exit status
Makefile:2728: recipe for target 'zendoo/mcTest.exe' failed
make[2]: *** [zendoo/mcTest.exe] Error 1
make[2]: *** Waiting for unfinished jobs....
libtool: link: /mnt/build/depends/x86_64-w64-mingw32/share/../native/bin/ccache x86_64-w64-mingw32-g++ -std=c++11 -Wformat -Wformat-security -Wstack-protector -fstack-protector-all -pipe -O2 -g -fopenmp -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Wreturn-type -pthread -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -static -o test/test_bitcoin.exe script/test_test_bitcoin-standard.o test/test_test_bitcoin-arith_uint256_tests.o test/test_test_bitcoin-addrman_tests.o test/test_test_bitcoin-allocator_tests.o test/test_test_bitcoin-base32_tests.o test/test_test_bitcoin-base58_tests.o test/test_test_bitcoin-base64_tests.o test/test_test_bitcoin-bip32_tests.o test/test_test_bitcoin-bloom_tests.o test/test_test_bitcoin-checkblock_tests.o test/test_test_bitcoin-Checkpoints_tests.o test/test_test_bitcoin-coins_tests.o test/test_test_bitcoin-compress_tests.o test/test_test_bitcoin-crypto_tests.o test/test_test_bitcoin-DoS_tests.o test/test_test_bitcoin-equihash_tests.o test/test_test_bitcoin-getarg_tests.o test/test_test_bitcoin-hash_tests.o test/test_test_bitcoin-key_tests.o test/test_test_bitcoin-main_tests.o test/test_test_bitcoin-mempool_tests.o test/test_test_bitcoin-miner_tests.o test/test_test_bitcoin-mruset_tests.o test/test_test_bitcoin-multisig_tests.o test/test_test_bitcoin-netbase_tests.o test/test_test_bitcoin-pmt_tests.o test/test_test_bitcoin-policyestimator_tests.o test/test_test_bitcoin-pow_tests.o test/test_test_bitcoin-raii_event_tests.o test/test_test_bitcoin-reverselock_tests.o test/test_test_bitcoin-rpc_tests.o test/test_test_bitcoin-sanity_tests.o test/test_test_bitcoin-scheduler_tests.o test/test_test_bitcoin-script_P2SH_tests.o test/test_test_bitcoin-script_tests.o test/test_test_bitcoin-scriptnum_tests.o test/test_test_bitcoin-serialize_tests.o test/test_test_bitcoin-sighash_tests.o test/test_test_bitcoin-sigopcount_tests.o test/test_test_bitcoin-skiplist_tests.o test/test_test_bitcoin-test_bitcoin.o test/test_test_bitcoin-torcontrol_tests.o test/test_test_bitcoin-transaction_tests.o test/test_test_bitcoin-uint256_tests.o test/test_test_bitcoin-univalue_tests.o test/test_test_bitcoin-util_tests.o test/test_test_bitcoin-sha256compress_tests.o test/test_test_bitcoin-accounting_tests.o wallet/test/test_test_bitcoin-wallet_tests.o  -L/mnt/build/depends/x86_64-w64-mingw32/share/../lib libbitcoin_server.a libbitcoin_cli.a libbitcoin_common.a libbitcoin_util.a crypto/libbitcoin_crypto.a univalue/.libs/libunivalue.a ./leveldb/libleveldb.a ./leveldb/libmemenv.a -lboost_filesystem -lboost_program_options -lboost_thread -lboost_chrono -lboost_unit_test_framework secp256k1/.libs/libsecp256k1.a /mnt/build/depends/x86_64-w64-mingw32/lib/libevent.a -L/mnt/build/depends/x86_64-w64-mingw32/lib libbitcoin_wallet.a -ldb_cxx-6.2 -lssl libzcash.a libzencash.a snark/libsnark.a /mnt/build/depends/x86_64-w64-mingw32/lib/libgmpxx.a /mnt/build/depends/x86_64-w64-mingw32/lib/libgmp.a -lboost_system -lcrypto /mnt/build/depends/x86_64-w64-mingw32/lib/libsodium.a -lrustzcash -lzendoo_mc /mnt/build/depends/x86_64-w64-mingw32/lib/libzmq.a -lssp -luserenv -lcrypt32 -liphlpapi -lshlwapi -lmswsock -lws2_32 -ladvapi32 -lrpcrt4 -luuid -loleaut32 -lole32 -lcomctl32 -lshell32 -lwinmm -lwinspool -lcomdlg32 -lgdi32 -luser32 -lkernel32 -lmingwthrd -pthread -fopenmp
libtool: link: /mnt/build/depends/x86_64-w64-mingw32/share/../native/bin/ccache x86_64-w64-mingw32-g++ -std=c++11 -Wformat -Wformat-security -Wstack-protector -fstack-protector-all -pipe -O2 -g -fopenmp -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Wreturn-type -pthread -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -static -o zen-gtest.exe gtest/zen_gtest-main.o gtest/zen_gtest-utils.o gtest/zen_gtest-tx_creation_utils.o gtest/zen_gtest-test_checktransaction.o gtest/zen_gtest-test_consensus.o gtest/zen_gtest-json_test_vectors.o gtest/zen_gtest-test_forkmanager.o gtest/zen_gtest-test_checkblockdelay.o wallet/gtest/zen_gtest-test_wallet_zkeys.o gtest/zen_gtest-test_tautology.o gtest/zen_gtest-test_checkblock.o gtest/zen_gtest-test_cumulativehash.o gtest/zen_gtest-test_deprecation.o gtest/zen_gtest-test_equihash.o gtest/zen_gtest-test_httprpc.o gtest/zen_gtest-test_joinsplit.o gtest/zen_gtest-test_keystore.o gtest/zen_gtest-test_libzcash_utils.o gtest/zen_gtest-test_noteencryption.o gtest/zen_gtest-test_mempool.o gtest/zen_gtest-test_merkletree.o gtest/zen_gtest-test_metrics.o gtest/zen_gtest-test_miner.o gtest/zen_gtest-test_pow.o gtest/zen_gtest-test_random.o gtest/zen_gtest-test_rpc.o gtest/zen_gtest-test_getblocktemplate.o gtest/zen_gtest-test_timedata.o gtest/zen_gtest-test_transaction.o gtest/zen_gtest-test_txid.o gtest/zen_gtest-test_validation.o gtest/zen_gtest-test_circuit.o gtest/zen_gtest-test_proofs.o gtest/zen_gtest-test_paymentdisclosure.o gtest/zen_gtest-test_relayforks.o gtest/zen_gtest-test_sidechain.o gtest/zen_gtest-test_sidechaintypes.o gtest/zen_gtest-test_sidechain_to_mempool.o gtest/zen_gtest-test_sidechain_events.o gtest/zen_gtest-test_sidechain_certificate_quality.o gtest/zen_gtest-test_sidechain_blocks.o gtest/zen_gtest-test_libzendoo.o gtest/zen_gtest-test_reindex.o gtest/zen_gtest-test_asyncproofverifier.o wallet/gtest/zen_gtest-test_wallet.o wallet/gtest/zen_gtest-test_wallet_cert.o wallet/gtest/zen_gtest-test_deadlock.o  -L/mnt/build/depends/x86_64-w64-mingw32/share/../lib -lgtest -lgmock libbitcoin_server.a libbitcoin_cli.a libbitcoin_common.a libbitcoin_util.a crypto/libbitcoin_crypto.a univalue/.libs/libunivalue.a ./leveldb/libleveldb.a ./leveldb/libmemenv.a -lboost_filesystem -lboost_program_options -lboost_thread -lboost_chrono -lboost_unit_test_framework secp256k1/.libs/libsecp256k1.a libbitcoin_zmq.a /mnt/build/depends/x86_64-w64-mingw32/lib/libzmq.a -L/mnt/build/depends/x86_64-w64-mingw32/lib libbitcoin_wallet.a -ldb_cxx-6.2 -lssl /mnt/build/depends/x86_64-w64-mingw32/lib/libevent.a libzcash.a libzencash.a snark/libsnark.a /mnt/build/depends/x86_64-w64-mingw32/lib/libgmpxx.a /mnt/build/depends/x86_64-w64-mingw32/lib/libgmp.a -lboost_system -lcrypto /mnt/build/depends/x86_64-w64-mingw32/lib/libsodium.a -lrustzcash -lzendoo_mc -lssp -luserenv -lcrypt32 -liphlpapi -lshlwapi -lmswsock -lws2_32 -ladvapi32 -lrpcrt4 -luuid -loleaut32 -lole32 -lcomctl32 -lshell32 -lwinmm -lwinspool -lcomdlg32 -lgdi32 -luser32 -lkernel32 -lmingwthrd -pthread -fopenmp
/mnt/build/depends/x86_64-w64-mingw32/share/../lib/libzendoo_mc.a(getrandom-ab38333cc7a9ecae.getrandom.e4w98cj7-cgu.0.rcgu.o):getrandom.e4w98cj7:(.text+0x502): undefined reference to `BCryptGenRandom'
collect2: error: ld returned 1 exit status
make[2]: *** [zcash/CreateJoinSplit.exe] Error 1
Makefile:2568: recipe for target 'zcash/CreateJoinSplit.exe' failed
/mnt/build/depends/x86_64-w64-mingw32/share/../lib/libzendoo_mc.a(getrandom-ab38333cc7a9ecae.getrandom.e4w98cj7-cgu.0.rcgu.o):getrandom.e4w98cj7:(.text+0x502): undefined reference to `BCryptGenRandom'
collect2: error: ld returned 1 exit status
Makefile:2712: recipe for target 'zen-tx.exe' failed
make[2]: *** [zen-tx.exe] Error 1
/mnt/build/depends/x86_64-w64-mingw32/share/../lib/libzendoo_mc.a(getrandom-ab38333cc7a9ecae.getrandom.e4w98cj7-cgu.0.rcgu.o):getrandom.e4w98cj7:(.text+0x502): undefined reference to `BCryptGenRandom'
collect2: error: ld returned 1 exit status
Makefile:2716: recipe for target 'zend.exe' failed
make[2]: *** [zend.exe] Error 1
/mnt/build/depends/x86_64-w64-mingw32/share/../lib/libzendoo_mc.a(getrandom-ab38333cc7a9ecae.getrandom.e4w98cj7-cgu.0.rcgu.o):getrandom.e4w98cj7:(.text+0x502): undefined reference to `BCryptGenRandom'
collect2: error: ld returned 1 exit status
make[2]: *** [test/test_bitcoin.exe] Error 1
Makefile:2550: recipe for target 'test/test_bitcoin.exe' failed
/mnt/build/depends/x86_64-w64-mingw32/share/../lib/libzendoo_mc.a(getrandom-ab38333cc7a9ecae.getrandom.e4w98cj7-cgu.0.rcgu.o):getrandom.e4w98cj7:(.text+0x502): undefined reference to `BCryptGenRandom'
collect2: error: ld returned 1 exit status
make[2]: *** [zen-gtest.exe] Error 1
Makefile:2692: recipe for target 'zen-gtest.exe' failed
make[2]: Leaving directory '/mnt/build/src'
make[1]: *** [all-recursive] Error 1
Makefile:6726: recipe for target 'all-recursive' failed
make[1]: Leaving directory '/mnt/build/src'
make: *** [all-recursive] Error 1
Makefile:642: recipe for target 'all-recursive' failed

Likely cause is this commit https://github.com/HorizenOfficial/zend_oo/commit/7711b866ab88df08ad27ff6b67fa7ce59345f23b#diff-59b4a951dacd180479ab66689d38de642c753eaf9c9910d1b28531127ebe3066, specifically updating depends/packages/crate_getrandom_z.mk.

objdump -x getrandom-ab38333cc7a9ecae.getrandom.e4w98cj7-cgu.0.rcgu.o | grep -i crypt of extracted ./depends/x86_64-w64-mingw32/lib/libzendoo_mc.a:

[ 45](sec  0)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 BCryptGenRandom
0000000000000502 R_X86_64_PC32     BCryptGenRandom

Google search points to the need of including bcrypt.h from MS SDK, but the MinGW or libboost alternatives would make more sense:

find / 2>&1 | grep bcrypt.h | xargs grep "BCryptGenRandom"
/mnt/build/depends/x86_64-w64-mingw32/include/boost/winapi/bcrypt.hpp:BCryptGenRandom(
/mnt/build/depends/x86_64-w64-mingw32/include/boost/winapi/bcrypt.hpp:using ::BCryptGenRandom;
/usr/share/mingw-w64/include/bcrypt.h:  NTSTATUS WINAPI BCryptGenRandom (BCRYPT_ALG_HANDLE hAlgorithm, PUCHAR pbBuffer, ULONG cbBuffer, ULONG dwFlags);
/usr/i686-w64-mingw32/include/bcrypt.h:  NTSTATUS WINAPI BCryptGenRandom (BCRYPT_ALG_HANDLE hAlgorithm, PUCHAR pbBuffer, ULONG cbBuffer, ULONG dwFlags);
/usr/x86_64-w64-mingw32/include/bcrypt.h:  NTSTATUS WINAPI BCryptGenRandom (BCRYPT_ALG_HANDLE hAlgorithm, PUCHAR pbBuffer, ULONG cbBuffer, ULONG dwFlags);