Question

Whenever my application calls into libgdi, I get the following:

An exception was thrown by the type initializer for System.Drawing.GDIPlus --->
System.DllNotFoundException: /opt/mono-3/lib/libgdiplus.so
     at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup(ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
     at System.Drawing.GDIPlus..cctor () [0x000cc] in /build/buildd/mono-3-opt-3.2.3/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs:127

Okay, fair enough: I need to have libgdi in a spot mono can find it. I was reasonably certain I had made and installed it previously, so I started by looking at ldconfig to see where it is:

libgdiplus.so.0 (libc6,x86-64) => /usr/local/lib/libgdiplus.so.0
libgdiplus.so.0 (libc6,x86-64) => /usr/lib/libgdiplus.so.0
libgdiplus.so (libc6,x86-64) => /usr/local/lib/libgdiplus.so
libgdiplus.so (libc6,x86-64) => /usr/lib/libgdiplus.so

I naively thought that if the library was identifiable in ldconfig, mono would be able to find and use it. Is that not the case? Is there an ambiguity between /usr/local/lib and usr/lib that needs resolution?

Anyhow, I think I can tell mono to look at /usr/lib/libgdiplus.so using dllmap like the following:

<dllmap dll="gdiplus" target="/usr/lib/libgdiplus.so" os="!windows"/>
<dllmap dll="gdiplus.dll" target="/usr/lib/libgdiplus.so" os="!windows"/>
<dllmap dll="/opt/mono-3/lib/libgdiplus.so" target="/usr/lib/libgdiplus.so" os="!windows"/>

... but being a neophyte, I'm not certain that's correct. Mono still claims it cannot find libgdi at runtime, and I'm just about out of ideas.

Can one use dllmap in this way? And if so, where am I going wrong? If not, can I get a suggestion on what to try next?

For what it's worth, I'm attempting to run using Mono 3.2.4 from MonoDevelop 4.2.3.

Was it helpful?

Solution

Try to create a symlink /opt/mono-3/lib/libgdiplus.so pointing to /usr/lib/libgdiplus.so.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top