bitcoinknots / bitcoin

Bitcoin Knots enhanced Bitcoin node/wallet software
MIT License
199 stars 60 forks source link

Include cstdint in mempool_args.h #76

Closed AaronDewes closed 3 days ago

AaronDewes commented 1 month ago

Without this, builds fail on Alpine Linux 3.19.

luke-jr commented 1 month ago

Please provide the error so I can put this in the right branch

AaronDewes commented 1 month ago
#23 112.7 In file included from node/mempool_args.cpp:5:
#23 112.7 ./node/mempool_args.h:20:28: error: 'int32_t' was not declared in this scope
#23 112.7    20 | [[nodiscard]] util::Result<int32_t> ParseDustDynamicOpt(const std::string& optstr, unsigned int max_fee_estimate_blocks);
#23 112.7       |                            ^~~~~~~
#23 112.7 ./node/mempool_args.h:10:1: note: 'int32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
#23 112.7     9 | #include <util/result.h>
#23 112.7   +++ |+#include <cstdint>
#23 112.7    10 | 
#23 112.7 ./node/mempool_args.h:20:35: error: template argument 1 is invalid
#23 112.7    20 | [[nodiscard]] util::Result<int32_t> ParseDustDynamicOpt(const std::string& optstr, unsigned int max_fee_estimate_blocks);
#23 112.7       |                                   ^
#23 113.2   CXX      node/libbitcoin_node_a-mini_miner.o
#23 113.6 node/mempool_args.cpp:43:23: error: ambiguating new declaration of 'util::Result<int> ParseDustDynamicOpt(const std::string&, unsigned int)'
#23 113.6    43 | util::Result<int32_t> ParseDustDynamicOpt(const std::string& optstr, const unsigned int max_fee_estimate_blocks)
#23 113.6       |                       ^~~~~~~~~~~~~~~~~~~
#23 113.6 ./node/mempool_args.h:20:37: note: old declaration 'int ParseDustDynamicOpt(const std::string&, unsigned int)'
#23 113.6    20 | [[nodiscard]] util::Result<int32_t> ParseDustDynamicOpt(const std::string& optstr, unsigned int max_fee_estimate_blocks);
#23 113.6       |                                     ^~~~~~~~~~~~~~~~~~~
#23 113.7 node/mempool_args.cpp: In function 'util::Result<void> ApplyArgsManOptions(const ArgsManager&, const CChainParams&, kernel::MemPoolOptions&)':
#23 113.7 node/mempool_args.cpp:121:98: error: no matching function for call to 'ErrorString(const int&)'
#23 113.7   121 |             return util::Error{strprintf(_("Invalid mode for dustdynamic: %s"), util::ErrorString(parsed))};
#23 113.7       |                                                                                 ~~~~~~~~~~~~~~~~~^~~~~~~~
#23 113.7 In file included from ./node/mempool_args.h:9:
#23 113.7 ./util/result.h:81:15: note: candidate: 'template<class T> bilingual_str util::ErrorString(const Result<T>&)'
#23 113.7    81 | bilingual_str ErrorString(const Result<T>& result)
#23 113.7       |               ^~~~~~~~~~~
#23 113.7 ./util/result.h:81:15: note:   template argument deduction/substitution failed:
#23 113.7 node/mempool_args.cpp:121:98: note:   mismatched types 'const util::Result<T>' and 'const int'
#23 113.7   121 |             return util::Error{strprintf(_("Invalid mode for dustdynamic: %s"), util::ErrorString(parsed))};
#23 113.7       |                                                                                 ~~~~~~~~~~~~~~~~~^~~~~~~~
#23 113.7 node/mempool_args.cpp:123:42: error: invalid type argument of unary '*' (have 'int')
#23 113.7   123 |         mempool_opts.dust_relay_target = *parsed;
#23 113.7       |                                          ^~~~~~~
#23 113.9   CXX      node/libbitcoin_node_a-peerman_args.o
#23 114.2   CXX      node/libbitcoin_node_a-psbt.o
#23 114.2 make[2]: *** [Makefile:10617: node/libbitcoin_node_a-mempool_args.o] Error 1
#23 114.2 make[2]: *** Waiting for unfinished jobs....
#23 124.5 make[2]: Leaving directory '/bitcoin-26.1.knots20240325/src'
#23 124.5 make[1]: *** [Makefile:20055: check-recursive] Error 1
#23 124.5 make[1]: Leaving directory '/bitcoin-26.1.knots20240325/src'
AaronDewes commented 1 month ago

@luke-jr Any update on this?

levantah commented 1 month ago

Yes, it would be cool if the compilation worked on Alpine Linux. Bitcoin Core master (since 0.21 at least) compiles well so it is IMHO a regression of Knots.

doitwithnotepad commented 1 month ago

Same error here on Alpine 3.19, @luke-jr introduced here the same error he fixed in this release https://github.com/bitcoinknots/bitcoin/commit/8ecc5db33c7a8ec66b821c056ce6c5bf6bf499af

luke-jr commented 2 days ago

(Fixed in 26.1.knots20240513)