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

Cannot compile with uClibc++ #993

Closed
neheb opened this issue Aug 3, 2019 · 8 comments
Closed

Cannot compile with uClibc++ #993

neheb opened this issue Aug 3, 2019 · 8 comments

Comments

@neheb
Copy link
Contributor

neheb commented Aug 3, 2019

I have tried to compile zerotier with uClibc++(C++98 library) instead of libstdcpp. It's failing as the algorithm header requires a missing operator. Here is the output:

In file included from node/Multicaster.cpp:27:
/home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/algorithm: In instantiation of 'ForwardIterator std::lower_bound(ForwardIterator, ForwardIterator, const T&, Compare) [with ForwardIterator = ZeroTier::Multicaster::MulticastGroupMember*; T = ZeroTier::Address; Compare = std::less<ZeroTier::Multicaster::MulticastGroupMember>]':
/home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/algorithm:945:21:   required from 'ForwardIterator std::lower_bound(ForwardIterator, ForwardIterator, const T&) [with ForwardIterator = ZeroTier::Multicaster::MulticastGroupMember*; T = ZeroTier::Address]'
node/Multicaster.cpp:427:107:   required from here
/home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/algorithm:956:11: error: no match for call to '(std::less<ZeroTier::Multicaster::MulticastGroupMember>) (ZeroTier::Multicaster::MulticastGroupMember&, const ZeroTier::Address&)'
  956 |   if( comp(*first, value) == false){
      |       ~~~~^~~~~~~~~~~~~~~
In file included from /home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/algorithm:21,
                 from node/Multicaster.cpp:27:
/home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/functional:146:8: note: candidate: 'bool std::less<T>::operator()(const T&, const T&) const [with T = ZeroTier::Multicaster::MulticastGroupMember]'
  146 |   bool operator()(const T& x, const T& y) const _UCXX_NOTHROW {
      |        ^~~~~~~~
/home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/functional:146:40: note:   no known conversion for argument 2 from 'const ZeroTier::Address' to 'const ZeroTier::Multicaster::MulticastGroupMember&'
  146 |   bool operator()(const T& x, const T& y) const _UCXX_NOTHROW {
      |                               ~~~~~~~~~^
In file included from node/Multicaster.cpp:27:
/home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/algorithm:964:11: error: no match for call to '(std::less<ZeroTier::Multicaster::MulticastGroupMember>) (ZeroTier::Multicaster::MulticastGroupMember&, const ZeroTier::Address&)'
  964 |   if( comp(*middle, value) ){
      |       ~~~~^~~~~~~~~~~~~~~~
In file included from /home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/algorithm:21,
                 from node/Multicaster.cpp:27:
/home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/functional:146:8: note: candidate: 'bool std::less<T>::operator()(const T&, const T&) const [with T = ZeroTier::Multicaster::MulticastGroupMember]'
  146 |   bool operator()(const T& x, const T& y) const _UCXX_NOTHROW {
      |        ^~~~~~~~
/home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/functional:146:40: note:   no known conversion for argument 2 from 'const ZeroTier::Address' to 'const ZeroTier::Multicaster::MulticastGroupMember&'
  146 |   bool operator()(const T& x, const T& y) const _UCXX_NOTHROW {
      |                               ~~~~~~~~~^
In file included from node/Multicaster.cpp:27:
/home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/algorithm:973:13: error: no match for call to '(std::less<ZeroTier::Multicaster::MulticastGroupMember>) (ZeroTier::Multicaster::MulticastGroupMember&, const ZeroTier::Address&)'
  973 |    if( !comp(*middle, value) ){
      |         ~~~~^~~~~~~~~~~~~~~~
In file included from /home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/algorithm:21,
                 from node/Multicaster.cpp:27:
/home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/functional:146:8: note: candidate: 'bool std::less<T>::operator()(const T&, const T&) const [with T = ZeroTier::Multicaster::MulticastGroupMember]'
  146 |   bool operator()(const T& x, const T& y) const _UCXX_NOTHROW {
      |        ^~~~~~~~
/home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/functional:146:40: note:   no known conversion for argument 2 from 'const ZeroTier::Address' to 'const ZeroTier::Multicaster::MulticastGroupMember&'
  146 |   bool operator()(const T& x, const T& y) const _UCXX_NOTHROW {
      |                               ~~~~~~~~~^
In file included from node/Multicaster.cpp:27:
/home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/algorithm:980:12: error: no match for call to '(std::less<ZeroTier::Multicaster::MulticastGroupMember>) (ZeroTier::Multicaster::MulticastGroupMember&, const ZeroTier::Address&)'
  980 |   if( !comp(*first, value) ){
      |        ~~~~^~~~~~~~~~~~~~~
In file included from /home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/algorithm:21,
                 from node/Multicaster.cpp:27:
/home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/functional:146:8: note: candidate: 'bool std::less<T>::operator()(const T&, const T&) const [with T = ZeroTier::Multicaster::MulticastGroupMember]'
  146 |   bool operator()(const T& x, const T& y) const _UCXX_NOTHROW {
      |        ^~~~~~~~
/home/mangix/devstuff/openwrt/staging_dir/target-armeb_xscale_musl/usr/include/uClibc++/functional:146:40: note:   no known conversion for argument 2 from 'const ZeroTier::Address' to 'const ZeroTier::Multicaster::MulticastGroupMember&'
  146 |   bool operator()(const T& x, const T& y) const _UCXX_NOTHROW {
      |                               ~~~~~~~~~^
<builtin>: recipe for target 'node/Multicaster.o' failed
@adamierymenko
Copy link
Contributor

Isn't this a bug in uclibc++? It works against libc++ (clang), whatever Microsoft uses with VC++, and libstdc++ (GNU).

@neheb
Copy link
Contributor Author

neheb commented Aug 4, 2019

Not exactly. In its algorithm implementation, uClibc++ requires an operator that ZeroTierOne is not providing. My C++ is not good enough to figure this one out.

An example with a different program would be: morgenroth/ibrdtn@008c385

adamierymenko added a commit that referenced this issue Aug 4, 2019
@adamierymenko
Copy link
Contributor

Does that commit to dev fix it?

@neheb
Copy link
Contributor Author

neheb commented Aug 4, 2019

It does not.

It's not a != operator that's missing. It's something else. The patch i linked to errored with this: openwrt/packages#7822

Note the != there. Here, the error is different:

error: no match for call to '(std::lessZeroTier::Multicaster::MulticastGroupMember) (ZeroTier::Multicaster::MulticastGroupMember&, const ZeroTier::Address&)'

adamierymenko added a commit that referenced this issue Aug 4, 2019
@adamierymenko
Copy link
Contributor

Ahh, I think I might have it now. Try it. Don't have a uclibc++ build environment so I can't test.

@neheb
Copy link
Contributor Author

neheb commented Aug 4, 2019

Same error.

@neheb
Copy link
Contributor Author

neheb commented Aug 4, 2019

I tried changing line 427, which is the line that errors. Maybe this provides a clue?

node/Multicaster.cpp:427:48: error: cannot convert 'const ZeroTier::Address' to 'std::vector<ZeroTier::Multicaster::MulticastGroupMember>::iterator' {aka 'ZeroTier::Multicaster::MulticastGroupMember*'} in initialization
  427 |  std::vector<MulticastGroupMember>::iterator m(member);
      |                                                ^~~~~~
      |                                                |
      |                                                const ZeroTier::Address

@neheb
Copy link
Contributor Author

neheb commented Aug 4, 2019

I got it to proceed with this change (yes I know, totally wrong):

-       std::vector<MulticastGroupMember>::iterator m(std::lower_bound(gs.members.begin(),gs.members.end(),member));
+       std::vector<MulticastGroupMember>::iterator m(gs.members.end());

but then it started throwing some C++11 headers. No dice.

@neheb neheb closed this as completed Aug 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants