clrzmq4 icon indicating copy to clipboard operation
clrzmq4 copied to clipboard

Shared library issues with DotNet Core 2.1 under Linux

Open daniel-sherwood opened this issue 5 years ago • 1 comments

Hi

I'm trying to use 4.1.0.31 this with DotNet Core 2.1 under Linux and get the following error at startup.

Unhandled Exception: System.TypeInitializationException: The type initializer for 'ZeroMQ.lib.zmq' threw an exception. ---> System.DllNotFoundException: Unable to load shared library '__Internal' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: lib__Internal: cannot open shared object file: No such file or directory

Is this supposed to work?

Cheers

Daniel

daniel-sherwood avatar Jun 25 '19 13:06 daniel-sherwood

It looks like Platform.LoadUnmanagedLibrary() is not called for NetStandard and .NET Core https://github.com/zeromq/clrzmq4/blob/6f193f3993c7e2f42ba823c2a85a1e7ba597eda2/Platform/zmq.cs#L32

I was able to make it work by putting the native library in the same folder as the main app (not in the architecture subfolder as it was for full framework).

EDIT: You can also fix the issue by manually installing libzmq3-dev package on the linux machine:

echo 'deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/Debian_10/ /' > /etc/apt/sources.list.d/network:messaging:zeromq:release-stable.list 
wget -nv https://download.opensuse.org/repositories/network:messaging:zeromq:release-stable/Debian_10/Release.key -O Release.key 
apt-key add - < Release.key 
apt-get -y update
apt-get -y install libzmq3-dev=4.3.2 

cezarypiatekGC avatar Dec 19 '19 07:12 cezarypiatekGC