Zstandard.Net
Zstandard.Net copied to clipboard
Linux support
Hi bp74,
Currently I am using your lib, which is Windows only for now. So I am stuck using a Windows IIS server. I plan to migrate to CentOS server. Do you plan to embed the Linux library anytime soon ? I don't really know how complicated it would be to implement.
Kind regards
Hi,
Unfortunately i'm not an expert when it comes to Linux, but i think there is no way to put the native binary to the ZStandard.Net Nuget package since different Linux distributions use different packages.
For CentOs you could try to install this: https://centos.pkgs.org/6/epel-testing-x86_64/zstd-1.3.5-1.el6.x86_64.rpm.html
It would be interessting to know if it works by just installing this CentOs package. Please keep me posted.
Hi, thanks for your quick reply. I have libzstd installed:
ldconfig -p | grep libzstd
libzstd.so.1 (libc6,x86-64) => /lib64/libzstd.so.1
However it fails finding the library:
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
An unhandled exception has occurred while executing the request.
System.DllNotFoundException: Unable to load shared library 'libzstd' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibzstd: cannot open shared object file: No such file or directory
at Zstandard.Net.ZstandardInterop.ZSTD_DStreamInSize()
at Zstandard.Net.ZstandardStream..ctor(Stream stream, CompressionMode mode, Boolean leaveOpen)
Seems to load if I create a symlink in the app folder though:
sudo ln -s /lib64/libzstd.so.1 libzstd.so
Okay that's interessting. The question is how we can tell .Net to search for the library in the right folder. All suggestions are welcome :)
Try NativeLibraryLoader. It fixed that problem for me, and allows for multiple locations since it checks each of them until it finds the dll. This would allow cross-platform builds too. My project uses it to find the library for each OS, and load it. I can submit a pull that could incorporate it.
Probably worth looking at https://github.com/CoreyKaylor/Lightning.NET/tree/master/src/LightningDB which has to deal with the same issue.
Thanks, this looks interessting!
any progress?
@RouR see https://github.com/bp74/Zstandard.Net/pull/14 it works but where .net tries to load the libs from is unreliable cross- distro.