Librdkafka: How to use librdkafka++.a

Created on 10 Mar 2017  路  3Comments  路  Source: edenhill/librdkafka

Description

I've used librdkafka as a dynamic library up to now, but I would now use it as a static library.
librdkafka++.a is well compiled but when I try to use it in my project I get a linking error
target_link_libraries(${PROJECT_NAME} /usr/local/lib/librdkafka++.a )

GNU ld (GNU Binutils for Ubuntu) 2.26.1
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(RdKafka.o): In function `RdKafka::version_str[abi:cxx11]()':
/home/vincent/git/librdkafka/src-cpp/RdKafka.cpp:38: undefined reference to `rd_kafka_version_str'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(RdKafka.o): In function `RdKafka::err2str[abi:cxx11](RdKafka::ErrorCode)':
/home/vincent/git/librdkafka/src-cpp/RdKafka.cpp:46: undefined reference to `rd_kafka_err2str'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(RdKafka.o): In function `RdKafka::version()':
/home/vincent/git/librdkafka/src-cpp/RdKafka.cpp:34: undefined reference to `rd_kafka_version'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(RdKafka.o): In function `RdKafka::wait_destroyed(int)':
/home/vincent/git/librdkafka/src-cpp/RdKafka.cpp:50: undefined reference to `rd_kafka_wait_destroyed'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ConfImpl.o): In function `RdKafka::ConfImpl::dump[abi:cxx11]()':
/home/vincent/git/librdkafka/src-cpp/ConfImpl.cpp:66: undefined reference to `rd_kafka_conf_dump'
/home/vincent/git/librdkafka/src-cpp/ConfImpl.cpp:74: undefined reference to `rd_kafka_conf_dump_free'
/home/vincent/git/librdkafka/src-cpp/ConfImpl.cpp:68: undefined reference to `rd_kafka_topic_conf_dump'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ConfImpl.o): In function `RdKafka::ConfImpl::set(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
/home/vincent/git/librdkafka/src-cpp/ConfImpl.cpp:46: undefined reference to `rd_kafka_conf_set'
/home/vincent/git/librdkafka/src-cpp/ConfImpl.cpp:50: undefined reference to `rd_kafka_topic_conf_set'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ConfImpl.o): In function `RdKafka::Conf::create(RdKafka::Conf::ConfType)':
/home/vincent/git/librdkafka/src-cpp/ConfImpl.cpp:86: undefined reference to `rd_kafka_topic_conf_new'
/home/vincent/git/librdkafka/src-cpp/ConfImpl.cpp:84: undefined reference to `rd_kafka_conf_new'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ConfImpl.o): In function `RdKafka::ConfImpl::~ConfImpl()':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:234: undefined reference to `rd_kafka_conf_destroy'
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:236: undefined reference to `rd_kafka_topic_conf_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ConfImpl.o): In function `RdKafka::ConfImpl::~ConfImpl()':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:234: undefined reference to `rd_kafka_conf_destroy'
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:236: undefined reference to `rd_kafka_topic_conf_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ConfImpl.o): In function `RdKafka::ConfImpl::get(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) const':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:428: undefined reference to `rd_kafka_conf_get'
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:433: undefined reference to `rd_kafka_conf_get'
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:438: undefined reference to `rd_kafka_topic_conf_get'
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:443: undefined reference to `rd_kafka_topic_conf_get'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ConfImpl.o): In function `RdKafka::ConfImpl::set(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, RdKafka::Conf const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:305: undefined reference to `rd_kafka_topic_conf_dup'
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:307: undefined reference to `rd_kafka_conf_set_default_topic_conf'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::ProducerImpl::produce(RdKafka::Topic*, int, std::vector<char, std::allocator<char> > const*, std::vector<char, std::allocator<char> > const*, void*)':
/home/vincent/git/librdkafka/src-cpp/ProducerImpl.cpp:135: undefined reference to `rd_kafka_produce'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::ProducerImpl::produce(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int, void*, unsigned long, void const*, unsigned long, long, void*)':
/home/vincent/git/librdkafka/src-cpp/ProducerImpl.cpp:166: undefined reference to `rd_kafka_producev'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::ProducerImpl::produce(RdKafka::Topic*, int, int, void*, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, void*)':
/home/vincent/git/librdkafka/src-cpp/ProducerImpl.cpp:99: undefined reference to `rd_kafka_produce'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::ProducerImpl::produce(RdKafka::Topic*, int, int, void*, unsigned long, void const*, unsigned long, void*)':
/home/vincent/git/librdkafka/src-cpp/ProducerImpl.cpp:118: undefined reference to `rd_kafka_produce'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::MessageImpl::~MessageImpl()':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:124: undefined reference to `rd_kafka_message_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::Producer::create(RdKafka::Conf*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
/home/vincent/git/librdkafka/src-cpp/ProducerImpl.cpp:68: undefined reference to `rd_kafka_conf_dup'
/home/vincent/git/librdkafka/src-cpp/ProducerImpl.cpp:71: undefined reference to `rd_kafka_conf_set_dr_msg_cb'
/home/vincent/git/librdkafka/src-cpp/ProducerImpl.cpp:78: undefined reference to `rd_kafka_new'
/home/vincent/git/librdkafka/src-cpp/ProducerImpl.cpp:78: undefined reference to `rd_kafka_new'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::ProducerImpl::~ProducerImpl()':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:832: undefined reference to `rd_kafka_destroy'
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:832: undefined reference to `rd_kafka_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::ProducerImpl::produce(RdKafka::Topic*, int, std::vector<char, std::allocator<char> > const*, std::vector<char, std::allocator<char> > const*, void*)':
/home/vincent/git/librdkafka/src-cpp/ProducerImpl.cpp:140: undefined reference to `rd_kafka_errno2err'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::ProducerImpl::produce(RdKafka::Topic*, int, int, void*, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, void*)':
/home/vincent/git/librdkafka/src-cpp/ProducerImpl.cpp:121: undefined reference to `rd_kafka_errno2err'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::ProducerImpl::produce(RdKafka::Topic*, int, int, void*, unsigned long, void const*, unsigned long, void*)':
/home/vincent/git/librdkafka/src-cpp/ProducerImpl.cpp:121: undefined reference to `rd_kafka_errno2err'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::MessageImpl::~MessageImpl()':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:124: undefined reference to `rd_kafka_message_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::MessageImpl::timestamp() const':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:196: undefined reference to `rd_kafka_message_timestamp'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::HandleImpl::offsetsForTimes(std::vector<RdKafka::TopicPartition*, std::allocator<RdKafka::TopicPartition*> >&, int)':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:581: undefined reference to `rd_kafka_offsets_for_times'
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:583: undefined reference to `rd_kafka_topic_partition_list_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::HandleImpl::get_watermark_offsets(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, long*, long*)':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:572: undefined reference to `rd_kafka_get_watermark_offsets'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::HandleImpl::query_watermark_offsets(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, long*, long*, int)':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:563: undefined reference to `rd_kafka_query_watermark_offsets'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::HandleImpl::outq_len()':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:546: undefined reference to `rd_kafka_outq_len'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::HandleImpl::poll(int)':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:545: undefined reference to `rd_kafka_poll'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::ProducerImpl::flush(int)':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:860: undefined reference to `rd_kafka_flush'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::HandleImpl::name[abi:cxx11]() const':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:537: undefined reference to `rd_kafka_name'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::MessageImpl::errstr[abi:cxx11]() const':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:161: undefined reference to `rd_kafka_err2str'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::MessageImpl::topic_name[abi:cxx11]() const':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:172: undefined reference to `rd_kafka_topic_name'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::HandleImpl::memberid[abi:cxx11]() const':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:539: undefined reference to `rd_kafka_memberid'
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:542: undefined reference to `rd_kafka_mem_free'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::MessageImpl::~MessageImpl()':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:124: undefined reference to `rd_kafka_message_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::ProducerImpl::~ProducerImpl()':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:832: undefined reference to `rd_kafka_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(ProducerImpl.o): In function `RdKafka::ProducerImpl::~ProducerImpl()':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:832: undefined reference to `rd_kafka_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(TopicImpl.o): In function `RdKafka::Topic::create(RdKafka::Handle*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, RdKafka::Conf*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
/home/vincent/git/librdkafka/src-cpp/TopicImpl.cpp:90: undefined reference to `rd_kafka_topic_conf_dup'
/home/vincent/git/librdkafka/src-cpp/TopicImpl.cpp:96: undefined reference to `rd_kafka_topic_conf_set_opaque'
/home/vincent/git/librdkafka/src-cpp/TopicImpl.cpp:101: undefined reference to `rd_kafka_topic_conf_set_partitioner_cb'
/home/vincent/git/librdkafka/src-cpp/TopicImpl.cpp:111: undefined reference to `rd_kafka_topic_new'
/home/vincent/git/librdkafka/src-cpp/TopicImpl.cpp:105: undefined reference to `rd_kafka_topic_conf_set_partitioner_cb'
/home/vincent/git/librdkafka/src-cpp/TopicImpl.cpp:88: undefined reference to `rd_kafka_topic_conf_new'
/home/vincent/git/librdkafka/src-cpp/TopicImpl.cpp:96: undefined reference to `rd_kafka_topic_conf_set_opaque'
/home/vincent/git/librdkafka/src-cpp/TopicImpl.cpp:113: undefined reference to `rd_kafka_errno2err'
/home/vincent/git/librdkafka/src-cpp/TopicImpl.cpp:113: undefined reference to `rd_kafka_err2str'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(TopicImpl.o): In function `RdKafka::TopicImpl::~TopicImpl()':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:609: undefined reference to `rd_kafka_topic_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(TopicImpl.o): In function `RdKafka::Topic::create(RdKafka::Handle*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, RdKafka::Conf*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
/home/vincent/git/librdkafka/src-cpp/TopicImpl.cpp:115: undefined reference to `rd_kafka_topic_conf_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(TopicImpl.o): In function `RdKafka::TopicImpl::offset_store(int, long)':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:622: undefined reference to `rd_kafka_offset_store'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(TopicImpl.o): In function `RdKafka::TopicImpl::partition_available(int) const':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:617: undefined reference to `rd_kafka_topic_partition_available'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(TopicImpl.o): In function `RdKafka::TopicImpl::name[abi:cxx11]() const':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:613: undefined reference to `rd_kafka_topic_name'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(TopicImpl.o): In function `RdKafka::TopicImpl::~TopicImpl()':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:609: undefined reference to `rd_kafka_topic_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(TopicImpl.o): In function `RdKafka::TopicImpl::~TopicImpl()':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:609: undefined reference to `rd_kafka_topic_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(HandleImpl.o): In function `RdKafka::HandleImpl::metadata(bool, RdKafka::Topic const*, RdKafka::Metadata**, int)':
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:137: undefined reference to `rd_kafka_metadata'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(HandleImpl.o): In function `RdKafka::HandleImpl::get_partition_queue(RdKafka::TopicPartition const*)':
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:299: undefined reference to `rd_kafka_queue_get_partition'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(HandleImpl.o): In function `RdKafka::consume_cb_trampoline(rd_kafka_message_s*, void*)':
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:37: undefined reference to `rd_kafka_topic_opaque'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(HandleImpl.o): In function `RdKafka::MessageImpl::~MessageImpl()':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:124: undefined reference to `rd_kafka_message_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(HandleImpl.o): In function `RdKafka::log_cb_trampoline(rd_kafka_s const*, int, char const*, char const*)':
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:51: undefined reference to `rd_kafka_opaque'
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:47: undefined reference to `rd_kafka_log_print'
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:55: undefined reference to `rd_kafka_log_print'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(HandleImpl.o): In function `RdKafka::HandleImpl::set_common_config(RdKafka::ConfImpl*)':
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:211: undefined reference to `rd_kafka_conf_set_opaque'
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:215: undefined reference to `rd_kafka_conf_set_log_cb'
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:217: undefined reference to `rd_kafka_conf_set_error_cb'
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:219: undefined reference to `rd_kafka_conf_set_throttle_cb'
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:221: undefined reference to `rd_kafka_conf_set_stats_cb'
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:227: undefined reference to `rd_kafka_conf_set_socket_cb'
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:233: undefined reference to `rd_kafka_conf_set_open_cb'
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:240: undefined reference to `rd_kafka_conf_set_rebalance_cb'
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:246: undefined reference to `rd_kafka_conf_set_offset_commit_cb'
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:252: undefined reference to `rd_kafka_conf_set_consume_cb'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(HandleImpl.o): In function `RdKafka::partitions_to_c_parts(std::vector<RdKafka::TopicPartition*, std::allocator<RdKafka::TopicPartition*> > const&)':
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:327: undefined reference to `rd_kafka_topic_partition_list_new'
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:334: undefined reference to `rd_kafka_topic_partition_list_add'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(HandleImpl.o): In function `RdKafka::HandleImpl::pause(std::vector<RdKafka::TopicPartition*, std::allocator<RdKafka::TopicPartition*> >&)':
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:266: undefined reference to `rd_kafka_pause_partitions'
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:271: undefined reference to `rd_kafka_topic_partition_list_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(HandleImpl.o): In function `RdKafka::HandleImpl::resume(std::vector<RdKafka::TopicPartition*, std::allocator<RdKafka::TopicPartition*> >&)':
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:284: undefined reference to `rd_kafka_resume_partitions'
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:289: undefined reference to `rd_kafka_topic_partition_list_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(HandleImpl.o): In function `RdKafka::HandleImpl::set_log_queue(RdKafka::Queue*)':
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:318: undefined reference to `rd_kafka_set_log_queue'
/home/vincent/git/librdkafka/src-cpp/HandleImpl.cpp:318: undefined reference to `rd_kafka_set_log_queue'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(QueueImpl.o): In function `RdKafka::QueueImpl::consume(int)':
/home/vincent/git/librdkafka/src-cpp/QueueImpl.cpp:56: undefined reference to `rd_kafka_consume_queue'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(QueueImpl.o): In function `RdKafka::MessageImpl::MessageImpl(rd_kafka_message_s*)':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:143: undefined reference to `rd_kafka_topic_opaque'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(QueueImpl.o): In function `RdKafka::QueueImpl::forward(RdKafka::Queue*)':
/home/vincent/git/librdkafka/src-cpp/QueueImpl.cpp:49: undefined reference to `rd_kafka_queue_forward'
/home/vincent/git/librdkafka/src-cpp/QueueImpl.cpp:46: undefined reference to `rd_kafka_queue_forward'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(QueueImpl.o): In function `RdKafka::Queue::create(RdKafka::Handle*)':
/home/vincent/git/librdkafka/src-cpp/QueueImpl.cpp:39: undefined reference to `rd_kafka_queue_new'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(QueueImpl.o): In function `RdKafka::QueueImpl::poll(int)':
/home/vincent/git/librdkafka/src-cpp/QueueImpl.cpp:65: undefined reference to `rd_kafka_queue_poll_callback'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(QueueImpl.o): In function `RdKafka::QueueImpl::~QueueImpl()':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:793: undefined reference to `rd_kafka_queue_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(QueueImpl.o): In function `RdKafka::QueueImpl::~QueueImpl()':
/home/vincent/git/librdkafka/src-cpp/rdkafkacpp_int.h:793: undefined reference to `rd_kafka_queue_destroy'
/home/vincent/git/librdkafka/src-cpp/librdkafka++.a(MetadataImpl.o): In function `RdKafka::MetadataImpl::~MetadataImpl()':
/home/vincent/git/librdkafka/src-cpp/MetadataImpl.cpp:150: undefined reference to `rd_kafka_metadata_destroy'
collect2: error: ld returned 1 exit status

then as I've understood by it's size librdkafka++.a doesn't contain librdkafka.a
is that normal ? is that intended ? is that the usage when working with static library ?
I thought static library were supposed to be self contained.
Shouldn't it be explained in README.md how to compile / and use librdkafka++ (and librdkafka) if compiled statically ?

after changing my CMake to
target_link_libraries(${PROJECT_NAME} /usr/local/lib/librdkafka.a /usr/local/lib/librdkafka++.a )

I now have one error :

GNU ld (GNU Binutils for Ubuntu) 2.26.1
/usr/bin/ld: /usr/local/lib/librdkafka.a(tinycthread.o): undefined reference to symbol 'pthread_rwlock_wrlock@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

then I add pthread
target_link_libraries(${PROJECT_NAME} pthread /usr/local/lib/librdkafka.a /usr/local/lib/librdkafka++.a )
and get

GNU ld (GNU Binutils for Ubuntu) 2.26.1
/usr/bin/ld: /usr/local/lib/librdkafka.a(rdkafka_transport.o): undefined reference to symbol 'SSL_get_verify_result@@OPENSSL_1.0.0'
//lib/x86_64-linux-gnu/libssl.so.1.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

the I have tried to write ssl before pthread in my cmake target_link_libraries, but I still have the same error and don't know what to do next.

How to reproduce

Checklist

Please provide the following information:

  • [ ebe76d9735f17311f36ce3513c2e33463a4b480a v0.9.4] librdkafka version (release number or git tag):
  • [ ] Apache Kafka version:
  • [ ] librdkafka client configuration:
  • [ 16.04] Operating system:
  • [ ] Using the legacy Consumer
  • [ ] Using the high-level KafkaConsumer
  • [ ] Provide logs (with debug=.. as necessary) from librdkafka
  • [ ] Provide broker log excerpts
  • [ ] Critical issue

Most helpful comment

So, after much time spent on this I've finally found a way to compile with librdkafka++.a

My problem must be with the order in which the linkage of all the libraries is performed.
I must say that I haven't yet understood how linkage order works completely but
the following cmake command makes me the ld error (undefined reference to symbol 'SSL_get_verify_result@@OPENSSL_1.0.0')
target_link_libraries(${PROJECT_NAME} ssl crypto pthread librdkafka.a librdkafka++.a

but this one
target_link_libraries(${PROJECT_NAME} ssl crypto pthread librdkafka++.a librdkafka.a
links well
as this one which links well too
target_link_libraries(${PROJECT_NAME} librdkafka.a librdkafka++.a ssl crypto pthread

so IF
librdkafka.a is in between at least one of the 3 dependencies (ssl,crypto or pthread) and librdkafka++.a
AND librdkafka.a is declared before librdkafka++.a
THEN links fails with one of the 3 dependent libraries

All 3 comments

You are probably right that librdkafka++.a should include librdkafka.a, I will look into it.

Did you try to use pkg-config?

E.g. pkg-config --libs --static rdkafka++

I get :

$ pkg-config --libs --static rdkafka++
-L/usr/local/lib -lrdkafka++ -lrdkafka -lstdc++

So, after much time spent on this I've finally found a way to compile with librdkafka++.a

My problem must be with the order in which the linkage of all the libraries is performed.
I must say that I haven't yet understood how linkage order works completely but
the following cmake command makes me the ld error (undefined reference to symbol 'SSL_get_verify_result@@OPENSSL_1.0.0')
target_link_libraries(${PROJECT_NAME} ssl crypto pthread librdkafka.a librdkafka++.a

but this one
target_link_libraries(${PROJECT_NAME} ssl crypto pthread librdkafka++.a librdkafka.a
links well
as this one which links well too
target_link_libraries(${PROJECT_NAME} librdkafka.a librdkafka++.a ssl crypto pthread

so IF
librdkafka.a is in between at least one of the 3 dependencies (ssl,crypto or pthread) and librdkafka++.a
AND librdkafka.a is declared before librdkafka++.a
THEN links fails with one of the 3 dependent libraries

Was this page helpful?
0 / 5 - 0 ratings