Make writing a habit together! This is my first day to participate in the “Gold Digging Day New Plan · April More text challenge”, click to see the details of the activity.

1. The background

Before cross-platform all links of the construction of the intelligent voice interaction system has only run on the Android system (mainly Iot devices), no iOS business scenarios, recently after continuous efforts, finally to the ability to B client APP, for end users, B have iOS above at this time, after all, from the beginning of the capacity building to blow out, The system is cross-platform, this time can not be dropped.

Although the full-link voice interaction SDK has been running on Android, Ubuntu and Mac, it is still a bit weak on iOS devices. The SDK for full-link voice interaction relies on curl for straight-line HTTP2 transmission, while curl relies on NGHTTP2 and OpenSSL.

2. Compilation process

2.1 Finding Tools

As an Android developer, I am not so familiar with the iOS compiler and platform. I wanted to directly find a ready-made tool to compile, but I found github.com/jasonacox/B on Github. Curl curl curl curl curl curl curl curl curl curl curl curl curl curl curl curl curl curl curl curl The default versions of this tool are:

  1. OPENSSL : 1.1.1l
  2. LIBCURL :7.80.0
  3. NGHTTP2:1.46.0

The full-link voice SDK relies on the following versions:

  1. OPENSSL : 1.1.0h
  2. LIBCURL: 7.61.0
  3. NGHTTP2:1.32.0

The version is lower than the default version of the tool. In order to reduce the impact of the library version, the script gives a warning:

** WARNING: This build script has not been tested with 1.1.0 **

In order to quickly verify the following process, the OpenSSL version was first modified to 1.1.1L. The result was surprisingly smooth. No errors were reported in the compilation process, but the whole compilation process took a little longer.

[bug Mc-10809] – Static library: SDK for full link voice interaction

