confluent-kafka-dotnet: Exception "Failed to load the librdkafka native library" when building consumer using 1.0.0-beta3
Description
Getting the following exception when building a consumer using 1.0.0-beta3:
Unhandled Exception: System.DllNotFoundException: Failed to load the librdkafka native library.
at Confluent.Kafka.Impl.Librdkafka.Initialize(String userSpecifiedPath)
at Confluent.Kafka.Consumer2..ctor(ConsumerBuilder2 builder)
at Confluent.Kafka.ConsumerBuilder2.Build() at Confluent.Kafka.Examples.ConsumerExample.Program.Run_Consume(String brokerList, List1 topics, CancellationToken cancellationToken) in /src/confluent-kafka-dotnet/examples/Consumer/Program.cs:line 60
at Confluent.Kafka.Examples.ConsumerExample.Program.Main(String[] args) in /src/confluent-kafka-dotnet/examples/Consumer/Program.cs:line 192
Abort trap: 6
How to reproduce
Run the Consumer example console app using 1.0.0-beta3. (https://github.com/confluentinc/confluent-kafka-dotnet/tree/master/examples/Consumer)
If I run the Consumer example app with from the 1.0.0-beta2 release, it works without error.
Checklist
Please provide the following information:
- Confluent.Kafka nuget version: 1.0.0-beta3
- Apache Kafka version:
- Client configuration:
- Operating system: OSX 10.13.6 (17G65)
- Provide logs (with “debug” : “…” as necessary in configuration)
- Provide broker log excerpts
- Critical issue
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 23 (5 by maintainers)
Use this in dockerfile , it was installed and worked fine.
If you have any errors i will share my full dockerfile
The workaround for now is
brew install zstdon osx@ritasker
Looks like you’re on an Arch Linux derivative. With
libsaslinstalled, the library is actuallylibsasl2.so.3while the prebuiltlibrdkafka.sois attempting to link tolibsasl2.so.2.I manually built
librdkafkamyself so it would link against the rightlibsasl, and then replaced~/.nuget/packages/librdkafka.redist/1.0.0-rc7/runtimes/linux-x64/native/librdkafka.sowith the version I manually built.That should fix it.
We also had to upgrade OpenSSL on osx by
brew upgrade opensslto resolve the issueIt also happens on mcr.microsoft.com/dotnet/aspnet:6.0-alpine image.
it can be fixed by
apk add librdkafka-dev, but could it be solved in the kafka dotnet library?