New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<asio/ssl/error.hpp> depends on include order (fails with OpenSSL 1.1.0) #184

Closed
jwakely opened this Issue Feb 13, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@jwakely

jwakely commented Feb 13, 2017

A file containing just this line fails to compile against OpenSSL 1.1.0:

#include <boost/asio/ssl/error.hpp>

The error is:

 g++ -c os.cc
In file included from os.cc:1:0:
/usr/include/boost/asio/ssl/error.hpp:48:31: error: ‘ERR_LIB_SSL’ was not declared in this scope
   stream_truncated = ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ)
                               ^~~~~~~~~~~
/usr/include/boost/asio/ssl/error.hpp:48:47: error: ‘SSL_R_SHORT_READ’ was not declared in this scope
   stream_truncated = ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ)
                                               ^~~~~~~~~~~~~~~~
/usr/include/boost/asio/ssl/error.hpp:48:47: note: suggested alternative: ‘SSL_F_SSL_READ’
   stream_truncated = ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ)
                                               ^~~~~~~~~~~~~~~~
                                               SSL_F_SSL_READ
/usr/include/boost/asio/ssl/error.hpp:48:22: error: ‘ERR_PACK’ was not declared in this scope
   stream_truncated = ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ)
                      ^~~~~~~~

This happens because <asio/ssl/error.hpp> uses OPENSSL_VERSION_NUMBER without including <openssl/opensslv.h> (or any other OpenSSL header) and so OPENSSL_VERSION_NUMBER is not defined, so the #if check is true when it shouldn't be. If you include <asio/ssl/error.hpp> after <asio/ssl.hpp> it works fine.

Is including just that header (without, or before, other <asio/ssl*> headers) supported?

@chriskohlhoff

This comment has been minimized.

Owner

chriskohlhoff commented Mar 5, 2017

Fixed on master in 1ea732c. Fix on asio-1-10-branch in 73ca3af.

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