I am working on a little software that needed a small server that listens to http requests. Unfortunately, the productive server uses https only, so the requests fail. I've search the web and found this example: http://www.boost.org/doc/libs/1_65_0/doc/html/boost_asio/example/cpp03/ssl/server.cpp
I tried my best to apply the required changes. But I can't compile it. I am on a MacOS machine, but the Server is a Ubuntu Server. I installed OpenSSL via brew.
The compilation fails at the linking process:
[ 98%] Linking CXX executable GpdServer
Undefined symbols for architecture x86_64:
"_ERR_remove_thread_state", referenced from:
boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in main.cpp.o
boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in TcpServer.cpp.o
boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in TcpConnection.cpp.o
"_TLSv1_1_client_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in TcpServer.cpp.o
"_TLSv1_1_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in TcpServer.cpp.o
"_TLSv1_1_server_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in TcpServer.cpp.o
"_TLSv1_2_client_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in TcpServer.cpp.o
"_TLSv1_2_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in TcpServer.cpp.o
"_TLSv1_2_server_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in TcpServer.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [GpdServer] Error 1
make[1]: *** [CMakeFiles/GpdServer.dir/all] Error 2
make: *** [all] Error 2
The TcpConnection files that cause this issue are here: https://github.com/cwansart/gpd/blob/master/src/TcpServer.h https://github.com/cwansart/gpd/blob/master/src/TcpServer.cpp
My build system is CMake. Including it works fine.
What am I doing wrong? How do I fix this?