Skip to content

Unhandled Exception: System.DllNotFoundException: Failed to load the librdkafka native library. #1005

@Zuendelmeister

Description

@Zuendelmeister

Description

Hi, I'm trying to create a small kafka producer on my arm device. The code is pretty simple.

using Confluent.Kafka;
using System;

namespace KafkaTester
{
    class Program
    {
        static async System.Threading.Tasks.Task Main(string[] args)
        {
            string kafkaServer = "127.0.0.1:9092";
            var config = new ProducerConfig
            {
                BootstrapServers = kafkaServer
            };
            using (var p = new ProducerBuilder<Null, string>(config).Build())
            {
                try
                {
                    var dr = await p.ProduceAsync("first_topic", new Message<Null, string> { Value = "Message by C# testprogram" });
                    Console.WriteLine($"Delivered '{dr.Value}' to '{dr.TopicPartitionOffset}'");
                }
                catch (ProduceException<string, string> e)
                {
                    Console.WriteLine($"Delivery failed: {e.Error.Reason}");
                }
            }
        }
    }
}

More infos:
Nuget: Confluent.Kafka v1.1.0
Kafka Version: kafka_2.12-2.2.0

It works quite fine on linux and windows. Unfortunately I want to deploy it on an arm device and get this error:

Unhandled Exception: System.DllNotFoundException: Failed to load the librdkafka native library.
at Confluent.Kafka.Impl.Librdkafka.Initialize(String userSpecifiedPath)
at Confluent.Kafka.Producer2..ctor(ProducerBuilder2 builder)
at Confluent.Kafka.ProducerBuilder`2.Build()

How to reproduce

Several ways:
Create a dotnet core console application with the given code (I did this on windows).
Build it for arm self contained:

dotnet publish --self-contained -r ubuntu.16.04-arm

Then start the code (I called my Project KafkaTester)

sudo ./KafkaTester

Also I created the same project on my arm device

dotnet new console

Then I used the same code in the Program.cs with the same nuget package and built it.

dotnet restore
dotnet publish 

After running the excutable I get the same System.DllNotFoundException

Checklist

Please provide the following information:

  • A complete (i.e. we can run it), minimal program demonstrating the problem. No need to supply a project file.
  • Confluent.Kafka nuget version.
  • Apache Kafka version.
  • Client configuration.
  • Operating system.
  • Provide logs (with "debug" : "..." as necessary in configuration).
  • Provide broker log excerpts.
  • Critical issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions