Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility with Boost 1.78 #3815

Merged

Conversation

pwojcikdev
Copy link
Contributor

@pwojcikdev pwojcikdev commented May 11, 2022

This PR fixes build errors when building node with Boost version 1.78 and later with AppleClang 13.1.6. Boost 1.78 already provides conversions between boost::system::error_code and std::error_code.

@pwojcikdev
Copy link
Contributor Author

Compilation errors with current code:

In file included from /Users/piotr/Work/nano-node-dev/nano/lib/diagnosticsconfig.cpp:1:
In file included from /Users/piotr/Work/nano-node-dev/nano/lib/diagnosticsconfig.hpp:3:
/Users/piotr/Work/nano-node-dev/nano/lib/errors.hpp:211:8: error: explicit specialization of 'std::is_error_code_enumboost::system::errc::errc_t' after instantiation
struct is_error_code_enumboost::system::errc::errc_t
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/include/boost/system/detail/error_code.hpp:113:21: note: implicit instantiation first required here
|| std::is_error_code_enum::value
^
In file included from /Users/piotr/Work/nano-node-dev/nano/lib/diagnosticsconfig.cpp:2:
In file included from /Users/piotr/Work/nano-node-dev/nano/lib/tomlconfig.hpp:3:
/Users/piotr/Work/nano-node-dev/nano/lib/configbase.hpp:84:11: error: use of overloaded operator '=' is ambiguous (with operand types 'nano::error' and 'nano::error_config')
*error = error_a;
~~~~~~ ^ ~~~~~~~
/Users/piotr/Work/nano-node-dev/nano/lib/tomlconfig.hpp:186:6: note: in instantiation of function template specialization 'nano::configbase::conditionally_set_error<unsigned long, nano::error_config>' requested here
conditionally_set_error (nano::error_config::invalid_value, optional, key);
^
/Users/piotr/Work/nano-node-dev/nano/lib/tomlconfig.hpp:120:3: note: in instantiation of function template specialization 'nano::tomlconfig::get_config<unsigned long, void>' requested here
get_config (true, key, target, target);
^
/Users/piotr/Work/nano-node-dev/nano/lib/diagnosticsconfig.cpp:22:19: note: in instantiation of function template specialization 'nano::tomlconfig::get_optional' requested here
txn_tracking_l->get_optional ("min_read_txn_time", min_read_txn_time_l);
^
/Users/piotr/Work/nano-node-dev/nano/lib/errors.hpp:252:10: note: candidate function
error & operator= (std::error_code code_a);
^
/Users/piotr/Work/nano-node-dev/nano/lib/errors.hpp:253:10: note: candidate function
error & operator= (boost::system::error_code const & code_a);
^

In file included from /Users/piotr/Work/nano-node-dev/nano/lib/epoch.cpp:1:
In file included from /Users/piotr/Work/nano-node-dev/nano/lib/epoch.hpp:3:
/Users/piotr/Work/nano-node-dev/nano/lib/numbers.hpp:360:8: error: no template named 'hash'; did you mean 'std::hash'?
struct hash<std::reference_wrapper<::nano::block_hash const>>
^~~~
std::hash
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1710:50: note: 'std::hash' declared here
template struct _LIBCPP_TEMPLATE_VIS hash;
^
In file included from /Users/piotr/Work/nano-node-dev/nano/lib/epoch.cpp:1:
In file included from /Users/piotr/Work/nano-node-dev/nano/lib/epoch.hpp:3:
/Users/piotr/Work/nano-node-dev/nano/lib/numbers.hpp:360:8: error: class template specialization of 'hash' not in a namespace enclosing '__1'
struct hash<std::reference_wrapper<::nano::block_hash const>>
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1710:50: note: explicitly specialized declaration is here
template struct _LIBCPP_TEMPLATE_VIS hash;
^

@clemahieu
Copy link
Contributor

Confirmed the existing error but I get a build error with this branch:

/Users/clemahieu/nano-node.src/nano/core_test/toml.cpp:345:30: error: use of overloaded operator '==' is ambiguous (with operand types 'nano::error' and 'nano::error_config')
ASSERT_TRUE (t.get_error () == nano::error_config::missing_value);

@pwojcikdev pwojcikdev force-pushed the prs/boost-1-78-compatibility branch 2 times, most recently from c56057c to 52da476 Compare May 19, 2022 13:49
@pwojcikdev
Copy link
Contributor Author

Those build errors are fixed now.

@pwojcikdev pwojcikdev closed this May 19, 2022
@pwojcikdev pwojcikdev reopened this May 19, 2022
@pwojcikdev pwojcikdev force-pushed the prs/boost-1-78-compatibility branch from 52da476 to 532915d Compare May 19, 2022 17:05
@clemahieu clemahieu merged commit 64db0ab into nanocurrency:develop Jul 21, 2022
dsiganos pushed a commit to dsiganos/nano-node that referenced this pull request Oct 19, 2022
dsiganos pushed a commit to dsiganos/nano-node that referenced this pull request Oct 19, 2022
dsiganos pushed a commit to dsiganos/nano-node that referenced this pull request Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants