Search Unity

MonoPosixHelper not found

Discussion in 'Editor & General Support' started by charles.rich, Aug 9, 2011.

  1. charles.rich

    charles.rich

    Joined:
    Mar 27, 2011
    Posts:
    14
    Hi, I am experimenting with a simple Hello World program--just a main method
    with System.out.println("Hello")--to assess the feasibility of using
    ikvmc (see ikvm.net) to support a Java package inside of Unity3d (version 3.4).
    See related thread

    http://forum.unity3d.com/threads/49...ing-using-Java-code-inside-Unity?goto=newpost

    My experiment works fine on Windows 7, but running Unity on Mac OS
    (Snow Leopard), I get an error (see backtrace below) looking for the
    MonoPosixHelper.dll. According to my initial research, this library
    contains some helper functions for dealing with Posix filenames (makes
    sense that are needed for Mac but not Win).

    According to my enquiries at ikvm.net, this is most likely something odd in the Mono
    configuration for Unity on the Mac. Interestingly, the assembly I created with ikvmc
    works fine under standalone Mono on the Mac.

    Finally, I did notice there is a libMonoPosixHelper.dylib in both the Mono interpreter
    download for Mac _and_ in the Unity libraries for both Mac and Windows. Perhaps
    there is some configuration problem on the Mac that prevents Unity from properly
    using this library?

    Thanks in advance,

    C. Rich
    *******************************************************************************************************
    DllNotFoundException: MonoPosixHelper
    Mono.Unix.Native.Syscall..cctor ()
    Rethrow as TypeInitializationException: An exception was thrown by the
    type initializer for Mono.Unix.Native.Syscall
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
    invokeAttr, System.Reflection.Binder binder, System.Object[]
    parameters, System.Globalization.CultureInfo culture)
    Rethrow as TargetInvocationException: Exception has been thrown by the
    target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
    invokeAttr, System.Reflection.Binder binder, System.Object[]
    parameters, System.Globalization.CultureInfo culture)
    System.Reflection.MethodBase.Invoke (System.Object obj,
    System.Object[] parameters)
    ikvm.internal.MonoUtils.unameProperty (System.String )
    ikvm.internal.Util..cctor ()
    Rethrow as TypeInitializationException: An exception was thrown by the
    type initializer for ikvm.internal.Util
    java.lang.VMSystemProperties.getLibraryPath ()
    java.lang.VMSystemProperties.initCommonProperties (java.util.Properties )
    java.lang.VMSystemProperties.initProperties (java.util.Properties )
    java.lang.Props..cctor ()
    Rethrow as TypeInitializationException: An exception was thrown by the
    type initializer for java.lang.Props
    java.lang.System.getProperty (System.String key)
    sun.security.action.GetPropertyAction.run ()
    sun.security.action.GetPropertyAction.<bridge>run ()
    sun.security.action.GetPropertyAction.java.security.PrivilegedAction/()Ljava.lang.Object;run
    ()
    java.security.AccessController.doPrivileged (System.Object ,
    java.security.AccessControlContext , ikvm.internal.CallerID )
    Rethrow as TypeInitializationException: An exception was thrown by the
    type initializer for java.nio.charset.Charset
    sun.nio.cs.StreamEncoder.forOutputStreamWriter (java.io_OutputStream
    out, System.Object lock, System.String charsetName)
    java.io_OutputStreamWriter..ctor (java.io_OutputStream out)
    java.io.PrintStream..ctor (java.io_OutputStream out, Boolean autoFlush)
    java.lang.StdIO..cctor ()
    Rethrow as TypeInitializationException: An exception was thrown by the
    type initializer for java.lang.StdIO
    java.lang.System.get_out ()
    Hello.main (System.String[] strarr)
    UnityHello.Start () (at /Users/rich/Desktop/test/Assets/UnityHello.cs:9)
    *******************************************************************************************************
     
  2. charles.rich

    charles.rich

    Joined:
    Mar 27, 2011
    Posts:
    14
    After doing a lot more research on this (just Google MonoPosixHelper), If found that it is somewhat common to mess up the configuration of MonoPosixHelper when embedding Mono into an application, such as Unity. It appears to be the case that Unity is not making libMonoPosixHelper.dylib available to the code in C# plugins.

    It very much looks like a configuration problem with Unity and the problem is easily reproduced (I posted the example plugin at http://dl.dropbox.com/u/12370141/Hello.dll).

    If there is a Unity developer reading this, it would be great to have a workaround suggested---I tried the obvious dumb thing of moving libMonoPosixHelper.dylib to my Plugins folder, but that did not work.

    Thanks, -CR
     
  3. holyjewsus

    holyjewsus

    Joined:
    Mar 7, 2011
    Posts:
    624
    Can the monoposixhelper.dll be downloaded somewhere?
     
  4. charles.rich

    charles.rich

    Joined:
    Mar 27, 2011
    Posts:
    14
    According to all information, this is a native library, which should be a .dylib on the Mac, right? Note that there is a libMonoPosixHelper.dylib i both standalone Mono and in Unity---it is just the Unity one does not seem to be accessible.

    -CR
     
  5. holyjewsus

    holyjewsus

    Joined:
    Mar 7, 2011
    Posts:
    624
    ah, yes, I see now.
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Its no configuration problem but by design.

    Unity uses Mono as scripting layer for the engine and even uses an own custom version of mono so it can run on consoles and mobiles which the stock mono can't. To do that without just crashing or compile fails, various aspects are removed and/or limited and its commonly a good idea to leave it like that.

    That it works on windows is pretty surely not by "design" but just a side effect due to the fact that there all this stuff is part of the Win32 layer which mono needs to interface and dynamically load anyway to do anything (system.threading, system.net and system.io should cover nearly every dll of win32 thats not required for the window creation, headless systray icon already anyway I think)
     
  7. holyjewsus

    holyjewsus

    Joined:
    Mar 7, 2011
    Posts:
    624
    So I'll most likely never get serial coms with unity on Mac?

    Just trying to be sure.
     
  8. gametr4x

    gametr4x

    Joined:
    Apr 22, 2009
    Posts:
    86
    I got a similar error when using the zxing library.

    The funny thing is, I got the error on the exact same code that was running before. I tried reverting to the code that worked, but I'm still getting the error...

    Any idea what exactly causes this error? It's happening at various places when calling the zxing library, which don't seem to be very consistent because they worked before and no longer work now (which was converted from JAR to DLL with ikvm)
     
  9. duffy

    duffy

    Joined:
    Mar 25, 2013
    Posts:
    1
    Bump for great justice. I've got the "MonoPosixHelper not found" deathnote on my Linux app, too. Same com port, same hardware, works wonderfully with the Windows target, no joy on Ubuntu. Apparently MonoDevelop projects actually CAN open a com port in Linux (there are forum posts that say so), but not the Unity version of Mono? Anybody find a solution, or work-around? Need a com port on this thing!!!
     
  10. Deleted User

    Deleted User

    Guest

    Porplems happend when use serialport on Android. this problem still not sloved. I have to say.....I have nothing to say..
     
  11. raphik12

    raphik12

    Joined:
    Jun 28, 2013
    Posts:
    1
  12. NGC6543

    NGC6543

    Joined:
    Jun 3, 2015
    Posts:
    228
    Maybe this is the solution...?



    Hey, is there a Mac version of this? My serial communication code works just fine in the editor, but gives the `DllNotFoundException` after standalone build on macOS.
     
  13. MapMan

    MapMan

    Joined:
    Oct 27, 2013
    Posts:
    38
    benreustorm likes this.