DllNotFoundException libcairo.so.2 on MacOS

Hi everyone,

I think I have a long time problem between the importation of project from Windows to MacOS.

I have made a project on Windows using Mono.Cairo to draw the texture of a GameObject.

  • I have set the Api Compatibility Level to .NET 2.0.
  • I have added the Mono.Cairo.dll in the Plugins folder.

It works perfectly fine with Windows. So I made a build for MacOS and tried it: it didn’t work.
So I installed Cairo on my Mac and I imported my Unity project (I tried to cut/paste the project and to make a package) in my MacOS and saw the errors below in my Unity editor:
“DllNotFoundException: libcairo.so.2 - Cairo.ImageSurface…ctor(…”

I searched on the web and tried several solutions:

  • I changed the Mono.Cairo.dll of my project by the one I found in MonoDevelop Frameworks (for MacOS).
  • I renamed the name of my libcairo.2.dylib file to libcairo.so.2.dll.bundle like said in ANSWER.
  • I tried to change the config file in my Unity.app by changing either the name of the dll or its path (see HERE).
  • I may have kind of the same problem as HERE but I am not building the lib Mono.Cairo, how can I be sure it is a 32 bits bundle?

With all these tests, the result was the same: the dll using Mono.Cairo could not be found.
So my last resort is to ask the community to see if anyone has a new idea to this problem? (By the way, it didn’t work on Android as well)

Should this libcairo.so.2 file be a dll file or a dylib or a bundle?
Can I have .bundle or .dylib in my Plugins folder, or should it always be .dll?

If you want more details, fell free to ask them.

Bye!

The Mono.Cairo.dll I used in Unity in the Mac came from the MonoDevelop Framework (/Applications/Unity/MonoDevelop.app/Contents/Frameworks/Mono.framework/Versions/2.10.11/lib/mono/2.0/Mono.Cairo.dll).

Instead, I made a project with Xamarin Studio using Mono.Cairo and get back this Mono.Cairo.dll. I crushed the dll in the Plugins folder by this one and it seems I have no longer this reference problem.

However I now have an other error, but this is another problem:

InvalidProgramException: Invalid IL code in Cairo.ImageSurface:get_Data (): IL_0000: ret