confluent-kafka-dotnet: Unable to load 'librdkafka' in CentOS

I have used the latest 0.9.5.RC4 and it runs properly on windows. but when i try to run it on CentOS it throws

Unhandled Exception: System.TypeInitializationException: The type initializer for ‘Confluent.Kafka.Impl.LibRdKafka’ threw an exception. —> System.DllNotFoundException: Unable to load DLL ‘librdkafka’: The specified module could not be found. (Exception from HRESULT: 0x8007007E) at Confluent.Kafka.Impl.LibRdKafka.NativeMethods.rd_kafka_version() at Confluent.Kafka.Impl.LibRdKafka.version() at Confluent.Kafka.Impl.LibRdKafka…cctor() — End of inner exception stack trace — at Confluent.Kafka.Impl.LibRdKafka.conf_new() at Confluent.Kafka.Impl.SafeConfigHandle.Create() at Confluent.Kafka.Consumer…ctor(IEnumerable1 config) at Confluent.Kafka.Consumer2…ctor(IEnumerable1 config, IDeserializer1 keyDeserializer, IDeserializer`1 valueDeserializer)

I have manually added the rhel-x64 links in the deps.json file, but i end up in having version mismatch error.

Unhandled Exception: System.TypeInitializationException: The type initializer for ‘Confluent.Kafka.Impl.LibRdKafka’ threw an exception. —> System.IO.FileLoadException: Invalid librdkafka version 904c9, expected at least 904ff at Confluent.Kafka.Impl.LibRdKafka…cctor() — End of inner exception stack trace — at Confluent.Kafka.Impl.LibRdKafka.conf_new() at Confluent.Kafka.Impl.SafeConfigHandle.Create() at Confluent.Kafka.Consumer…ctor(IEnumerable1 config) at Confluent.Kafka.Consumer2…ctor(IEnumerable1 config, IDeserializer1 keyDeserializer, IDeserializer`1 valueDeserializer)

i think the librdkafka redist is not updating the rhel-x64 version of librdkafka libraries.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (11 by maintainers)

Most upvoted comments

Version 0.11.0

I also have this problem on CentOS, I’ve solved it through the following command :

sudo yum install librdkafka-devel

for CentOS i’d recommend getting the librdkafka source git clone https://github.com/edenhill/librdkafka.git then follow the build/installation instructions to build from source (it’s not hard).

the nuget package RdKafka.Internal.librdkafka is no longer relevant - we reference librdkafka.redist.

centos7 compatible builds of librdkafka are now included in librdkafka.redist - manual install of librdkafka is no longer required on this platform.

Thanks for confirming - this should also be resolved in next nuget package We may add doozer CI for testing on centos soon

Personally, I can confirm that this solution (recompile library directly from CentOS) works for .net core projects and solves the issue.

i did a full compile on CentOS for the librdkafka library, and once the new library is deployed, its working properly. so its seems the only issue is nuget is not deploying the right native libraries.