'How to use own openssl header in libcurl on macOS
I download and compile openssl 3.0.2 from source and want to link it with libcurl on macOS, however, I encounter some issues, I use latest libcurl 7.82.0.
below is configure.
./configure --prefix="$(pwd)/curl" --with-ssl=/Users/test/Downloads/openssl-openssl-3.0.2/openssl --enable-static --disable-shared --disable-ftp --disable-file --disable-ldap --disable-dict --disable-telnet --disable-tftp --disable-rtsp --disable-pop3 --disable-imap --disable-smtp --disable-gopher --disable-ares --disable-debug --with-zlib=/Users/test/Downloads/zlib-1.2.11/zlib --without-libidn --without-brotli --without-zstd --without-nghttp2 --without-librtmp --without-libidn2 --without-winidn
and configure result looks ok, The openssl include folder is set.
Host setup: x86_64-apple-darwin20.6.0
Install prefix: /Users/test/Downloads/curl-7.82.0/curl
Compiler: gcc
CFLAGS: -Qunused-arguments -Wno-pointer-bool-conversion -Os -Werror=partial-availability -pthread
CPPFLAGS: -isystem /Users/test/Downloads/zlib-1.2.11/zlib/include -isystem /Users/test/Downloads/openssl-openssl-3.0.2/openssl/include -DOPENSSL_SUPPRESS_DEPRECATED
LDFLAGS: -framework CoreFoundation -framework SystemConfiguration -L/Users/test/Downloads/zlib-1.2.11/zlib/lib -L/Users/test/Downloads/openssl-openssl-3.0.2/openssl/lib
LIBS: -lssl -lcrypto -lssl -lcrypto -lz
curl version: 7.82.0
SSL: enabled (OpenSSL v3+)
But when make, it will output error:
Undefined symbols for architecture x86_64:
"_EVP_PKEY_id", 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)
ld: symbol(s) not found for architecture x86_64
Test: I found os installed openssl at /usr/local/include/openssl which is 1.1.1m, After I remove this folder, The error is fixed. So I think the system installed openssl header is affected in libcurl make.
I think I have configured libcurl to use /Users/test/Downloads/openssl-openssl-3.0.2/openssl/include, but it does not work.
Thanks in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
