socketio / socket.io-client-cpp

C++11 implementation of Socket.IO client
MIT License
2.26k stars 730 forks source link

error: ‘SSL_R_SHORT_READ’ was not declared in this scope #187

Open Stupid-Git opened 6 years ago

Stupid-Git commented 6 years ago

On Debian 9 64bit I installed Boost using
# apt-get install boost-all-dev
I ran cmake as follows
$ cmake -DBOOST_INCLUDEDIR=/usr/include/boost -DBOOST_LIBRARYDIR=/usr/lib/x86_64-linux-gnu -DBOOST_VER:STRING=1.62 ./
and then ran
$ make install _Scanning dependencies of target sioclient [ 10%] Building CXX object CMakeFiles/sioclient.dir/src/sio_client.cpp.o [ 20%] Building CXX object CMakeFiles/sioclient.dir/src/sio_socket.cpp.o [ 30%] Building CXX object CMakeFiles/sioclient.dir/src/internal/sio_client_impl.cpp.o [ 40%] Building CXX object CMakeFiles/sioclient.dir/src/internal/sio_packet.cpp.o [ 50%] Linking CXX static library libsioclient.a [ 50%] Built target sioclient Scanning dependencies of target sioclient_tls [ 60%] Building CXX object CMakeFiles/sioclient_tls.dir/src/sio_client.cpp.o In file included from /disk_d/share/w/github/socketio/socket.io-client-cpp/lib/websocketpp/websocketpp/config/asio_client.hpp:33:0, from /disk_d/share/w/github/socketio/socket.io-client-cpp/src/internal/sio_client_impl.h:26, from /disk_d/share/w/github/socketio/socket.io-client-cpp/src/sio_client.cpp:8: /disk_d/share/w/github/socketio/socket.io-client-cpp/lib/websocketpp/websocketpp/transport/asio/security/tls.hpp: In member function ‘std::error_code websocketpp::transport::asio::tls_socket::connection::translate_ec(boost::system::error_code)’: /disk_d/share/w/github/socketio/socket.io-client-cpp/lib/websocketpp/websocketpp/transport/asio/security/tls.hpp:310:47: error: ‘SSL_R_SHORT_READ’ was not declared in this scope if (ERR_GET_REASON(ec.value()) == SSL_R_SHORT_READ) { ^~~~ CMakeFiles/sioclient_tls.dir/build.make:62: recipe for target 'CMakeFiles/sioclient_tls.dir/src/sio_client.cpp.o' failed make[2]: [CMakeFiles/sioclient_tls.dir/src/sio_client.cpp.o] Error 1 CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/sioclient_tls.dir/all' failed make[1]: [CMakeFiles/sioclienttls.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *** [all] Error 2 $ I made the following changes around line 310 of ./lib/websocketpp/websocketpp/transport/asio/security/tls.hpp
**_#if BOOST_VERSION >= 106200 if (ec.value() == boost::asio::ssl::error::stream_truncated) {

else // older Boost supports only OpenSSL 1.0, so 1.0-only macros are appropriate

        if (ERR_GET_REASON(ec.value()) == SSL_R_SHORT_READ) {

endif_**

and cmake passed.

This is of course an issue in websocketpp (which many have been "fixed" already), but for those of you lowly hardware engineers like myself, I offer this as a quick and dirty fix.

fsegouin commented 6 years ago

Encountered the same issue today so little bump to this so others can quickly find a fix to the issue. Other solution for the less adventurous of us would be to stick with libssl1.0-dev.

DraconPern commented 5 years ago

I was bitten by this bug trying to compile on ubuntu18.04. Since this library doesn't seem to be maintained, I suggest looking into boost.beast.

xerdink commented 3 years ago

you are right, it is an issue with OpenSSL and Boost.

thank you.