ss-abramchuk / OpenVPNAdapter

Objective-C wrapper for OpenVPN library. Compatible with iOS and macOS.
GNU Affero General Public License v3.0
481 stars 215 forks source link

Undefined symbols for architecture x86_64 "_mbedtls_sha256_self_test", referenced from: openvpn::crypto_self_test_mbedtls() in ovpncli.o #94

Closed hungntv closed 6 years ago

hungntv commented 6 years ago

Create a fresh xcode project, create Pod and press Cmd+B And I got this error???

Macbook: MacBook Pro (Retina, 13-inch, Mid 2014)

Mac OS: 10.12.6 (16G29)

Xcode: Version 9.2 (9C40b)

Podfile

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'VPN' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
    use_frameworks!

  # Pods for VPN
    pod 'OpenVPNAdapter', :git => 'https://github.com/ss-abramchuk/OpenVPNAdapter.git', :tag => '0.1.0'
end

Buildtime:


Undefined symbols for architecture x86_64:
  "_mbedtls_sha256_self_test", referenced from:
      openvpn::crypto_self_test_mbedtls() in ovpncli.o
  "_LZ4_decompress_safe", referenced from:
      openvpn::CompressLZ4Base::do_decompress(openvpn::BufferAllocatedType<unsigned char, openvpn::thread_unsafe_refcount>&) in ovpncli.o
  "_mbedtls_gcm_init", referenced from:
      openvpn::MbedTLSCrypto::CipherContextGCM::init(openvpn::CryptoAlgs::Type, unsigned char const*, unsigned int, int) in ovpncli.o
  "_mbedtls_gcm_setkey", referenced from:
      openvpn::MbedTLSCrypto::CipherContextGCM::init(openvpn::CryptoAlgs::Type, unsigned char const*, unsigned int, int) in ovpncli.o
  "_mbedtls_gcm_crypt_and_tag", referenced from:
      openvpn::MbedTLSCrypto::CipherContextGCM::encrypt(unsigned char const*, unsigned char*, unsigned long, unsigned char const*, unsigned char*, unsigned char const*, unsigned long) in ovpncli.o
  "_mbedtls_ctr_drbg_free", referenced from:
      openvpn::MbedTLSRandom::~MbedTLSRandom() in ovpncli.o
  "_mbedtls_platform_entropy_poll", referenced from:
      openvpn::MbedTLSRandom::entropy_poll(void*, unsigned char*, unsigned long) in ovpncli.o
  "_mbedtls_ctr_drbg_seed", referenced from:
      openvpn::MbedTLSRandom::MbedTLSRandom(bool, openvpn::RCPtr<openvpn::RandomAPI>) in ovpncli.o
  "_mbedtls_ctr_drbg_init", referenced from:
      openvpn::MbedTLSRandom::MbedTLSRandom(bool, openvpn::RCPtr<openvpn::RandomAPI>) in ovpncli.o
  "_mbedtls_oid_get_extended_key_usage", referenced from:
      openvpn::MbedTLSContext::verify_x509_cert_eku(mbedtls_x509_crt*) in ovpncli.o
  "_mbedtls_md_finish", referenced from:
      openvpn::MbedTLSCrypto::DigestContext::final(unsigned char*) in ovpncli.o
  "_mbedtls_oid_get_numeric_string", referenced from:
      openvpn::MbedTLSContext::verify_x509_cert_eku(mbedtls_x509_crt*) in ovpncli.o
  "_mbedtls_ssl_get_ciphersuite", referenced from:
      openvpn::MbedTLSContext::SSL::ssl_handshake_details() const in ovpncli.o
  "_mbedtls_ssl_get_bytes_avail", referenced from:
      openvpn::MbedTLSContext::SSL::read_cleartext_ready() const in ovpncli.o
  "_mbedtls_ssl_read", referenced from:
      openvpn::MbedTLSContext::SSL::read_cleartext(void*, unsigned long) in ovpncli.o
  "_mbedtls_gcm_auth_decrypt", referenced from:
      openvpn::MbedTLSCrypto::CipherContextGCM::decrypt(unsigned char const*, unsigned char*, unsigned long, unsigned char const*, unsigned char const*, unsigned char const*, unsigned long) in ovpncli.o
  "_mbedtls_ssl_free", referenced from:
      openvpn::MbedTLSContext::SSL::erase() in ovpncli.o
  "_mbedtls_pk_setup_rsa_alt", referenced from:
      openvpn::MbedTLSPKI::PKContext::epki_enable(void*, int (*)(void*, int, unsigned long*, unsigned char const*, unsigned char*, unsigned long), int (*)(void*, int (*)(void*, unsigned char*, unsigned long), void*, int, mbedtls_md_type_t, unsigned int, unsigned char const*, unsigned char*), unsigned long (*)(void*)) in ovpncli.o
  "_mbedtls_x509_crt_profile_suiteb", referenced from:
      openvpn::MbedTLSContext::Config::select_crt_profile() const in ovpncli.o
  "_mbedtls_ssl_conf_cert_profile", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_ssl_write", referenced from:
      openvpn::MbedTLSContext::SSL::write_cleartext_unbuffered(void const*, unsigned long) in ovpncli.o
  "_mbedtls_ssl_init", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_ssl_conf_min_version", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_ssl_conf_authmode", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_sha1_self_test", referenced from:
      openvpn::crypto_self_test_mbedtls() in ovpncli.o
  "_mbedtls_ssl_conf_ciphersuites", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_pk_get_type", referenced from:
      -[OpenVPNPrivateKey type] in OpenVPNPrivateKey.o
      openvpn::MbedTLSPKI::PKContext::key_type() const in ovpncli.o
  "_mbedtls_ssl_conf_own_cert", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_ssl_config_free", referenced from:
      openvpn::MbedTLSContext::SSL::erase() in ovpncli.o
  "_mbedtls_sha1", referenced from:
      openvpn::MbedTLSContext::verify_callback_server(void*, mbedtls_x509_crt*, int, unsigned int*) in ovpncli.o
  "_mbedtls_ssl_set_bio", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_x509_crl_parse", referenced from:
      openvpn::MbedTLSPKI::X509CRL::parse(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in ovpncli.o
  "_mbedtls_ssl_conf_rng", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_ssl_conf_cbc_record_splitting", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_ssl_setup", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_dhm_init", referenced from:
      openvpn::MbedTLSPKI::DH::alloc() in ovpncli.o
  "_mbedtls_cipher_update", referenced from:
      openvpn::MbedTLSCrypto::CipherContext::update(unsigned char*, unsigned long, unsigned char const*, unsigned long, unsigned long&) in ovpncli.o
  "_mbedtls_x509_crl_free", referenced from:
      openvpn::MbedTLSPKI::X509CRL::dealloc() in ovpncli.o
  "_mbedtls_ssl_get_version", referenced from:
      openvpn::MbedTLSContext::SSL::ssl_handshake_details() const in ovpncli.o
  "_mbedtls_cipher_reset", referenced from:
      openvpn::MbedTLSCrypto::CipherContext::reset(unsigned char const*) in ovpncli.o
  "_mbedtls_cipher_setup", referenced from:
      openvpn::MbedTLSCrypto::CipherContext::init(openvpn::CryptoAlgs::Type, unsigned char const*, int) in ovpncli.o
  "_mbedtls_pem_write_buffer", referenced from:
      -[OpenVPNCertificate pemData:] in OpenVPNCertificate.o
      openvpn::MbedTLSPKI::X509Cert::der_to_pem(unsigned char const*, unsigned long) in ovpncli.o
  "_mbedtls_md_setup", referenced from:
      openvpn::MbedTLSCrypto::HMACContext::init(openvpn::CryptoAlgs::Type, unsigned char const*, unsigned long) in ovpncli.o
      openvpn::MbedTLSCrypto::DigestContext::init(openvpn::CryptoAlgs::Type) in ovpncli.o
  "_mbedtls_md_hmac_reset", referenced from:
      openvpn::MbedTLSCrypto::HMACContext::reset() in ovpncli.o
  "_mbedtls_cipher_free", referenced from:
      openvpn::MbedTLSCrypto::CipherContext::erase() in ovpncli.o
  "_mbedtls_md_hmac_starts", referenced from:
      openvpn::MbedTLSCrypto::HMACContext::init(openvpn::CryptoAlgs::Type, unsigned char const*, unsigned long) in ovpncli.o
  "_mbedtls_md_hmac_update", referenced from:
      openvpn::MbedTLSCrypto::HMACContext::update(unsigned char const*, unsigned long) in ovpncli.o
  "_mbedtls_ssl_conf_verify", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_ssl_set_hostname", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_ssl_conf_dh_param_ctx", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_cipher_setkey", referenced from:
      openvpn::MbedTLSCrypto::CipherContext::init(openvpn::CryptoAlgs::Type, unsigned char const*, int) in ovpncli.o
  "_mbedtls_sha512_self_test", referenced from:
      openvpn::crypto_self_test_mbedtls() in ovpncli.o
  "_mbedtls_ctr_drbg_random", referenced from:
      openvpn::MbedTLSRandom::rndbytes(unsigned char*, unsigned long) in ovpncli.o
  "_mbedtls_pk_write_key_pem", referenced from:
      -[OpenVPNPrivateKey pemData:] in OpenVPNPrivateKey.o
      openvpn::MbedTLSPKI::PKContext::extract() const in ovpncli.o
  "_mbedtls_ctr_drbg_set_reseed_interval", referenced from:
      openvpn::MbedTLSRandom::MbedTLSRandom(bool, openvpn::RCPtr<openvpn::RandomAPI>) in ovpncli.o
  "_mbedtls_md_update", referenced from:
      openvpn::MbedTLSCrypto::DigestContext::update(unsigned char const*, unsigned long) in ovpncli.o
  "_mbedtls_md_starts", referenced from:
      openvpn::MbedTLSCrypto::DigestContext::init(openvpn::CryptoAlgs::Type) in ovpncli.o
  "_mbedtls_dhm_free", referenced from:
      openvpn::MbedTLSPKI::DH::dealloc() in ovpncli.o
  "_mbedtls_md_hmac_finish", referenced from:
      openvpn::MbedTLSCrypto::HMACContext::final(unsigned char*) in ovpncli.o
  "_mbedtls_x509_crt_verify_info", referenced from:
      openvpn::MbedTLSException::mbedtls_verify_flags_errtext(unsigned int) in ovpncli.o
  "_mbedtls_cipher_finish", referenced from:
      openvpn::MbedTLSCrypto::CipherContext::final(unsigned char*, unsigned long, unsigned long&) in ovpncli.o
  "_mbedtls_gcm_free", referenced from:
      openvpn::MbedTLSCrypto::CipherContextGCM::erase() in ovpncli.o
  "_mbedtls_md_get_size", referenced from:
      openvpn::MbedTLSCrypto::HMACContext::size_() const in ovpncli.o
      openvpn::MbedTLSCrypto::DigestContext::size_() const in ovpncli.o
  "_mbedtls_dhm_parse_dhm", referenced from:
      openvpn::MbedTLSPKI::DH::parse(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in ovpncli.o
  "_mbedtls_md_info_from_type", referenced from:
      openvpn::MbedTLSCrypto::DigestContext::digest_type(openvpn::CryptoAlgs::Type) in ovpncli.o
  "_mbedtls_x509_crt_info", referenced from:
      openvpn::MbedTLSContext::cert_info(mbedtls_x509_crt const*, char const*) in ovpncli.o
  "_mbedtls_pk_free", referenced from:
      -[OpenVPNPrivateKey dealloc] in OpenVPNPrivateKey.o
      openvpn::MbedTLSPKI::PKContext::dealloc() in ovpncli.o
  "_mbedtls_strerror", referenced from:
      +[NSError(OpenVPNMbedTLSErrorGeneration) ovpn_errorObjectForMbedTLSError:description:] in NSError+OpenVPNError.o
      openvpn::MbedTLSException::mbedtls_errtext(int) in ovpncli.o
  "_mbedtls_x509_crt_parse", referenced from:
      +[OpenVPNCertificate certificateWithPEM:error:] in OpenVPNCertificate.o
      openvpn::MbedTLSPKI::X509Cert::parse(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) in ovpncli.o
  "_mbedtls_md_free", referenced from:
      openvpn::MbedTLSCrypto::HMACContext::erase() in ovpncli.o
      openvpn::MbedTLSCrypto::DigestContext::erase() in ovpncli.o
  "_mbedtls_pk_parse_key", referenced from:
      +[OpenVPNPrivateKey keyWithPEM:password:error:] in OpenVPNPrivateKey.o
      +[OpenVPNPrivateKey keyWithDER:password:error:] in OpenVPNPrivateKey.o
      openvpn::MbedTLSPKI::PKContext::parse(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in ovpncli.o
  "_mbedtls_pk_write_key_der", referenced from:
      -[OpenVPNPrivateKey derData:] in OpenVPNPrivateKey.o
  "_mbedtls_ssl_config_defaults", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_ssl_conf_renegotiation", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_cipher_set_iv", referenced from:
      openvpn::MbedTLSCrypto::CipherContext::reset(unsigned char const*) in ovpncli.o
  "_mbedtls_ssl_config_init", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_pk_get_bitlen", referenced from:
      -[OpenVPNPrivateKey size] in OpenVPNPrivateKey.o
      _mbedtls_pk_get_len in OpenVPNPrivateKey.o
      openvpn::MbedTLSPKI::PKContext::key_length() const in ovpncli.o
      openvpn::MbedTLSContext::key_len() const in ovpncli.o
  "_mbedtls_x509_crt_free", referenced from:
      -[OpenVPNCertificate dealloc] in OpenVPNCertificate.o
      openvpn::MbedTLSPKI::X509Cert::dealloc() in ovpncli.o
  "_LZ4_compress_default", referenced from:
      openvpn::CompressLZ4Base::do_compress(openvpn::BufferAllocatedType<unsigned char, openvpn::thread_unsafe_refcount>&) in ovpncli.o
  "_mbedtls_ssl_conf_ca_chain", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_aes_self_test", referenced from:
      openvpn::crypto_self_test_mbedtls() in ovpncli.o
  "_mbedtls_md_init", referenced from:
      openvpn::MbedTLSCrypto::HMACContext::init(openvpn::CryptoAlgs::Type, unsigned char const*, unsigned long) in ovpncli.o
      openvpn::MbedTLSCrypto::DigestContext::init(openvpn::CryptoAlgs::Type) in ovpncli.o
  "_mbedtls_x509_crt_parse_der", referenced from:
      +[OpenVPNCertificate certificateWithDER:error:] in OpenVPNCertificate.o
  "_mbedtls_cipher_info_from_type", referenced from:
      openvpn::MbedTLSCrypto::CipherContext::cipher_type(openvpn::CryptoAlgs::Type) in ovpncli.o
  "_mbedtls_x509_crt_init", referenced from:
      -[OpenVPNCertificate init] in OpenVPNCertificate.o
      openvpn::MbedTLSPKI::X509Cert::alloc() in ovpncli.o
  "_mbedtls_mpi_self_test", referenced from:
      openvpn::crypto_self_test_mbedtls() in ovpncli.o
  "_mbedtls_ssl_handshake", referenced from:
      openvpn::MbedTLSContext::SSL::start_handshake() in ovpncli.o
  "_mbedtls_ssl_conf_dbg", referenced from:
      openvpn::MbedTLSContext::SSL::SSL(openvpn::MbedTLSContext*, char const*) in ovpncli.o
  "_mbedtls_debug_set_threshold", referenced from:
      openvpn::ClientAPI::OpenVPNClient::connect_setup(openvpn::ClientAPI::Status&, bool&) in ovpncli.o
  "_mbedtls_pk_init", referenced from:
      -[OpenVPNPrivateKey init] in OpenVPNPrivateKey.o
      openvpn::MbedTLSPKI::PKContext::alloc() in ovpncli.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)```
ss-abramchuk commented 6 years ago

Hi @hungntv, looks like you are trying to build the app for simulator. TunnelProvider extension won't work there, that's why pod config doesn't include symbols for architecture x86_64. You need to build the app for device only.

hungntv commented 6 years ago

@ss-abramchuk Thank you very much!