NuRaft icon indicating copy to clipboard operation
NuRaft copied to clipboard

Windows build error: 'executor_type': is not a member of 'mock_ssl_socket'

Open marcusolini opened this issue 3 years ago • 1 comments

When following the 'How to Build' procedures for Windows the below compilation errors are encountered.

A basic observation is that mock_ssl_socket is not a stream template like asio::ssl::stream which is expected by the read and write template.

Perhaps this issue should be posted to the asio repository?

When able, please advise.

COMPILE ERRORS \NuRaft\asio\asio\include\asio/impl/read.hpp(504): error C2039: 'executor_type': is not a member of 'mock_ssl_socket' \NuRaft\asio\asio\include\asio/impl/read.hpp(504): error C3646: 'executor_type': unknown override specifier \NuRaft\asio\asio\include\asio/impl/write.hpp(469): error C2039: 'executor_type': is not a member of 'mock_ssl_socket' \NuRaft\asio\asio\include\asio/impl/write.hpp(469): error C3646: 'executor_type': unknown override specifier

ASIO_SERVICE.CXX #ifdef SSL_LIBRARY_NOT_FOUND #include "mock_ssl.hxx" using ssl_socket = mock_ssl_socket; using ssl_context = mock_ssl_context; #else #include "asio/ssl.hpp" using ssl_socket = asio::ssl::streamasio::ip::tcp::socket&; using ssl_context = asio::ssl::context; #endif

DETAIL EXCERPT |Tue 07/27/2021|11:31|D:\B\NuRaft\build> nmake

Microsoft (R) Program Maintenance Utility Version 14.29.30038.1 Copyright (C) Microsoft Corporation. All rights reserved.

[ 1%] Building CXX object CMakeFiles/RAFT_CORE_OBJ.dir/src/asio_service.cxx.obj asio_service.cxx Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:

  • add -D_WIN32_WINNT=0x0601 to the compiler command line; or
  • add _WIN32_WINNT=0x0601 to your project's Preprocessor Definitions. Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target). D:\B\NuRaft\asio\asio\include\asio/impl/read.hpp(504): error C2039: 'executor_type': is not a member of 'mock_ssl_socket' ...

marcusolini avatar Jul 28 '21 19:07 marcusolini

Thanks for reporting this. It is caused by the Asio version, please fetch the right version described in the revised readme in this PR. https://github.com/eBay/NuRaft/pull/240

Also, there is another compile error due to a missing header. The Above PR will fix it.

greensky00 avatar Jul 30 '21 22:07 greensky00

This is still happening in NuRaft 2.1.0. The fix is simply to add typedef typename lowest_layer_type::executor_type executor_type; in mock_ssl.hxx below line 31 that is using lowest_layer_type = asio::ip::tcp::socket;

@greensky00, it looks like it was changed in master with using executor_type = int;. and that builds too.

Laters, SLDR

sldr avatar Aug 27 '23 02:08 sldr

@sldr so change them to

    using lowest_layer_type = asio::ip::tcp::socket;
    using executor_type = lowest_layer_type::executor_type;

works, correct?

greensky00 avatar Aug 27 '23 06:08 greensky00

works, correct?

Yes, the 2 using lines work too.

Essentially the same. You prefer using. I just took the typedef ... line from asio stream.hpp file for asio::ssl::stream class.

sldr avatar Aug 27 '23 19:08 sldr