Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linker errors on clang 7.0.1 on Linux #166

Open
luxuki opened this issue Feb 8, 2019 · 4 comments
Open

Linker errors on clang 7.0.1 on Linux #166

luxuki opened this issue Feb 8, 2019 · 4 comments

Comments

@luxuki
Copy link

luxuki commented Feb 8, 2019

I built cppkafka (v0.3.0 release) with:

CPPKAFKA_BUILD_SHARED OFF
CPPKAFKA_RDKAFKA_STATIC_LIB ON

cppkafka build was successful.

Tried building consumer_dispatcher_example.cpp. Works on g++ 8.1.0 but when built (both the example and cppkafka) with clang++7.0.1 it cannot find a few symbols from librdkafka.a:

.../cppkafka/lib/libcppkafka.a(error.cpp.o): In function `cppkafka::Error::to_string[abi:cxx11]() const':
.../cppkafka/src/error.cpp:48: undefined reference to `rd_kafka_err2str'
.../cppkafka/lib/libcppkafka.a(metadata.cpp.o): In function `Metadata':
.../cppkafka/src/metadata.cpp:128: undefined reference to `rd_kafka_metadata_destroy'

Any idea why that might be happening?

@mfontanini
Copy link
Owner

How are you building the example? By running make examples?

@luxuki
Copy link
Author

luxuki commented Feb 8, 2019

I was building it directly passing files into compiler (without a Makefile). Did couple more checks - it seems to be not working with either g++ or clang++ as long as optimisation mode is less than O2. Works perfectly fine with O2 and O3, cannot find the symbols if built with O0 or O1.
Very strange.

@mfontanini
Copy link
Owner

Are you linking with rdkafka? Because that would do it.

@csfreebird
Copy link

use 'ldd your_binary' command, see the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants