mono / libgdiplus

C-based implementation of the GDI+ API
http://www.mono-project.com/
MIT License
329 stars 171 forks source link

Unable to load shared library 'libgdiplus' or one of its dependencies #711

Open jrutley opened 3 years ago

jrutley commented 3 years ago

Description

I'm attempting to run a .NET 5 application that exports to an Excel spreadsheet. When I reach the export part, I get the following error:

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

After running it with LD_DEBUG, I noticed that the glibc version is incorrect.

/snap/core18/current/lib/x86_64-linux-gnu/libm.so.6: error: version lookup error: version `GLIBC_2.29' not found (required by /lib/libgdiplus.so) (fatal)

The version of glibc that ships with Ubuntu is 2.31. libgdiplus is version 6.0.4

I don't know if this is an issue with Ubuntu, libgdiplus packaging, or what.

Configuration

Other information

2021-06-22 21:25:27.193 -04:00 [ERR] The type initializer for 'Gdip' threw an exception.
System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
 ---> System.DllNotFoundException: Unable to load shared library 'libgdiplus' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibgdiplus: cannot open shared object file: No such file or directory
   at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)
   at System.Drawing.SafeNativeMethods.Gdip..cctor()
   --- End of inner exception stack trace ---
   at System.Drawing.SafeNativeMethods.Gdip.GdipGetGenericFontFamilySansSerif(IntPtr& fontfamily)
   at System.Drawing.FontFamily.GetGdipGenericSansSerif()
   at System.Drawing.FontFamily.get_GenericSansSerif()
   at System.Drawing.Font.CreateFont(String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte charSet, Boolean isVertical)
   at System.Drawing.Font..ctor(String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont)
   at OfficeOpenXml.ExcelRangeBase.AutoFitColumns(Double MinimumWidth, Double MaximumWidth)
hschwane commented 2 years ago

Hi, I am fighting the same issue right now. Did you make any progress?

I also noticed that in the exception it says liblibgdiplus in the end of the line:

System.DllNotFoundException: Unable to load shared library 'libgdiplus' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibgdiplus: cannot open shared object file: No such file or directory

Not sure if that has anything to do with it, but it seems odd.

jrutley commented 2 years ago

It sure does seem odd, and yes I noticed it too. I activated LD_DEBUG and saw that it was expecting the wrong glibc version. 29.1 instead of 32.x? (I'm on mobile right now)

My workaround was to use a Docker container

On Wed., Jul. 14, 2021, 06:19 hschwane, @.***> wrote:

Hi, I am fighting the same issue right now. Did you make any progress?

I also noticed that in the exception it says liblibgdiplus in the end of the line:

System.DllNotFoundException: Unable to load shared library 'libgdiplus' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibgdiplus: cannot open shared object file: No such file or directory

Not sure if that has anything to do with it, but it seems odd.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mono/libgdiplus/issues/711#issuecomment-879774321, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAF4KJPP2C6GUSDME7XKDJLTXVQEBANCNFSM47E2ZB2Q .