Skip to content

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

Closed

Description

@redrattus

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 ‘make_unique(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&& ...)
make_unique(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::make_unique(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::default_deletewangle::ConnectionManager > >’
make[2]: *_* [CMakeFiles/wangle.dir/acceptor/Acceptor.cpp.o] Error 1
make[1]: *** [CMakeFiles/wangle.dir/all] Error 2
make: *** [all] Error 2

Activity

  1. tomsercu commented on Oct 14, 2015

    @tomsercu

    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/unique_ptr.h, however the error remains the same.

  2. tomsercu commented on Oct 21, 2015

    @tomsercu

    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)...));
      }
    
  3. fugalh commented on Oct 24, 2015

    @fugalh
    Contributor

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

    On Wed, Oct 21, 2015 at 3:48 PM Tom Sercu [email protected] 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<typename... Args>
    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
    #11 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions