marian-nmt / marian

Fast Neural Machine Translation in C++
https://marian-nmt.github.io
Other
1.22k stars 228 forks source link

Marian server compilation fails - Boost error #340

Closed MickHardins closed 4 years ago

MickHardins commented 4 years ago

Bug description

Hello, I'm trying to compile marian from source but I get some errors if I try to compile marian server. Without the flag cmake .. -DCOMPILE_SERVER:BOOL=ONeverything is smooth. When compiling marian with the flag cmake .. -DCOMPILE_SERVER:BOOL=ON the compilation fails with the following errors:

In file included from /home//marian/src/command/marian_server.cpp:7: /home//marian/src/3rd_party/simple-websocket-server/server_ws.hpp: In instantiation of ‘SimpleWeb::SocketServerBase::Connection::Connection(std::shared_ptr, long int, Args&& ...) [with Args = {boost::asio::io_context&}; socket_type = boost::asio::basic_stream_socket]’: /home//marian/src/3rd_party/simple-websocket-server/server_ws.hpp:802:109: required from here /home//marian/src/3rd_party/simple-websocket-server/server_ws.hpp:155:153: error: ‘class boost::asio::basic_stream_socket’ has no member named ‘get_io_service’ : handler_runner(std::move(handler_runner)), socket(new socket_type(std::forward(args)...)), timeout_idle(timeout_idle), strand(socket->get_io_service()), closed(false) {}


/home//marian/src/3rd_party/simple-websocket-server/server_ws.hpp: In instantiation of ‘void SimpleWeb::SocketServerBase<socket_type>::Connection::set_timeout(long int) [with socket_type = boost::asio::basic_stream_socket<boost::asio::ip::tcp>]’:
/home//marian/src/3rd_party/simple-websocket-server/server_ws.hpp:525:7:   required from ‘void SimpleWeb::SocketServerBase<socket_type>::read_handshake(const std::shared_ptr<SimpleWeb::SocketServerBase<socket_type>::Connection>&) [with socket_type = boost::asio::basic_stream_socket<boost::asio::ip::tcp>]’
/home//marian/src/3rd_party/simple-websocket-server/server_ws.hpp:816:36:   required from here
/home//marian/src/3rd_party/simple-websocket-server/server_ws.hpp:190:84: error: ‘class boost::asio::basic_stream_socket<boost::asio::ip::tcp>’ has no member named ‘get_io_service’
         timer = std::unique_ptr<asio::steady_timer>(new asio::steady_timer(socket->get_io_service()));
                                                                            ~~~~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/boost/asio/steady_timer.hpp:22,
                 from /usr/include/boost/asio/basic_socket_streambuf.hpp:36,
                 from /usr/include/boost/asio/basic_socket_iostream.hpp:24,
                 from /usr/include/boost/asio.hpp:33,
                 from /home//marian/src/3rd_party/simple-websocket-server/server_ws.hpp:50,
                 from /home//marian/src/command/marian_server.cpp:7:
/usr/include/boost/asio/basic_waitable_timer.hpp:698:3: error: ‘typename boost::asio::async_result<typename std::decay<_U1>::type, void(boost::system::error_code)>::return_type boost::asio::basic_waitable_timer<Clock, WaitTraits, Executor>::async_wait(WaitHandler&&) [with WaitHandler = SimpleWeb::SocketServerBase<socket_type>::Connection::set_timeout(long int) [with socket_type = boost::asio::basic_stream_socket<boost::asio::ip::tcp>]::<lambda(const error_code&)>; Clock = std::chrono::_V2::steady_clock; WaitTraits = boost::asio::wait_traits<std::chrono::_V2::steady_clock>; Executor = boost::asio::executor; typename boost::asio::async_result<typename std::decay<_U1>::type, void(boost::system::error_code)>::return_type = void]’, declared using local type ‘SimpleWeb::SocketServerBase<socket_type>::Connection::set_timeout(long int) [with socket_type = boost::asio::basic_stream_socket<boost::asio::ip::tcp>]::<lambda(const error_code&)>’, is used but never defined [-fpermissive]
   async_wait(BOOST_ASIO_MOVE_ARG(WaitHandler) handler)
   ^~~~~~~~~~
cc1plus: error: unrecognized command line option ‘-Wno-unknown-warning-option’ [-Werror]
cc1plus: all warnings being treated as errors
make[2]: *** [src/CMakeFiles/marian_server.dir/build.make:63: src/CMakeFiles/marian_server.dir/command/marian_server.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:215: src/CMakeFiles/marian_server.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

How to reproduce

Context

Other information about the problem here: OS: Ubuntu 20.04 GCC version: 8 (tried with suggested version but build fails with gcc 9.3)

I Installed the suggested libraries from documentation website:

sudo apt-get install git cmake build-essential libboost-all-dev libprotobuf17 protobuf-compiler libprotobuf-dev openssl libssl-dev libgoogle-perftools-dev

snukky commented 4 years ago

What version of Boost do you have? I think for this version of Marian it needs to be <=1.69.

MickHardins commented 4 years ago

My Boost version is 1.71, where can I see the required Boost versions?

MickHardins commented 4 years ago

What version of Boost do you have? I think for this version of Marian it needs to be <=1.69.

This solved the issue, I successfully compiled also the server.

To summarize, in order to compile latest Marian with marian server on ubuntu 20.04:

snukky commented 4 years ago

Thanks for confirming this! The recent version from marian-dev should also work with GCC 9.3, CUDA 10.2 and Boost 1.72. CUDA <10.2 requires GCC 8 or lower (the GCC/CUDA compatibility table).

dbuijs commented 3 years ago

Any update on when this will be merged into main? CMakeLists.txt forces the system version of Boost to be used, so it's not straightforward to override with a flag.

snukky commented 3 years ago

It is in marian-dev already.