Ubuntu 20.04 - `make` command causes "has not been declared" errors
adammpolak opened this issue · 4 comments
I was able to run cmake ..
-- librdkafka include directory: /usr/include
-- librdkafka library directory: /usr/lib/x86_64-linux-gnu/
-- pthread library: /usr/lib/x86_64-linux-gnu/libpthread.so
-- With NO clang-tidy build option
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0")
-- boost include directory: /usr/include
-- boost library directory:
-- googletest root directory: /usr/src/googletest/googletest
-- rapidjson include directory: /usr/include
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: program_options
-- boost include directory: /usr/include
-- boost library directory: /usr/lib/x86_64-linux-gnu
-- Configuring done
-- Generating done
-- Build files have been written to: /home/adam/dev/modern-cpp-kafka/build
make install
doesn't work
[ 2%] Building CXX object tests/unit/CMakeFiles/kafka-unit-test.dir/TestBrokerMetadata.cc.o
In file included from /home/adam/dev/modern-cpp-kafka/include/kafka/Error.h:5,
from /home/adam/dev/modern-cpp-kafka/include/kafka/KafkaException.h:5,
from /home/adam/dev/modern-cpp-kafka/include/kafka/BrokerMetadata.h:5,
from /home/adam/dev/modern-cpp-kafka/tests/unit/TestBrokerMetadata.cc:1:
/home/adam/dev/modern-cpp-kafka/include/kafka/RdKafkaHelper.h:42:49: error: ‘rd_kafka_DeleteRecords_t’ has not been declared
42 | struct RkDeleteRecordsDeleter { void operator()(rd_kafka_DeleteRecords_t* p) { rd_kafka_DeleteRecords_destroy(p); } };
| ^~~~~~~~~~~~~~~~~~~~~~~~
/home/adam/dev/modern-cpp-kafka/include/kafka/RdKafkaHelper.h: In member function ‘void kafka::RkDeleteRecordsDeleter::operator()(int*)’:
/home/adam/dev/modern-cpp-kafka/include/kafka/RdKafkaHelper.h:42:80: error: ‘rd_kafka_DeleteRecords_destroy’ was not declared in this scope; did you mean ‘rd_kafka_DeleteTopic_destroy’?
42 | struct RkDeleteRecordsDeleter { void operator()(rd_kafka_DeleteRecords_t* p) { rd_kafka_DeleteRecords_destroy(p); } };
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| rd_kafka_DeleteTopic_destroy
/home/adam/dev/modern-cpp-kafka/include/kafka/RdKafkaHelper.h: At global scope:
/home/adam/dev/modern-cpp-kafka/include/kafka/RdKafkaHelper.h:43:59: error: ‘rd_kafka_DeleteRecords_t’ was not declared in this scope; did you mean ‘rd_kafka_DeleteTopic_t’?
43 | using rd_kafka_DeleteRecords_unique_ptr = std::unique_ptr<rd_kafka_DeleteRecords_t, RkDeleteRecordsDeleter>;
| ^~~~~~~~~~~~~~~~~~~~~~~~
| rd_kafka_DeleteTopic_t
/home/adam/dev/modern-cpp-kafka/include/kafka/RdKafkaHelper.h:43:107: error: template argument 1 is invalid
43 | using rd_kafka_DeleteRecords_unique_ptr = std::unique_ptr<rd_kafka_DeleteRecords_t, RkDeleteRecordsDeleter>;
Hi, @adammpolak You just need to update the installed librdkafka
version.
~/dev/modern-cpp-kafka/build$ sudo apt-get install librdkafka-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
librdkafka-dev is already the newest version (1.2.1-1ubuntu1).
I believe I have the latest librdkafka
installed
I found my librdkafka
locations by running:
~/dev/modern-cpp-kafka/build$ dpkg -L librdkafka-dev
/.
/usr
/usr/include
/usr/include/librdkafka
/usr/include/librdkafka/rdkafka.h
/usr/include/librdkafka/rdkafkacpp.h
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/librdkafka++.a
/usr/lib/x86_64-linux-gnu/librdkafka.a
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/rdkafka++.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/rdkafka.pc
/usr/share
/usr/share/doc
/usr/share/doc/librdkafka-dev
/usr/share/doc/librdkafka-dev/copyright
/usr/share/doc/librdkafka-dev/examples
/usr/share/doc/librdkafka-dev/examples/rdkafka_example.c
/usr/share/doc/librdkafka-dev/examples/rdkafka_performance.c
/usr/lib/x86_64-linux-gnu/librdkafka++.so
/usr/lib/x86_64-linux-gnu/librdkafka.so
/usr/share/doc/librdkafka-dev/changelog.Debian.gz
And updated line 46 47 on CmakeLists.txt to use these directories:
set(LIBRDKAFKA_INCLUDE_DIR /usr/include)
set(LIBRDKAFKA_LIBRARY_DIR /usr/lib/x86_64-linux-gnu/)
Nevermind, I see that you need to do more than apt-get install
thank you
Hi, @adammpolak The librdkafka version (installed with sudo apt-get install librdkafka-dev
, in ubuntu 20.04) is 1.2.1
, which was released almost 3 years ago! I'd suggest to move to v1.9.2
.
There's a LIBRDKAFKA_ROOT
for users to customize installed locations, while obviously it doesn't work for your case, -- I guess I should offer separated env var (e.g. LIBRDKAFKA_INCLUDE_DIR
/LIBRDKAFKA_LIBRARY_DIR
) instead, - would improve it later.
Thanks!