[ 35%] Linking CXX shared library libAVSCommon.dylib
Undefined symbols for architecture armv7:
  "_ASN1_STRING_free", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_ASN1_STRING_get0_data", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_ASN1_STRING_length", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_ASN1_STRING_new", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_ASN1_STRING_print", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_ASN1_STRING_to_UTF8", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_ASN1_STRING_type", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_ASN1_TIME_print", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_BIO_ctrl", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
      _x509_name_oneline in libcurl.a(libcurl_la-openssl.o)
      _pubkey_show in libcurl.a(libcurl_la-openssl.o)
  "_BIO_f_ssl", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_BIO_free", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
      _x509_name_oneline in libcurl.a(libcurl_la-openssl.o)
  "_BIO_new", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
      _x509_name_oneline in libcurl.a(libcurl_la-openssl.o)
  "_BIO_printf", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_BIO_puts", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_BIO_s_file", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_BIO_s_mem", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
      _x509_name_oneline in libcurl.a(libcurl_la-openssl.o)
  "_BN_print", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
      _pubkey_show in libcurl.a(libcurl_la-openssl.o)
  "_CONF_modules_load_file", referenced from:
      _Curl_ossl_init in libcurl.a(libcurl_la-openssl.o)
  "_CRYPTO_free", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_CRYPTO_malloc", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_DES_ecb_encrypt", referenced from:
      _Curl_ntlm_core_lm_resp in libcurl.a(libcurl_la-curl_ntlm_core.o)
      _Curl_ntlm_core_mk_lm_hash in libcurl.a(libcurl_la-curl_ntlm_core.o)
  "_DES_set_key", referenced from:
      _setup_des_key in libcurl.a(libcurl_la-curl_ntlm_core.o)
  "_DES_set_odd_parity", referenced from:
      _setup_des_key in libcurl.a(libcurl_la-curl_ntlm_core.o)
  "_DH_get0_key", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_DH_get0_pqg", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_DSA_get0_key", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_DSA_get0_pqg", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_ENGINE_by_id", referenced from:
      _Curl_ossl_set_engine in libcurl.a(libcurl_la-openssl.o)
  "_ENGINE_ctrl", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_ENGINE_ctrl_cmd", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_ENGINE_finish", referenced from:
      _Curl_ossl_close_all in libcurl.a(libcurl_la-openssl.o)
      _Curl_ossl_set_engine in libcurl.a(libcurl_la-openssl.o)
  "_ENGINE_free", referenced from:
      _Curl_ossl_close_all in libcurl.a(libcurl_la-openssl.o)
      _Curl_ossl_set_engine in libcurl.a(libcurl_la-openssl.o)
  "_ENGINE_get_first", referenced from:
      _Curl_ossl_engines_list in libcurl.a(libcurl_la-openssl.o)
  "_ENGINE_get_id", referenced from:
      _Curl_ossl_set_engine_default in libcurl.a(libcurl_la-openssl.o)
      _Curl_ossl_engines_list in libcurl.a(libcurl_la-openssl.o)
  "_ENGINE_get_next", referenced from:
      _Curl_ossl_engines_list in libcurl.a(libcurl_la-openssl.o)
  "_ENGINE_init", referenced from:
      _Curl_ossl_set_engine in libcurl.a(libcurl_la-openssl.o)
  "_ENGINE_load_private_key", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_ENGINE_set_default", referenced from:
      _Curl_ossl_set_engine_default in libcurl.a(libcurl_la-openssl.o)
  "_ERR_clear_error", referenced from:
      _Curl_ossl_shutdown in libcurl.a(libcurl_la-openssl.o)
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
      _ossl_recv in libcurl.a(libcurl_la-openssl.o)
      _ossl_send in libcurl.a(libcurl_la-openssl.o)
  "_ERR_error_string_n", referenced from:
      _Curl_ossl_shutdown in libcurl.a(libcurl_la-openssl.o)
      _Curl_ossl_set_engine in libcurl.a(libcurl_la-openssl.o)
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
      _ossl_recv in libcurl.a(libcurl_la-openssl.o)
      _ossl_send in libcurl.a(libcurl_la-openssl.o)
  "_ERR_get_error", referenced from:
      _Curl_ossl_shutdown in libcurl.a(libcurl_la-openssl.o)
      _Curl_ossl_set_engine in libcurl.a(libcurl_la-openssl.o)
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
      _ossl_recv in libcurl.a(libcurl_la-openssl.o)
      _ossl_send in libcurl.a(libcurl_la-openssl.o)
  "_ERR_peek_error", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_EVP_DigestFinal_ex", referenced from:
      _Curl_ossl_md5sum in libcurl.a(libcurl_la-openssl.o)
      _Curl_ossl_sha256sum in libcurl.a(libcurl_la-openssl.o)
  "_EVP_DigestInit_ex", referenced from:
      _Curl_ossl_md5sum in libcurl.a(libcurl_la-openssl.o)
      _Curl_ossl_sha256sum in libcurl.a(libcurl_la-openssl.o)
  "_EVP_DigestUpdate", referenced from:
      _Curl_ossl_md5sum in libcurl.a(libcurl_la-openssl.o)
      _Curl_ossl_sha256sum in libcurl.a(libcurl_la-openssl.o)
  "_EVP_MD_CTX_free", referenced from:
      _Curl_ossl_md5sum in libcurl.a(libcurl_la-openssl.o)
      _Curl_ossl_sha256sum in libcurl.a(libcurl_la-openssl.o)
  "_EVP_MD_CTX_new", referenced from:
      _Curl_ossl_md5sum in libcurl.a(libcurl_la-openssl.o)
      _Curl_ossl_sha256sum in libcurl.a(libcurl_la-openssl.o)
  "_EVP_PKEY_copy_parameters", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_EVP_PKEY_free", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_EVP_PKEY_get0_DH", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_EVP_PKEY_get0_DSA", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_EVP_PKEY_get0_RSA", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_EVP_PKEY_get1_RSA", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_EVP_PKEY_id", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_EVP_md5", referenced from:
      _Curl_ossl_md5sum in libcurl.a(libcurl_la-openssl.o)
  "_EVP_sha256", referenced from:
      _Curl_ossl_sha256sum in libcurl.a(libcurl_la-openssl.o)
  "_GENERAL_NAMES_free", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_MD4_Final", referenced from:
      _Curl_ntlm_core_mk_nt_hash in libcurl.a(libcurl_la-curl_ntlm_core.o)
  "_MD4_Init", referenced from:
      _Curl_ntlm_core_mk_nt_hash in libcurl.a(libcurl_la-curl_ntlm_core.o)
  "_MD4_Update", referenced from:
      _Curl_ntlm_core_mk_nt_hash in libcurl.a(libcurl_la-curl_ntlm_core.o)
  "_MD5_Final", referenced from:
      _Curl_md5it in libcurl.a(libcurl_la-md5.o)
      _Curl_HMAC_MD5 in libcurl.a(libcurl_la-md5.o)
      _Curl_DIGEST_MD5 in libcurl.a(libcurl_la-md5.o)
  "_MD5_Init", referenced from:
      _Curl_md5it in libcurl.a(libcurl_la-md5.o)
      _Curl_HMAC_MD5 in libcurl.a(libcurl_la-md5.o)
      _Curl_DIGEST_MD5 in libcurl.a(libcurl_la-md5.o)
  "_MD5_Update", referenced from:
      _Curl_md5it in libcurl.a(libcurl_la-md5.o)
      _Curl_HMAC_MD5 in libcurl.a(libcurl_la-md5.o)
      _Curl_DIGEST_MD5 in libcurl.a(libcurl_la-md5.o)
  "_OCSP_BASICRESP_free", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_OCSP_RESPONSE_free", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_OCSP_basic_verify", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_OCSP_cert_status_str", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_OCSP_check_validity", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_OCSP_crl_reason_str", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_OCSP_resp_count", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_OCSP_resp_get0", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_OCSP_response_get1_basic", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_OCSP_response_status", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_OCSP_response_status_str", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_OCSP_single_get0_status", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_OPENSSL_load_builtin_modules", referenced from:
      _Curl_ossl_init in libcurl.a(libcurl_la-openssl.o)
  "_OPENSSL_sk_num", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_OPENSSL_sk_pop", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_OPENSSL_sk_pop_free", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_OPENSSL_sk_value", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_OpenSSL_version_num", referenced from:
      _Curl_ossl_version in libcurl.a(libcurl_la-openssl.o)
  "_PEM_read_bio_X509", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_PEM_write_bio_X509", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_PKCS12_PBE_add", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_PKCS12_free", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_PKCS12_parse", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_RAND_add", referenced from:
      _Curl_ossl_seed in libcurl.a(libcurl_la-openssl.o)
  "_RAND_bytes", referenced from:
      _Curl_ossl_random in libcurl.a(libcurl_la-openssl.o)
  "_RAND_file_name", referenced from:
      _Curl_ossl_seed in libcurl.a(libcurl_la-openssl.o)
  "_RAND_load_file", referenced from:
      _Curl_ossl_seed in libcurl.a(libcurl_la-openssl.o)
  "_RAND_status", referenced from:
      _Curl_ossl_random in libcurl.a(libcurl_la-openssl.o)
      _Curl_ossl_seed in libcurl.a(libcurl_la-openssl.o)
  "_RSA_flags", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_RSA_free", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_RSA_get0_key", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SHA256_Final", referenced from:
      _Curl_sha256it in libcurl.a(libcurl_la-sha256.o)
  "_SHA256_Init", referenced from:
      _Curl_sha256it in libcurl.a(libcurl_la-sha256.o)
  "_SHA256_Update", referenced from:
      _Curl_sha256it in libcurl.a(libcurl_la-sha256.o)
  "_SSL_CIPHER_get_name", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_add_client_CA", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_check_private_key", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_ctrl", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_free", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
      _ossl_close in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_get_cert_store", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_load_verify_locations", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_new", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_set_alpn_protos", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_set_cipher_list", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_set_default_passwd_cb", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_set_default_passwd_cb_userdata", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_set_msg_callback", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_set_next_proto_select_cb", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_set_options", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_set_srp_password", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_set_srp_username", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_set_verify", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_use_PrivateKey", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_use_PrivateKey_file", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_use_certificate", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_use_certificate_chain_file", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_CTX_use_certificate_file", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_SESSION_free", referenced from:
      _Curl_ossl_session_free in libcurl.a(libcurl_la-openssl.o)
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_SESSION_get_master_key", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_connect", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_ctrl", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_free", referenced from:
      _Curl_ossl_shutdown in libcurl.a(libcurl_la-openssl.o)
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
      _ossl_close in libcurl.a(libcurl_la-openssl.o)
  "_SSL_get0_alpn_selected", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_get1_session", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_get_certificate", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_get_client_random", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_get_current_cipher", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_get_error", referenced from:
      _Curl_ossl_shutdown in libcurl.a(libcurl_la-openssl.o)
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
      _ossl_recv in libcurl.a(libcurl_la-openssl.o)
      _ossl_send in libcurl.a(libcurl_la-openssl.o)
  "_SSL_get_peer_cert_chain", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_get_peer_certificate", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_get_privatekey", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_get_session", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_get_shutdown", referenced from:
      _Curl_ossl_shutdown in libcurl.a(libcurl_la-openssl.o)
  "_SSL_get_verify_result", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_new", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_pending", referenced from:
      _Curl_ossl_data_pending in libcurl.a(libcurl_la-openssl.o)
  "_SSL_read", referenced from:
      _Curl_ossl_shutdown in libcurl.a(libcurl_la-openssl.o)
      _ossl_recv in libcurl.a(libcurl_la-openssl.o)
  "_SSL_set_bio", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_set_connect_state", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
      _ossl_close in libcurl.a(libcurl_la-openssl.o)
  "_SSL_set_fd", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_set_session", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_shutdown", referenced from:
      _Curl_ossl_shutdown in libcurl.a(libcurl_la-openssl.o)
      _ossl_close in libcurl.a(libcurl_la-openssl.o)
  "_SSL_version", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_SSL_write", referenced from:
      _ossl_send in libcurl.a(libcurl_la-openssl.o)
  "_TLS_client_method", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_UI_OpenSSL", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
      _ssl_ui_reader in libcurl.a(libcurl_la-openssl.o)
      _ssl_ui_writer in libcurl.a(libcurl_la-openssl.o)
  "_UI_create_method", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_UI_destroy_method", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_UI_get0_user_data", referenced from:
      _ssl_ui_reader in libcurl.a(libcurl_la-openssl.o)
      _ssl_ui_writer in libcurl.a(libcurl_la-openssl.o)
  "_UI_get_input_flags", referenced from:
      _ssl_ui_reader in libcurl.a(libcurl_la-openssl.o)
      _ssl_ui_writer in libcurl.a(libcurl_la-openssl.o)
  "_UI_get_string_type", referenced from:
      _ssl_ui_reader in libcurl.a(libcurl_la-openssl.o)
      _ssl_ui_writer in libcurl.a(libcurl_la-openssl.o)
  "_UI_method_get_closer", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_UI_method_get_opener", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_UI_method_get_reader", referenced from:
      _ssl_ui_reader in libcurl.a(libcurl_la-openssl.o)
  "_UI_method_get_writer", referenced from:
      _ssl_ui_writer in libcurl.a(libcurl_la-openssl.o)
  "_UI_method_set_closer", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_UI_method_set_opener", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_UI_method_set_reader", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_UI_method_set_writer", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_UI_set_result", referenced from:
      _ssl_ui_reader in libcurl.a(libcurl_la-openssl.o)
  "_X509V3_EXT_print", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_EXTENSION_get_data", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_EXTENSION_get_object", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_LOOKUP_file", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_NAME_ENTRY_get_data", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_NAME_get_entry", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_NAME_get_index_by_NID", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_NAME_print_ex", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
      _x509_name_oneline in libcurl.a(libcurl_la-openssl.o)
  "_X509_STORE_add_lookup", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_STORE_set_flags", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_check_issued", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_free", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_get0_extensions", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_get0_notAfter", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_get0_notBefore", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_get0_signature", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_get_X509_PUBKEY", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_get_ext_d2i", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_get_issuer_name", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_get_pubkey", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_get_serialNumber", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_get_subject_name", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_get_version", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_load_crl_file", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_signature_print", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_X509_verify_cert_error_string", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_d2i_OCSP_RESPONSE", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_d2i_PKCS12_bio", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_i2a_ASN1_OBJECT", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_i2d_X509_PUBKEY", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_i2t_ASN1_OBJECT", referenced from:
      _ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
  "_inflate", referenced from:
      _inflate_stream in libcurl.a(libcurl_la-content_encoding.o)
  "_inflateEnd", referenced from:
      _inflate_stream in libcurl.a(libcurl_la-content_encoding.o)
      _exit_zlib in libcurl.a(libcurl_la-content_encoding.o)
  "_inflateInit2_", referenced from:
      _inflate_stream in libcurl.a(libcurl_la-content_encoding.o)
      _gzip_init_writer in libcurl.a(libcurl_la-content_encoding.o)
  "_inflateInit_", referenced from:
      _deflate_init_writer in libcurl.a(libcurl_la-content_encoding.o)
  "_nghttp2_http2_strerror", referenced from:
      _Curl_http2_strerror in libcurl.a(libcurl_la-http2.o)
      _http2_handle_stream_close in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_is_fatal", referenced from:
      _on_frame_recv in libcurl.a(libcurl_la-http2.o)
      _Curl_http2_switched in libcurl.a(libcurl_la-http2.o)
      _http2_recv in libcurl.a(libcurl_la-http2.o)
      _http2_send in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_pack_settings_payload", referenced from:
      _Curl_http2_request_upgrade in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_priority_spec_init", referenced from:
      _h2_pri_spec in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_callbacks_del", referenced from:
      _Curl_http2_init in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_callbacks_new", referenced from:
      _Curl_http2_init in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_callbacks_set_before_frame_send_callback", referenced from:
      _Curl_http2_init in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_callbacks_set_error_callback", referenced from:
      _Curl_http2_init in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_callbacks_set_on_begin_headers_callback", referenced from:
      _Curl_http2_init in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_callbacks_set_on_data_chunk_recv_callback", referenced from:
      _Curl_http2_init in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_callbacks_set_on_frame_not_send_callback", referenced from:
      _Curl_http2_init in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_callbacks_set_on_frame_recv_callback", referenced from:
      _Curl_http2_init in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_callbacks_set_on_frame_send_callback", referenced from:
      _Curl_http2_init in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_callbacks_set_on_header_callback", referenced from:
      _Curl_http2_init in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_callbacks_set_on_invalid_frame_recv_callback", referenced from:
      _Curl_http2_init in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_callbacks_set_on_stream_close_callback", referenced from:
      _Curl_http2_init in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_callbacks_set_send_callback", referenced from:
      _Curl_http2_init in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_client_new", referenced from:
      _Curl_http2_init in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_del", referenced from:
      _http2_disconnect in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_get_remote_settings", referenced from:
      _on_frame_recv in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_get_stream_user_data", referenced from:
      _on_frame_recv in libcurl.a(libcurl_la-http2.o)
      _on_invalid_frame_recv in libcurl.a(libcurl_la-http2.o)
      _on_data_chunk_recv in libcurl.a(libcurl_la-http2.o)
      _before_frame_send in libcurl.a(libcurl_la-http2.o)
      _on_frame_send in libcurl.a(libcurl_la-http2.o)
      _on_frame_not_send in libcurl.a(libcurl_la-http2.o)
      _on_stream_close in libcurl.a(libcurl_la-http2.o)
      ...
  "_nghttp2_session_mem_recv", referenced from:
      _h2_process_pending_input in libcurl.a(libcurl_la-http2.o)
      _Curl_http2_switched in libcurl.a(libcurl_la-http2.o)
      _http2_recv in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_resume_data", referenced from:
      _Curl_http2_done_sending in libcurl.a(libcurl_la-http2.o)
      _http2_send in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_send", referenced from:
      _http2_send in libcurl.a(libcurl_la-http2.o)
      _h2_session_send in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_set_local_window_size", referenced from:
      _Curl_http2_switched in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_set_stream_user_data", referenced from:
      _Curl_http2_done in libcurl.a(libcurl_la-http2.o)
      _on_frame_recv in libcurl.a(libcurl_la-http2.o)
      _on_stream_close in libcurl.a(libcurl_la-http2.o)
      _Curl_http2_switched in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_upgrade", referenced from:
      _Curl_http2_switched in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_want_read", referenced from:
      _should_close_session in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_session_want_write", referenced from:
      _should_close_session in libcurl.a(libcurl_la-http2.o)
      _http2_getsock in libcurl.a(libcurl_la-http2.o)
      _http2_perform_getsock in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_strerror", referenced from:
      _h2_process_pending_input in libcurl.a(libcurl_la-http2.o)
      _Curl_http2_switched in libcurl.a(libcurl_la-http2.o)
      _http2_recv in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_submit_priority", referenced from:
      _h2_session_send in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_submit_request", referenced from:
      _http2_send in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_submit_rst_stream", referenced from:
      _Curl_http2_done in libcurl.a(libcurl_la-http2.o)
      _on_frame_recv in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_submit_settings", referenced from:
      _Curl_http2_switched in libcurl.a(libcurl_la-http2.o)
  "_nghttp2_version", referenced from:
      _Curl_http2_ver in libcurl.a(libcurl_la-http2.o)
  "_zlibVersion", referenced from:
      _curl_version in libcurl.a(libcurl_la-version.o)
      _curl_version_info in libcurl.a(libcurl_la-version.o)
      _gzip_init_writer in libcurl.a(libcurl_la-content_encoding.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Copy the code

The curl library does not contain the openSSL methods we rely on. The openSSL 1.1.1L library does not contain the openSSL methods we rely on.

2.2 OpenSSL configure Configuration script

May not be able to use off-the-shelf tools, so we have to oneself to research the openssl compiled document, find the website document: wiki.openssl.org/index.php/C…

2.2.1 32 – bit

OpenSSL 1.1.0 and above, 32-bit iOS cross-platform compiler uses ios-Cross as target:

$ export CC=clang; $ export CROSS_TOP=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer $ export CROSS_SDK=iPhoneOS.sdk $ export PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$PATH" $ ./Configure Ios-cross no-shared no-dso no-hw no-engine --prefix= /usr/local/openSSL-ios Configuring Openssl version 1.1.1-dev (0x10101000L) no-afalgeng [forced] OPENSSL_NO_AFALGENG no-asan [default] OPENSSL_NO_ASAN no-dso [option] no-dynamic-engine [forced] ... no-weak-ssl-ciphers [default] OPENSSL_NO_WEAK_SSL_CIPHERS no-zlib [default] no-zlib-dynamic [default] Configuring for Ios-cross PERL = PERL PERLVERSION =5.16.2 for Darwin thread-multi-2level HASHBANGPERL =/usr/bin/env PERL CC =clang CFLAG -o3-d_reentrant-arch armv7-mios-version-min =6.0.0 -isysroot $(CROSS_TOP)/SDKs/$(CROSS_SDK) -fno-common CXX =c++ CXXFLAG =-O3 -d_reentrant -arch armv7 -mios-version-min=6.0.0 -isysroot $(CROSS_TOP)/SDKs/$(CROSS_SDK) -fno-common DEFINES =NDEBUG OPENSSL_THREADS OPENSSL_NO_DYNAMIC_ENGINE OPENSSL_PIC OPENSSL_BN_ASM_MONT OPENSSL_BN_ASM_GF2m SHA1_ASM SHA256_ASM SHA512_ASM AES_ASM BSAES_ASM GHASH_ASM ECP_NISTZ256_ASM POLY1305_ASM ...Copy the code

OpenSSL 1.0.2 and below, using iphoneOS-Cross as the target:

$ export CC=clang;
$ export CROSS_TOP=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
$ export CROSS_SDK=iPhoneOS.sdk
$ export PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$PATH"

$ ./Configure iphoneos-cross no-shared no-dso no-hw no-engine --prefix=/usr/local/openssl-ios
Configuring for iphoneos-cross
    no-dso          [option]
    no-engine       [option]   OPENSSL_NO_ENGINE (skip dir)
    no-gmp          [default]  OPENSSL_NO_GMP (skip dir)
    no-hw           [option]   OPENSSL_NO_HW
    ...
    no-weak-ssl-ciphers [default]  OPENSSL_NO_WEAK_SSL_CIPHERS (skip dir)
    no-zlib         [default]
    no-zlib-dynamic [default]
IsMK1MF=0
CC            =clang
CFLAG         =-DOPENSSL_THREADS -D_REENTRANT -O3 -isysroot $(CROSS_TOP)/SDKs/$(CROSS_SDK) -fomit-frame-pointer -fno-common
...
Copy the code

2.2.2 64 – bit

OpenSSL 1.1.0 and above cross-platform compilers use ios64-cross as targets:

$ export CC=clang; $ export CROSS_TOP=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer $ export CROSS_SDK=iPhoneOS.sdk $ export PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$PATH" $ ./Configure Ios64 -cross no-shared no-dso no-hw no-engine --prefix= /usr/local/openSSL-ios64 Configuring Openssl version 1.1.1-dev (0x10101000L) no-afalgeng [forced] OPENSSL_NO_AFALGENG no-asan [default] OPENSSL_NO_ASAN no-dso [option] no-dynamic-engine [forced] ... no-weak-ssl-ciphers [default] OPENSSL_NO_WEAK_SSL_CIPHERS no-zlib [default] no-zlib-dynamic [default] Configuring for Ios64 -cross PERL = PERL PERLVERSION =5.16.2 for Darwin thread-multi-2level HASHBANGPERL =/usr/bin/env PERL CC =clang CFLAG =-O3 -d_reentrant -arch arm64-mios-version-min =7.0.0 -isYSroot $(CROSS_TOP)/SDKs/$(CROSS_SDK) -fno-common CXX =c++ CXXFLAG = -o3 -d_reentrant -arch arm64-mios-version-min =7.0.0 -isysroot $(CROSS_TOP)/SDKs/$(CROSS_SDK) -fno-common DEFINES =NDEBUG OPENSSL_THREADS OPENSSL_NO_DYNAMIC_ENGINE OPENSSL_PIC OPENSSL_BN_ASM_MONT SHA1_ASM SHA256_ASM SHA512_ASM  VPAES_ASM ECP_NISTZ256_ASM POLY1305_ASM ...Copy the code

Versions 1.0.2 and later do not support 64-bit.

2.3 the target specification

Where are tagets like ios64-cross and ios-cross defined for use? Using 1.1.0h as an example, you can see under Configurations in the source code:

10-main.conf
50-djgpp.conf
50-haiku.conf
50-masm.conf
90-team.conf
INTERNALS.Configure
README
Copy the code

Conf file, we can see the target definition in 10-main.conf:

"iphoneos-cross" => { inherit_from => [ "darwin-common" ], cflags => add("-isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fno-common"), sys_id => "iOS", }, "ios-cross" => { inherit_from => [ "darwin-common", asm("armv4_asm") ], # It should be possible to go below iOS 6 and even add -arch armv6, # thus targeting iPhone pre-3GS, Cflags => add("-arch armv7-mios-version-min = 6.0.0-isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fno-common"), sys_id => "iOS", perlasm_scheme => "ios32", }, "ios64-cross" => { inherit_from => [ "darwin-common", asm("aarch64_asm") ], Cflags => add("-arch arm64-mios-version-min =7.0.0 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fno-common"), sys_id => "iOS", bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR", perlasm_scheme => "ios64", },Copy the code

You can refer to the README of Configurations for other parameters. You can find the corresponding configuration parameter descriptions according to the README.

2.4 Merging static libraries

In addition to the OpenSSL static library, the CPU architecture of iOS devices has two types of emulator and real machine support:

  1. 4-5: i386 architecture
  2. IPhone 5S-8 Plus: X86_64 architecture

Support on real devices:

  1. Armv6: iPhone, iPhone 2, iPhone 3G, iPod Touch(1st generation), iPod Touch(2nd generation)
  2. Armv7: iPhone 3Gs, iPhone 4, iPhone 4S, iPad, iPad 2
  3. Armv7s: iPhone 5, iPhone 5C (static libraries can run on armV7s architecture as long as they support ARMV7)
  4. Arm64: iPhone 5S, iPhone 6, iPhone 6 Plus, iPhone 6s, iPhone 6s Plus, iPad Air, iPad Air2, iPad Mini2, iPad Mini3

We failed to merge multiple schema libraries into one:

have the same architectures (x86_64) and can't be in the same fat output file
Copy the code

Let’s start with lipo.

Lipo is a tool to manage Fat files by looking at CPU architectures, extracting specific architectures, consolidating and splitting library files.

  • Lipo-info XXXX. framework/ XXXX or /xxxx.a View the list of supported CPU architectures
  • Lipo -create XXXX xxxx-output XXX into a Fat file
  • Lipo XXXX -thin CPU (armv7/ ARM64, etc.) -output XXX Extracts thin files for a specific CPU architecture
  • Lipo -remove CPU (armv7/arm64, etc.) xxxx-output XXXX Removes files of a specific CPU architecture

X86_64 and arm64 have the same architecture as arm64. Libcurl and nghttp2 have the same architecture as arm64.

2.5 Dynamic Libraries Static libraries are chaotic

After compiling libcur, I was able to compile my own code. However, when I run the script, I still have the same error, including Undefined symbols. Finally, I went to talk to my iOS classmates and realized that all the compilation products configured in the Cmake script of my project were dynamic libraries, while iOS needed static libraries, and there would be problems if dynamic libraries depended on static libraries. Finally, I compiled the final product after modifying dozens of cmakelists.txt.

3. Summary

Openssl Configurations took a bit of time to learn about and try your luck. Second, the problem caused by dynamic library reference static library is mistaken as version mismatch problem and wasted a lot of time.