eidheim / Simple-Web-Server

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.
MIT License
2.61k stars 751 forks source link

x32 libs and x64 includes #210

Open Natulux opened 6 years ago

Natulux commented 6 years ago

Hey, first let me thank you for your work here! It is quite nice, really. :-)

However, I took the master from 8. Jan 2018, used cmake 3.10.0 to get project files for Visual Studio 2015 under Win10x64. I used your HTTPS sample and compiled it with boost_1_65_1 libraries and it workes quite fine. I realized only later, that I automatically have x32-dynamic libraries linked (32MT.lib is not a problem, though): C:\OpenSSL-Win32\lib\VC\libssl32MD.lib C:\OpenSSL-Win32\lib\VC\libcrypto32MD.lib

and x64 includes: C:\OpenSSL-Win64\include

If I change the libs to x64, I get linker errors "unresolved external symbol" for boost::asio::ssl::detail::openssl_init_base::do_init If I change the includes dir to x32 I also get those linker errors and additionally several '_SSLv3_method' linker errors.

Though its a Win10x64 mashine, I compile with x86 settings with Multi-threaded(MT) in release mode, so I would expect the need to include x32 header.

Any thoughts how that came to be or why I need a mix of both OpenSSL32 and OpenSSL64?

Have a great day Natu

Natulux commented 6 years ago

I followed the includes, causing the issue. In a fresh project I can cause the linker errors by linking and including the x32 OpenSSL libs and headers (as well as the boost_1_65_1 libs) and additionally including your 'server_https.hpp'. Following the includes of that file, I lastly can cause it by just directly including "boost_1_65_1\boost\asio\ssl\context.hpp" while the rest is fine. But I can make nothing out of that:

1>MyFrame.obj : error LNK2019: unresolved external symbol _CRYPTO_cleanup_all_ex_data referenced in function "public: thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init@openssl_init_base@detail@ssl@asio@boost@@QAE@XZ) 1>MyFrame.obj : error LNK2019: unresolved external symbol _CRYPTO_num_locks referenced in function "public: thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init@openssl_init_base@detail@ssl@asio@boost@@QAE@XZ) 1>MyFrame.obj : error LNK2019: unresolved external symbol _CRYPTO_set_locking_callback referenced in function "public: thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init@openssl_init_base@detail@ssl@asio@boost@@QAE@XZ) 1>MyFrame.obj : error LNK2019: unresolved external symbol _OPENSSL_add_all_algorithms_noconf referenced in function "public: thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init@openssl_init_base@detail@ssl@asio@boost@@QAE@XZ) 1>MyFrame.obj : error LNK2019: unresolved external symbol _EVP_cleanup referenced in function "public: thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init@openssl_init_base@detail@ssl@asio@boost@@QAE@XZ) 1>MyFrame.obj : error LNK2019: unresolved external symbol _SSL_load_error_strings referenced in function "public: thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init@openssl_init_base@detail@ssl@asio@boost@@QAE@XZ) 1>MyFrame.obj : error LNK2019: unresolved external symbol _SSL_library_init referenced in function "public: thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init@openssl_init_base@detail@ssl@asio@boost@@QAE@XZ) 1>MyFrame.obj : error LNK2019: unresolved external symbol _ERR_free_strings referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init@openssl_init_base@detail@ssl@asio@boost@@QAE@XZ) 1>MyFrame.obj : error LNK2019: unresolved external symbol _ENGINE_cleanup referenced in function "public: thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" (??1do_init@openssl_init_base@detail@ssl@asio@boost@@QAE@XZ)

eidheim commented 6 years ago

Added the help wanted tag since I don't use MSVC. Sorry for being no help here

Natulux commented 6 years ago

ok thanks for that. I guess I could go along with this, but I have a feeling, that my setup has some issues, maybe a wrong version of OpenSSL or something like that causing this. For example, I needed boost version 1_65_1, while I had problems compiling with both version 1_53_0 and version 1_66_0. That a mix of x64 and x32 is needed or even works at all is for me quite unheard of.