Skip to content
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

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

Open
jrutley opened this issue Jun 23, 2021 · 2 comments
Open

Comments

@jrutley
Copy link

jrutley commented Jun 23, 2021

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

  • Which version of .NET is the code running on?
    .NET 5
  • What OS and version, and for Linux, what distro?
    Ubuntu 20.04
  • What is the architecture (x64, x86, ARM, ARM64)?
    x64

Other information

  • Please include any relevant stack traces or error messages. If possible please include text as text rather than images (so it shows up in searches).
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
Copy link

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
Copy link
Author

jrutley commented Jul 14, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants