facebook / wangle

Wangle is a framework providing a set of common client/server abstractions for building services in a consistent, modular, and composable way.
Apache License 2.0
3.05k stars 537 forks source link

Compilation problem in Ubuntu 14.04 with g++-4.9 #11

Closed redrattus closed 8 years ago

redrattus commented 8 years ago

I use the wangle version 0.13.0 and the folly version 0.57.0!

[ 20%] Building CXX object CMakeFiles/wangle.dir/acceptor/Acceptor.cpp.o In file included from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/Acceptor.h:14:0, from /home/junhosuh/workspace/wangle/wangle/acceptor/Acceptor.cpp:10: /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ConnectionManager.h: In instantiation of ‘static wangle::ConnectionManager::UniquePtr wangle::ConnectionManager::makeUnique(Args&& ...) [with Args = {folly::EventBase&, const std::chrono::duration<long int, std::ratio<1l, 1000l> >&, wangle::Acceptor}; wangle::ConnectionManager::UniquePtr = std::unique_ptr<wangle::ConnectionManager, folly::DelayedDestruction::Destructor>]’: /home/junhosuh/workspace/wangle/wangle/acceptor/Acceptor.cpp:87:54: required from here /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ConnectionManager.h:64:34: error: no matching function for call to ‘makeunique(folly::EventBase&, const std::chrono::duration<long int, std::ratio<1l, 1000l> >&, wangle::Acceptor_)’ std::forward(args)...); ^ /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ConnectionManager.h:64:34: note: candidates are: In file included from /usr/local/include/folly/io/Cursor.h:31:0, from /usr/local/include/folly/io/async/AsyncSSLSocket.h:32, from /home/junhosuh/workspace/wangle/wangle/../wangle/ssl/SSLUtil.h:14, from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ServerSocketConfig.h:15, from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/Acceptor.h:12, from /home/junhosuh/workspace/wangle/wangle/acceptor/Acceptor.cpp:10: /usr/local/include/folly/Memory.h:48:1: note: template<class T, class ... Args> typename std::enable_if<(! std::is_array< >::value), std::unique_ptr >::type folly::make_unique(Args&& ...) makeunique(Args&&... args) { ^ /usr/local/include/folly/Memory.h:48:1: note: template argument deduction/substitution failed: In file included from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/Acceptor.h:14:0, from /home/junhosuh/workspace/wangle/wangle/acceptor/Acceptor.cpp:10: /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ConnectionManager.h:64:34: note: cannot convert ‘std::forwardfolly::EventBase&((\ & args#0))’ (type ‘folly::EventBase’) to type ‘folly::DelayedDestruction::Destructor&&’ std::forward(args)...); ^ In file included from /usr/local/include/folly/io/Cursor.h:31:0, from /usr/local/include/folly/io/async/AsyncSSLSocket.h:32, from /home/junhosuh/workspace/wangle/wangle/../wangle/ssl/SSLUtil.h:14, from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ServerSocketConfig.h:15, from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/Acceptor.h:12, from /home/junhosuh/workspace/wangle/wangle/acceptor/Acceptor.cpp:10: /usr/local/include/folly/Memory.h:55:1: note: template typename std::enable_if<std::is_array< >::value, std::unique_ptr >::type folly::make_unique(size_t) make_unique(const size_t n) { ^ /usr/local/include/folly/Memory.h:55:1: note: template argument deduction/substitution failed: In file included from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/Acceptor.h:14:0, from /home/junhosuh/workspace/wangle/wangle/acceptor/Acceptor.cpp:10: /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ConnectionManager.h:64:34: error: wrong number of template arguments (2, should be 1) std::forward(args)...); ^ In file included from /usr/local/include/folly/io/Cursor.h:31:0, from /usr/local/include/folly/io/async/AsyncSSLSocket.h:32, from /home/junhosuh/workspace/wangle/wangle/../wangle/ssl/SSLUtil.h:14, from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ServerSocketConfig.h:15, from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/Acceptor.h:12, from /home/junhosuh/workspace/wangle/wangle/acceptor/Acceptor.cpp:10: /usr/local/include/folly/Memory.h:63:1: note: template<class T, class ... Args> typename std::enable_if<(std::extent<_Tp>::value != 0), std::unique_ptr >::type folly::make_unique(Args&& ...) make_unique(Args&&...) = delete; ^ /usr/local/include/folly/Memory.h:63:1: note: template argument deduction/substitution failed: /usr/local/include/folly/Memory.h: In substitution of ‘template<class T, class ... Args> typename std::enable_if<(std::extent<_Tp>::value != 0), std::unique_ptr >::type folly::makeunique(Args&& ...) [with T = wangle::ConnectionManager; Args = {folly::DelayedDestruction::Destructor}]’: /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ConnectionManager.h:64:34: required from ‘static wangle::ConnectionManager::UniquePtr wangle::ConnectionManager::makeUnique(Args&& ...) [with Args = {folly::EventBase&, const std::chrono::duration<long int, std::ratio<1l, 1000l> >&, wangle::Acceptor_}; wangle::ConnectionManager::UniquePtr = std::unique_ptr<wangle::ConnectionManager, folly::DelayedDestruction::Destructor>]’ /home/junhosuh/workspace/wangle/wangle/acceptor/Acceptor.cpp:87:54: required from here /usr/local/include/folly/Memory.h:63:1: error: no type named ‘type’ in ‘struct std::enable_if<false, std::unique_ptr<wangle::ConnectionManager, std::defaultdelete > >’ make[2]: ** [CMakeFiles/wangle.dir/acceptor/Acceptor.cpp.o] Error 1 make[1]: * [CMakeFiles/wangle.dir/all] Error 2 make: * [all] Error 2

tomsercu commented 8 years ago

I have the same issue installing wangle on a RHEL6 system, using gcc 4.9. I have folly @ cef5789. This occurs both when compiling with the default -std=c++0x (giving the error just like above), and with -std=c++14 in CMakeLists.txt it will indicate it is trying to use make_unique from _gcc-4.9.2_rhel6/include/c++/4.9.2/bits/uniqueptr.h, however the error remains the same.

tomsercu commented 8 years ago

No answer from JunhoSuh or the developers. The error comes from the fact that old versions of folly had a non-standard make_unique that takes 2 template arguments. This is now removed, presumable so that make_unique follows the std::make_unique in c++14. You can work around it like this (in acceptor/ConnectionManager.h)

  template<typename... Args>
  static UniquePtr makeUnique(Args&&... args) {
    //return folly::make_unique<ConnectionManager, Destructor>(
    //  std::forward<Args>(args)...);
    return std::unique_ptr<ConnectionManager, Destructor>(
      new ConnectionManager(std::forward<Args>(args)...));
  }
fugalh commented 8 years ago

This is due to repositories being out of sync (folly and wangle).

On Wed, Oct 21, 2015 at 3:48 PM Tom Sercu notifications@github.com wrote:

No answer from JunhoSuh or the developers. The error comes from the fact that old versions of folly had a non-standard make_unique that takes 2 template arguments. This is now removed, presumable so that make_unique follows the std::make_unique in c++14. You can work around it like this (in acceptor/ConnectionManager.h)

template static UniquePtr makeUnique(Args&&... args) { //return folly::make_unique<ConnectionManager, Destructor>( // std::forward(args)...); return std::unique_ptr<ConnectionManager, Destructor>( new ConnectionManager(std::forward(args)...)); }

— Reply to this email directly or view it on GitHub https://github.com/facebook/wangle/issues/11#issuecomment-150046209.