modern-cpp-kafka consumer example no longer runs
adammpolak opened this issue · 4 comments
adammpolak commented
Repo Steps
- Install librdkafka following the example here: https://github.com/morganstanley/modern-cpp-kafka/blob/main/.github/workflows/kafka_api_ci_tests.yml#L132
- Run build steps found here: https://github.com/morganstanley/modern-cpp-kafka/blob/main/.github/workflows/kafka_api_ci_tests.yml#L132
See this issue:
modern-cpp-kafka/build/examples$ ./kafka_auto_commit_consumer
./kafka_auto_commit_consumer: symbol lookup error: ./kafka_auto_commit_consumer: undefined symbol: rd_kafka_rebalance_protocol
adammpolak commented
Also using apt-get install does not work:
$ sudo apt-get install librdkafka-dev
[sudo] password for adam:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
librdkafka++1 librdkafka1
The following NEW packages will be installed:
librdkafka++1 librdkafka-dev librdkafka1
0 upgraded, 3 newly installed, 0 to remove and 58 not upgraded.
Need to get 0 B/1770 kB of archives.
After this operation, 7654 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Selecting previously unselected package librdkafka1:amd64.
(Reading database ... 237143 files and directories currently installed.)
Preparing to unpack .../librdkafka1_1.9.0-1.cflt~ubu20_amd64.deb ...
Unpacking librdkafka1:amd64 (1.9.0-1.cflt~ubu20) ...
Selecting previously unselected package librdkafka++1:amd64.
Preparing to unpack .../librdkafka++1_1.9.0-1.cflt~ubu20_amd64.deb ...
Unpacking librdkafka++1:amd64 (1.9.0-1.cflt~ubu20) ...
Selecting previously unselected package librdkafka-dev:amd64.
Preparing to unpack .../librdkafka-dev_1.9.0-1.cflt~ubu20_amd64.deb ...
Unpacking librdkafka-dev:amd64 (1.9.0-1.cflt~ubu20) ...
Setting up librdkafka1:amd64 (1.9.0-1.cflt~ubu20) ...
Setting up librdkafka++1:amd64 (1.9.0-1.cflt~ubu20) ...
Setting up librdkafka-dev:amd64 (1.9.0-1.cflt~ubu20) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
$ ls /usr/local/include/librdkafka
rdkafkacpp.h rdkafka.h rdkafka_mock.h
$ ls -all /usr/local/lib/librdkafka*
-rwxr-xr-x 1 root root 7334492 Sep 29 11:51 /usr/local/lib/librdkafka++.a
-rwxr-xr-x 1 root root 26235790 Sep 29 11:51 /usr/local/lib/librdkafka.a
lrwxrwxrwx 1 root root 17 Sep 29 11:51 /usr/local/lib/librdkafka++.so -> librdkafka++.so.1
lrwxrwxrwx 1 root root 15 Sep 29 11:51 /usr/local/lib/librdkafka.so -> librdkafka.so.1
-rwxr-xr-x 1 root root 2577064 Sep 29 11:51 /usr/local/lib/librdkafka++.so.1
-rwxr-xr-x 1 root root 14221992 Sep 29 11:51 /usr/local/lib/librdkafka.so.1
-rwxr-xr-x 1 root root 26235790 Sep 29 11:51 /usr/local/lib/librdkafka-static.a
$ echo $LIBRDKAFKA_INCLUDE_DIR
/usr/local/include/
$echo $LIBRDKAFKA_LIBRARY_DIR
/usr/local/lib/
modern-cpp-kafka/build/examples$ ./kafka_auto_commit_consumer
./kafka_auto_commit_consumer: symbol lookup error: ./kafka_auto_commit_consumer: undefined symbol: rd_kafka_rebalance_protocol
adammpolak commented
Found work around nvm
chengchenglee commented
@adammpolak
Could you please share your work around?
I am facing a similar issue
~/cppkafka/build/examples$ ./example_KafkaConsumer_Simple
./example_KafkaConsumer_Simple: symbol lookup error: ./example_KafkaConsumer_Simple: undefined symbol: rd_kafka_rebalance_protocol
adammpolak commented
So rude of me I should have posted when I got it working.
I believe the issue was that it found an old library that did not have that function, and so it didn't matter that I had another library that DID have that function. You need to check for all libraries and remove them from your paths. Them make sure only to install the way that is given in the link I posted: git clone https://github.com/edenhill/librdkafka.git
If you go straight apt-get install it won't work