-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
System.Drawing on CentOS: Unable to load DLL 'libdl' #24070
Comments
The interop code tries various variations but .so.2 is not one of them. Perhaps it should be @stephentoub ? |
One way to fix this could be to add It would fix the I could probably create a PR for that, let me know if this is the way you want to go. |
This problem seems to reproduce on Debian as well. However linking |
@henkmollema what version of .NET Core are you using? @qmfrederik 's change above would be in master, not released yet. |
@danmosemsft .NET Core 2.0. |
@qmfrederik any thoughts? |
I submitted PR dotnet/corefx#25134 but this was rejected in favor or a more generic API. |
@henkmollema In the meanwhile, if you're on Ubuntu or Debian, you can try to install the libc6-dev package to get libdl.so. |
For now I fall back to using |
Unfortunately System.Drawing.Common 4.5.0-preview1 is used in a referenced package. In this case iTextSharp.LGPLv2.Core 1.4.2, which I accidentally updated. I run the code in Docker with the microsoft/aspnetcore:2.0.5 image. This results in the same message:
|
@PeterHagen Did you install libgdiplus and libc6-dev in your container? |
@qmfrederik yes, both of them |
Can you check whether the file If that still fails, can you set the |
I'm sorry, with the libc6-dev added, it does work now. Pushing the correct Dockerfile seems to be an issue on a day like this. Thanks for the comment. I tested it on a local and the production Docker environment |
Moving to future since it depends on API: https://github.com/dotnet/corefx/issues/17135 being added. |
On debian i did |
The problem with that technique is that it uses |
in my case of Docker container with base image $ ln -s /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libdl.so
$ apt update
$ apt install libgdiplus
$ ln -s /usr/lib/libgdiplus.so /lib/x86_64-linux-gnu/libgdiplus.so |
It looks like 4.5.0 can't be used out of the box because of this. |
@sherlock1982 You are right, it's a bit of an ugly workaround. The structural fix is in https://github.com/dotnet/corefx/issues/17135. You can perhaps help accelerate a fix for that by upvoting the issue 😄 . |
I am seeing this issue in running in OpenShift Containers... I have followed the instructions in this issue, my docker file now looks like this RUN yum -y install && yum clean all RUN ln -s /usr/lib64/libdl.so.2 /usr/lib64/libdl.so RUN ln -s /usr/lib64/libgdiplus.so.0.0.0 /usr/lib64/libgdiplus.so The original error of "Unable to load DLL 'libdl…" disappears but now when I attempt to run my code I get /docker-entrypoint.sh: line 3: 7 segmentation fault (core dumped) dotnet apihost.dll The underlying OSis RHEL 7.4 (maipo) and using ASP .NET Core 2.1 Note this error happens in 1 in every 100 attempts to execute the offending code. Any advice please |
This doesn't seem like an error in System.Drawing.Common itself. Could you please confirm if this happens in a single Console App, or if you could share a stack trace from the dump that would be super useful as well. |
what is the recommended way to get a copy of the dump, I am not sure how I can get this because the container keeps crashing. Just to also confirm the same code works on a windows running with IIS, |
I have the same issue, with the docker image provided by microsoft I'm getting exceptions in my code:
So far the only workaround I've found is to extend from the provided docker-file and add libc6-dev with apt-get:
If I run my code in a container build from this dockerfile the exception is not thrown. |
Error during fail reporting: System.TypeInitializationException: The type initializer for 'Gdip' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'libdl' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment problem as described here https://github.com/dotnet/corefx/issues/25102
Error during fail reporting: System.TypeInitializationException: The type initializer for 'Gdip' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'libdl' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment problem as described here https://github.com/dotnet/corefx/issues/25102
Still facing this issue using dotnet core 2.2.4, and debian image in Azure App Service |
I suspect this might be solved when targeting |
@safern , Did you try it out? Did that work with .Net Core 3.0? |
@savanbthakkar I've migrated my application to .Net Core 3.0 and the problem is solved, but you have to have installed libgdiplus and libc6-dev anyway. |
@joalcava Have you used System.Drawing in a Lambda function? |
I have used in a Lambda function,I have the same errors |
.NET Core 3.0
UPD This was caused when using an image processor NuGet package from a plug-in with WebP. I think this should not work in .net core. Sorry for the mentions |
Fixed in .NET Core 3.0 |
Any code which uses System.Drawing fails on CentOS 7.4 with the following exception:
This is because by default
libdl.so
doesn't exist on CentOS whereaslibdl.so.2
does exist.As a workaround you can symlink
/lib64/libdl.so.2
to/lib64/libdl.so
.Program.cs:
Project file:
The text was updated successfully, but these errors were encountered: