socketio / socket.io-client-cpp

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

iOS SSL won't compile #80

Open rgross2 opened 8 years ago

rgross2 commented 8 years ago

@melode11 The demo app only seems to work when SIO_TLS is not enabled, on OS X, I receive the errors below. I've tried using both Boost 1.60.0 and 1.55.0 against OpenSSL 1.0.2f, 1.0.1a, and 0.9.8zg(Default OSX). Using the default OpenSSL provided in OS X Yosemite it returns errors stating that methods were deprecated OS_X_10_7. Using OpenSSL from Git the follow error is returned.

Undefined symbols for architecture arm64:
  "_SSL_CTX_get_ex_data", referenced from:
      boost::asio::ssl::context::~context() in libsioclient.a(sio_client_impl.o)
  "_SSL_CTX_set_ex_data", referenced from:
      boost::asio::ssl::context::~context() in libsioclient.a(sio_client_impl.o)
  "_SSL_CTX_free", referenced from:
      boost::asio::ssl::context::~context() in libsioclient.a(sio_client_impl.o)
  "_SSL_connect", referenced from:
      boost::asio::ssl::detail::engine::do_connect(void*, unsigned long) in libsioclient.a(sio_client_impl.o)
  "_SSL_get_ex_data", referenced from:
      boost::asio::ssl::detail::engine::~engine() in libsioclient.a(sio_client_impl.o)
  "_BIO_free", referenced from:
      boost::asio::ssl::detail::engine::~engine() in libsioclient.a(sio_client_impl.o)
  "_SSL_new", referenced from:
      boost::asio::ssl::detail::engine::engine(ssl_ctx_st*) in libsioclient.a(sio_client_impl.o)
  "_SSL_set_bio", referenced from:
      boost::asio::ssl::detail::engine::engine(ssl_ctx_st*) in libsioclient.a(sio_client_impl.o)
  "_SSL_read", referenced from:
      boost::asio::ssl::detail::engine::do_read(void*, unsigned long) in libsioclient.a(sio_client_impl.o)
  "_BIO_ctrl_pending", referenced from:
      boost::asio::ssl::detail::engine::perform(int (boost::asio::ssl::detail::engine::*)(void*, unsigned long), void*, unsigned long, boost::system::error_code&, unsigned long*) in libsioclient.a(sio_client_impl.o)
  "_BIO_ctrl", referenced from:
      boost::asio::ssl::detail::engine::map_error_code(boost::system::error_code&) const in libsioclient.a(sio_client_impl.o)
  "_ERR_reason_error_string", referenced from:
      boost::asio::error::detail::ssl_category::message(int) const in libsioclient.a(sio_client.o)
  "_BIO_new_bio_pair", referenced from:
      boost::asio::ssl::detail::engine::engine(ssl_ctx_st*) in libsioclient.a(sio_client_impl.o)
  "_SSL_get_shutdown", referenced from:
      boost::asio::ssl::detail::engine::map_error_code(boost::system::error_code&) const in libsioclient.a(sio_client_impl.o)
      boost::asio::ssl::detail::engine::perform(int (boost::asio::ssl::detail::engine::*)(void*, unsigned long), void*, unsigned long, boost::system::error_code&, unsigned long*) in libsioclient.a(sio_client_impl.o)
  "_TLSv1_2_method", referenced from:
      boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libsioclient.a(sio_client_impl.o)
  "_BIO_write", referenced from:
      boost::asio::ssl::detail::engine::put_input(boost::asio::const_buffer const&) in libsioclient.a(sio_client_impl.o)
  "_SSLv3_method", referenced from:
      boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libsioclient.a(sio_client_impl.o)
  "_SSL_get_error", referenced from:
      boost::asio::ssl::detail::engine::perform(int (boost::asio::ssl::detail::engine::*)(void*, unsigned long), void*, unsigned long, boost::system::error_code&, unsigned long*) in libsioclient.a(sio_client_impl.o)
  "_BIO_read", referenced from:
      boost::asio::ssl::detail::engine::get_output(boost::asio::mutable_buffer const&) in libsioclient.a(sio_client_impl.o)
  "_SSLv3_client_method", referenced from:
      boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libsioclient.a(sio_client_impl.o)
  "_TLSv1_method", referenced from:
      boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libsioclient.a(sio_client_impl.o)
  "_TLSv1_client_method", referenced from:
      boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libsioclient.a(sio_client_impl.o)
  "_SSL_shutdown", referenced from:
      boost::asio::ssl::detail::engine::do_shutdown(void*, unsigned long) in libsioclient.a(sio_client_impl.o)
  "_SSLv23_method", referenced from:
      boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libsioclient.a(sio_client_impl.o)
  "_SSL_set_ex_data", referenced from:
      boost::asio::ssl::detail::engine::~engine() in libsioclient.a(sio_client_impl.o)
  "_TLSv1_server_method", referenced from:
      boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libsioclient.a(sio_client_impl.o)
  "_SSLv23_client_method", referenced from:
      boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libsioclient.a(sio_client_impl.o)
  "_SSL_ctrl", referenced from:
      boost::asio::ssl::detail::engine::engine(ssl_ctx_st*) in libsioclient.a(sio_client_impl.o)
  "_TLSv1_1_method", referenced from:
      boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libsioclient.a(sio_client_impl.o)
  "_SSLv3_server_method", referenced from:
      boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libsioclient.a(sio_client_impl.o)
  "_CRYPTO_cleanup_all_ex_data", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in libsioclient.a(sio_client.o)
  "_TLSv1_1_client_method", referenced from:
      boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libsioclient.a(sio_client_impl.o)
  "_SSL_write", referenced from:
      boost::asio::ssl::detail::engine::do_write(void*, unsigned long) in libsioclient.a(sio_client_impl.o)
  "_CRYPTO_set_locking_callback", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::do_init() in libsioclient.a(sio_client.o)
      boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in libsioclient.a(sio_client.o)
  "_TLSv1_2_client_method", referenced from:
      boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libsioclient.a(sio_client_impl.o)
  "_SSL_accept", referenced from:
      boost::asio::ssl::detail::engine::do_accept(void*, unsigned long) in libsioclient.a(sio_client_impl.o)
  "_SSL_CTX_ctrl", referenced from:
      boost::asio::ssl::context::set_options(long, boost::system::error_code&) in libsioclient.a(sio_client_impl.o)
  "_CRYPTO_num_locks", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::do_init() in libsioclient.a(sio_client.o)
  "_TLSv1_1_server_method", referenced from:
      boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libsioclient.a(sio_client_impl.o)
  "_TLSv1_2_server_method", referenced from:
      boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libsioclient.a(sio_client_impl.o)
  "_ERR_free_strings", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in libsioclient.a(sio_client.o)
  "_SSL_load_error_strings", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::do_init() in libsioclient.a(sio_client.o)
  "_CRYPTO_set_id_callback", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::do_init() in libsioclient.a(sio_client.o)
      boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in libsioclient.a(sio_client.o)
  "_ERR_remove_state", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in libsioclient.a(sio_client.o)
  "_ENGINE_cleanup", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in libsioclient.a(sio_client.o)
  "_CONF_modules_unload", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in libsioclient.a(sio_client.o)
  "_SSLv23_server_method", referenced from:
      boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libsioclient.a(sio_client_impl.o)
  "_OPENSSL_add_all_algorithms_noconf", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::do_init() in libsioclient.a(sio_client.o)
  "_EVP_cleanup", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in libsioclient.a(sio_client.o)
  "_SSL_library_init", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::do_init() in libsioclient.a(sio_client.o)
  "_SSL_free", referenced from:
      boost::asio::ssl::detail::engine::~engine() in libsioclient.a(sio_client_impl.o)
  "_SSL_CTX_new", referenced from:
      boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libsioclient.a(sio_client_impl.o)
  "_ERR_get_error", referenced from:
      boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libsioclient.a(sio_client_impl.o)
      boost::asio::ssl::detail::engine::perform(int (boost::asio::ssl::detail::engine::*)(void*, unsigned long), void*, unsigned long, boost::system::error_code&, unsigned long*) in libsioclient.a(sio_client_impl.o)
      boost::asio::ssl::detail::engine::engine(ssl_ctx_st*) in libsioclient.a(sio_client_impl.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
IgorGanapolsky commented 8 years ago

Did you find a resolution to this problem? I am facing similar.

jianjunz commented 8 years ago

If you're building socket.io-client-cpp for iOS, then the OpenSSL lib should also build for iOS instead of Max OS X.

sepehrhm commented 7 years ago

is there an update on this? i am using on Mac OS, installed openssl with brew and facing the same issue.

ProgrammingLife commented 7 years ago

How to build OpenSSL lib for iOS on Mac OS X?

ProgrammingLife commented 7 years ago

That can be useful for building OpenSSL for iOS: https://gist.github.com/armadsen/b30f352a8d6f6c87a146

jamylak commented 1 year ago

Old issue but this error seems to be solved by linking ssl similar to this https://stackoverflow.com/a/1912461/1219006

Had these errors before doing that