With default ./configure and make, clang linker fails with:
Undefined symbols for architecture x86_64:
"_ERR_remove_thread_state", referenced from:
_rd_kafka_broker_thread_main in rdkafka_broker.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[1]: *** [librdkafka.1.dylib] Error 1
make: *** [libs] Error 2
git pull./configuremakeHere is a gif screen replay of the terminal session
Please provide the following information:
9d738e485047876615d14a2f22d53f4909f9e04d (HEAD) and b581d0d9df282847f76e8b9e87337161959d39c9 (v0.11.3)1.0.0Mac OS X 10.12.5 (16F2073)debug=.. as necessary) from librdkafka (see build logs) - terminal sessionApologies if this is some silly local configuration problem. I had no trouble compiling a separate program and linking against the version of librdkafka installed via Homebrew. I am now trying to compile it from source so that I can use some of the code in the examples folder. I searched around but was unable to find anything that looked quite like the above error.
I think one workaround for this problem is installing openssl from homebrew and rerunning configure + make, but doing ./configure --clean first.
So that got me a little farther, what I did:
-I/usr/local/opt/openssl/include to CPPFLAGS and -L/usr/local/opt/openssl/lib to LIB_LDFLAGS in the Makefile.config to make sure it didn't try to link against the pre-installed OpenSSL version../configure --clean && ./configure && makeThe compiler got much farther, but failed when it reached examples.
Checking librdkafka integrity
librdkafka.1.dylib OK
librdkafka.a OK
Symbol visibility OK
Checking librdkafka++ integrity
librdkafka++.1.dylib OK
librdkafka++.a OK
/Library/Developer/CommandLineTools/usr/bin/make -C examples
gcc -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -I/usr/local/opt/openssl/include -I../src rdkafka_example.c -o rdkafka_example \
../src/librdkafka.a -lpthread -lz -lcrypto -llz4 -lssl -lsasl2 -ldl
Undefined symbols for architecture x86_64:
"_ERR_remove_thread_state", referenced from:
_rd_kafka_broker_thread_main in librdkafka.a(rdkafka_broker.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[1]: *** [rdkafka_example] Error 1
make: *** [examples] Error 2
Same error. Thoughts?
Try: ./configure --clean ; CFLAGS=-I/usr/local/opt/openssl/include LDFLAGS=-L/usr/local/opt/openssl/lib ./configure && make
That did it! Thank you so much for the guidance.
ProductName: Mac OS X
ProductVersion: 10.12.6
BuildVersion: 16G29
I was facing the same error, when I tried ./configure --clean, setting CFLAGS, followed by ./configure && make.
But executing the commands in shot resolved the issue.
./configure --clean ; CFLAGS=-I/usr/local/opt/openssl/include LDFLAGS=-L/usr/local/opt/openssl/lib ./configure && make
Thanks.
try:
brew link openssl
Most helpful comment
Try:
./configure --clean ; CFLAGS=-I/usr/local/opt/openssl/include LDFLAGS=-L/usr/local/opt/openssl/lib ./configure && make