操作系统OS X 10.11
下载openssl
https://www.openssl.org/source/
自己为了方便打包签名,编译成静态库
这里下载的版本为openssl-1.1.1c.tar.gz
tar -zxf openssl-1.1.1c.tar.gz
cd openssl-1.1.1c
./config -fPIC no-shared --prefix=/usr/local
make
sudo make install
下载libcurl
自己为了方便打包签名,同样编译成了静态库
这里下载的版本为curl-7.61.0.zip
unzip curl-7.61.0.zip
cd curl-7.61.0
./configure CFLAGS=-fPIC --disable-ldap --disable-ldaps --enable-shared=no
make
报错信息如下
Undefined symbols for architecture x86_64:
"_ASN1_STRING_get0_data", referenced from:
_ossl_connect_common in libcurl.a(libcurl_la-openssl.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)
"_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_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_id", referenced from:
_ossl_connect_common 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)
"_RSA_get0_key", 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_ciphersuites", referenced from:
_ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
"_SSL_CTX_set_keylog_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_get0_alpn_selected", referenced from:
_ossl_connect_common in libcurl.a(libcurl_la-openssl.o)
"_TLS_client_method", referenced from:
_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_version", referenced from:
_ossl_connect_common in libcurl.a(libcurl_la-openssl.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]: *** [curl] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1
解决方法
在curl-7.61.0目录执行
./configure CFLAGS=-fPIC --disable-ldap --disable-ldaps --enable-shared=no --without-darwinssl --with-ssl=/usr/local
make
sudo make install
--without-darwinssl 禁用Apple OS本机SSL/TLS
--with-ssl=/usr/local 指定openssl的位置