rust-rdkafka
rust-rdkafka copied to clipboard
Build failed with ssl features on mac m1
Build is failing with following message when we run rdkafka with ssl feature enabled on mac m1.
Undefined symbols for architecture arm64:
"_SSL_get1_peer_certificate", referenced from:
_rd_kafka_transport_ssl_handshake in librdkafka_sys-66bfa0eb454c4b25.rlib(rdkafka_ssl.c.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
openssl version: OpenSSL 1.1.1q 5 Jul 2022
uname -m: arm64
Exporting the OPENSSL_ROOT_DIR
makes the build works for me.
Example:
export OPENSSL_ROOT_DIR="/opt/homebrew/opt/openssl@3"
This is expected behavior. If you enable the ssl
feature, rdkafka-sys will link against your system's OpenSSL. On an M1 Mac, there is no system OpenSSL unless you install OpenSSL with Homebrew and set OPENSSL_ROOT_DIR
, as demonstrated above. You can instead use the ssl-vendored
feature if you'd prefer to have Cargo download and build a bundled copy of OpenSSL.