Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

DllImport problem on Linux standalone build

Discussion in 'Linux' started by l3fty, Aug 5, 2016.

  1. l3fty

    l3fty

    Joined:
    Mar 23, 2013
    Posts:
    86
    Hello,

    I'm having some trouble talking to my plugin (.so) on Linux standalone. It works from within the Linux editor project, but I get no response from it within the built player (and it kills method execution when I try to call the imported methods).

    Here is how I'm importing the methods:

    Code (CSharp):
    1. #elif UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX
    2.     // Import methods from L3fty Linux Mouse Plugin
    3.  
    4.     [DllImport("libL3ftyLinuxMousePlugin")]
    5.     static extern void setmouseposition(int mousex, int mousey);

    Any suggestions would be appreciated.

    Incidentally, where does the output log get saved for a Linux standalone build?

    Thanks!
     
  2. Tak

    Tak

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    You're building the x86_64 player? Is the plugin getting deployed (to myproject_Data/Plugins/x86_64 ) with your build?
    Player logs go to ~/.config/unity3d/MyCompany/MyProject/Player.log by default. (Overridable with the -logfile command line argument)
     
  3. l3fty

    l3fty

    Joined:
    Mar 23, 2013
    Posts:
    86
    Thanks for your reply,
    I've tried building the different platform targets (x86, x86_64 & universal) and it appears to fall over on all of them. The plugin gets put in the root of *_Data/Plugins/ I have tried moving it into the platform sub folders after building, but no luck.

    In the log I see this chunk of errors before the DllNotFoundExceptions kick in:
    Code (CSharp):
    1. Fallback handler could not load library /home/l3fty/Desktop/mouse8664/mousetest_Data/Mono/x86_64/libL3ftyLinuxMousePlugin
    2. Fallback handler could not load library /home/l3fty/Desktop/mouse8664/mousetest_Data/Mono/x86_64/libL3ftyLinuxMousePlugin.so
    3. Fallback handler could not load library /home/l3fty/Desktop/mouse8664/mousetest_Data/Mono/x86_64/./libL3ftyLinuxMousePlugin
    4. Fallback handler could not load library /home/l3fty/Desktop/mouse8664/mousetest_Data/Mono/x86_64/./libL3ftyLinuxMousePlugin.so
    5. Fallback handler could not load library /home/l3fty/Desktop/mouse8664/mousetest_Data/Mono/x86_64/libL3ftyLinuxMousePlugin
    6. Setting up 1 worker threads for Enlighten.
    7.   Thread -> id: 7eff6cff9700 -> priority: 1
    8. Fallback handler could not load library /home/l3fty/Desktop/mouse8664/mousetest_Data/Mono/x86_64/libL3ftyLinuxMousePlugin
    9. Fallback handler could not load library /home/l3fty/Desktop/mouse8664/mousetest_Data/Mono/x86_64/libL3ftyLinuxMousePlugin.so
    10. Fallback handler could not load library /home/l3fty/Desktop/mouse8664/mousetest_Data/Mono/x86_64/./libL3ftyLinuxMousePlugin
    11. Fallback handler could not load library /home/l3fty/Desktop/mouse8664/mousetest_Data/Mono/x86_64/./libL3ftyLinuxMousePlugin.so
    12. Fallback handler could not load library /home/l3fty/Desktop/mouse8664/mousetest_Data/Mono/x86_64/libL3ftyLinuxMousePlugin
    13. Fallback handler could not load library /home/l3fty/Desktop/mouse8664/mousetest_Data/Mono/x86_64/libL3ftyLinuxMousePlugin
    14. Fallback handler could not load library /home/l3fty/Desktop/mouse8664/mousetest_Data/Mono/x86_64/libL3ftyLinuxMousePlugin.so
    15. Fallback handler could not load library /home/l3fty/Desktop/mouse8664/mousetest_Data/Mono/x86_64/./libL3ftyLinuxMousePlugin
    16. Fallback handler could not load library /home/l3fty/Desktop/mouse8664/mousetest_Data/Mono/x86_64/./libL3ftyLinuxMousePlugin.so
    17. Fallback handler could not load library /home/l3fty/Desktop/mouse8664/mousetest_Data/Mono/x86_64/libL3ftyLinuxMousePlugin
     
  4. l3fty

    l3fty

    Joined:
    Mar 23, 2013
    Posts:
    86
    Oh in case it's relevant, I'm running Linux Mint 18 'Sarah' Cinnamon 64bit.
     
  5. Tak

    Tak

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    If you run ldd on your plugin, does it resolve all the dependencies?
    Can you send me your project so I can take a look?
     
  6. l3fty

    l3fty

    Joined:
    Mar 23, 2013
    Posts:
    86

    It appears to be happy.
    I sure can send you the project, is it best for me to upload it and pm you a link to the archive?
     
  7. Tak

    Tak

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    Found the issue - the 5.4 editor is expecting the plugin to be DllImported as libL3ftyLinuxMousePlugin while the player is expecting L3ftyLinuxMousePlugin.

    For now, you can work around by specifying different strings for the editor and player - this will be fixed in the editor in an upcoming build.
     
  8. l3fty

    l3fty

    Joined:
    Mar 23, 2013
    Posts:
    86
    Aha, thanks for looking into it :D

    Confirmed this change worked for me on 5.36 too, though I also had to move the plugin into the correct platform subfolder.