-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SolcLib.Native depends on libc6-dev on linux #1
Comments
With the default SolcNet library interop provider, libdl is used on *nix machines to load the native assembly and to marshal symbols/functions. See here https://github.com/hosho/SolcNet/blob/master/SolcNet/NativeLib/PlatformNativeLibInterop.cs#L33 Could you publish your docker container configuration? I'm not very familiar with the minimum dependencies that linux distros have to ship with, but I'm pretty sure some form of libc (which should include libdl) is required. Using libdl is a common pattern for cross platform p/invoke in .NET. Examples: https://github.com/search?l=C%23&p=1&q=dllimport+dlopen&type=Code The SolcNet project actually contains 2 additional native library loaders: NativeLibraryLoader and AdvancedDLSupport. But they are not included in any nuget packages. See them in use and tested here: https://github.com/hosho/SolcNet/blob/master/SolcNet.Test/BindingTests.cs#L14 One difference is that the AdvancedDLSupport provider uses the string constant "dl" rather than "libdl". Perhaps this makes a difference? If you're able to compile SolcNet, you could test by changing it here https://github.com/hosho/SolcNet/blob/master/SolcNet/NativeLib/PlatformNativeLibInterop.cs#L30 If you can give me the configuration of your docker/linux distro I will also do some testing. |
Also could you run |
I was able to reproduce this on a fresh Ubuntu Server 18.04 install, did some investigation and implemented a fix. Linux distros often do not link 'libdl.so' to 'libdl.so.2' by default, and throw that exception when not using the shared lib version naming convention. Should be fixed in nuget package version 1.1.106. Let me know if that works for you. |
Hi @zone117x The docker container I've been using as a workaround is an extension of the default microsoft dotnet core container. You see it's dockerfile in my original post. I'll try your recent update and give you feedback, if it doesn't work I'll also tell you what the find prints inside my container. |
Great! With 1.1.106 and microsoft/dotnet:2.1-sdk I'm not receiving any more errors of missing libraries. Looks like your change worked 👍 |
Hi,
I'm trying to run a small dotnet application using SolcLib.Native inside a docker container. I'm getting the following exception when I'm calling Compile:
The code in question looks like this:
I've found a workaround. The dockerfile I use to create my container now looks like this:
Would it be possible to get rid of the dependency to not require libc6-dev to be installed to use SolcLib.Native on linux?
The text was updated successfully, but these errors were encountered: