librdkafka compiling error on OS X 10.12.5 (16F2073)

Created on 16 Jan 2018  路  6Comments  路  Source: edenhill/librdkafka

Description

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

How to reproduce

  1. Clone master, git pull
  2. ./configure
  3. make

Here is a gif screen replay of the terminal session

Checklist

Please provide the following information:

  • [x] librdkafka version (release number or git tag): 9d738e485047876615d14a2f22d53f4909f9e04d (HEAD) and b581d0d9df282847f76e8b9e87337161959d39c9 (v0.11.3)
  • [x] Apache Kafka version: 1.0.0
  • [x] librdkafka client configuration: N/A
  • [x] Operating system: Mac OS X 10.12.5 (16F2073)
  • [x] Provide logs (with debug=.. as necessary) from librdkafka (see build logs) - terminal session
  • [x] Provide broker log excerpts - N/A
  • [ ] Critical issue - Probably not

Apologies 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.

Most helpful comment

Try: ./configure --clean ; CFLAGS=-I/usr/local/opt/openssl/include LDFLAGS=-L/usr/local/opt/openssl/lib ./configure && make

All 6 comments

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:

  1. Upgraded OpenSSL from Homebrew
  2. Passed -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.
  3. ./configure --clean && ./configure && make

The 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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

twaters picture twaters  路  5Comments

mirroj picture mirroj  路  3Comments

coolulu picture coolulu  路  7Comments

roopabayar picture roopabayar  路  5Comments

vahidhashemian picture vahidhashemian  路  6Comments