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

Build on macOS broken #36

Open
rien333 opened this issue Jan 13, 2018 · 3 comments
Open

Build on macOS broken #36

rien333 opened this issue Jan 13, 2018 · 3 comments

Comments

@rien333
Copy link

rien333 commented Jan 13, 2018

If I run make after having run cmake, I get the following error:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1045:13: error:
      no matching constructor for initialization of 'binder1st<std::__1::mem_fun1_t<void, Museek::PeerManager,
      NewNet::ClientSocket *> >'
    {return binder1st<__Operation>(__op, __x);}

#29 (comment) suggests that this has to do with the gcc on macOS, but setting both CC and CXX to the GNU gcc within cmake results in the same error. I think it rather seems to do with an error in an include file. #29 (comment) found a temporary workaround that involves uncommenting the erroneous lines, but is unsure of the consequences of this action, which sounds pretty scary to me. (maybe somebody can at least give some insights on what commenting this line will do) I am also not quite sure what lines exactly I have to comment out.

@ascl00
Copy link

ascl00 commented Feb 9, 2019

This appears to be a clang error, rather than OS specific, as it happens on FreeBSD as well. Note that depending on which version of OSX you are using, the "gcc" command is mapped to clang, so setting CC/CXX most likely has no affect for you.

The full error text is:

/usr/include/c++/v1/functional:1048:13: error: no matching constructor for initialization of 'binder1st >'
    {return binder1st<__Operation>(__op, __x);}
            ^                      ~~~~~~~~~
/root/museek-plus/./NewNet/nnevent.h:147:16: note: in instantiation of function template specialization 'std::__1::bind1st, Museek::PeerSocket *>' requested here
          std::bind1st(std::mem_fun(m_Method), m_Object)(t);
               ^
/root/museek-plus/./NewNet/nnevent.h:123:7: note: in instantiation of member function 'NewNet::Event::BoundCallback::operator()' requested
      here
      BoundCallback(ObjectType * object, MethodType method)
      ^
/root/museek-plus/./NewNet/nnevent.h:223:18: note: in instantiation of member function 'NewNet::Event::BoundCallback::BoundCallback'
      requested here
      return new BoundCallback(object, method);
                 ^
/root/museek-plus/./NewNet/nnevent.h:233:22: note: in instantiation of function template specialization 'NewNet::Event::bind' requested
      here
      return connect(bind(object, method));
                     ^
/root/museek-plus/museekd/peersocket.cpp:519:57: note: in instantiation of function template specialization 'NewNet::Event::connect'
      requested here
    m_CannotConnectOurselfCallback = cannotConnectEvent.connect(this, & PeerManager::onCannotConnectOurself);
                                                        ^
/usr/include/c++/v1/functional:1033:31: note: candidate constructor not viable: no known conversion from 'Museek::PeerSocket *const' to 'const typename mem_fun1_t::first_argument_type'
      (aka 'Museek::PeerManager *const') for 2nd argument
    _LIBCPP_INLINE_VISIBILITY binder1st(const __Operation& __x,
                              ^
/usr/include/c++/v1/functional:1025:28: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
class _LIBCPP_TEMPLATE_VIS binder1st
                           ^
/usr/include/c++/v1/functional:1025:28: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 2 were provided
1 error generated.
*** Error code 1

@ascl00
Copy link

ascl00 commented Feb 9, 2019

I am able to build successfully with a minor change, however I have not looked closely enough to determine if it is correct or not:

diff --git a/museekd/peersocket.cpp b/museekd/peersocket.cpp
index 8db1e8b..58796fb 100644
--- a/museekd/peersocket.cpp
+++ b/museekd/peersocket.cpp
@@ -516,7 +516,7 @@ Museek::PeerSocket::initiateOurself()
     HInitiate handshake(museekd()->server()->username(), type(), token());
     sendMessage(handshake.make_network_packet());
 
-    m_CannotConnectOurselfCallback = cannotConnectEvent.connect(this, & PeerManager::onCannotConnectOurself);
+    m_CannotConnectOurselfCallback = cannotConnectEvent.connect(museekd()->peers(), & PeerManager::onCannotConnectOurself);
 
     uint port = museekd()->peers()->peerFactory()->serverSocket()->listenPort();

@rien333
Copy link
Author

rien333 commented Feb 10, 2019

This appears to be a clang error, rather than OS specific, as it happens on FreeBSD as well. Note that depending on which version of OSX you are using, the "gcc" command is mapped to clang, so setting CC/CXX most likely has no affect for you.

For clarity, I am aware of this mapping and I specifically set CC to GNU gcc which I downloaded from homebrew. Still didn't work, and past instances of setting CC in this way have worked successfully.

Odd that it happens on FreeBSD as well, although macOS is somewhat BSD related.

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