Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Linux build is putting in wrong place

Discussion in 'Linux' started by mattleibow, Sep 24, 2017.

  1. mattleibow


    Sep 24, 2017
    I am new to this Unity world, so I might be doing something wrong...

    But, I am getting a DllNotFoundException for my Linux build. The Windows and MacOS build work fine, so it is not my managed code. The Linux library works fine in other .NET apps, so it is not that. And finally, when I look at the error message and move my native library to the location it is looking in, the game works.

    Basically, this is a simple game that creates a 2D texture using SkiaSharp. My p/invoke looks like this (SKColorType is an enumeration):

    Code (CSharp):
    1. [DllImport("libSkiaSharp", CallingConvention = CallingConvention.Cdecl)]
    2. public extern static SKColorType sk_colortype_get_default_8888();
    I have all of this on GitHub:
    The log files:
    - console log:
    - player log:

  2. Tak


    Unity Technologies

    Mar 8, 2010
    Sorry for the delayed response - I put this onto my list of things to investigate, and then it was now.
    What's going on here is that linux expects libraries to be "" - so since you're importing libSkiaSharp instead of SkiaSharp, it's looking for

    I'll add a fallback for this case, but in the meantime, you can work around it by renaming the native linux plugin in your project.
  3. mattleibow


    Sep 24, 2017
    Thanks! Everything is now working.

    While we are hanging out with the natives, is there a reason why Unity can't understand that a .dylib is a mac library? I can rename the native file to .bundle and do things, but not a .dylib.