MonoPosixHelper not found

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/49483-Ideas-needed-for-debugging-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.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)


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

Can the monoposixhelper.dll be downloaded somewhere?

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

ah, yes, I see now.

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)

So I’ll most likely never get serial coms with unity on Mac?

Just trying to be sure.

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)

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!!!

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

I had the same problem on Linux, with this message in Player.log: “DllNotFoundException: libMonoPosixHelper.so”.

To solve it, install libMono. It worked for me.

https://unix.stackexchange.com/questions/10685/how-do-i-install-monos-system-windows-forms-on-ubuntu

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.

For anybody googling this issue in 2018: this issue is back and can be thrown in multiple scenarios where decompression is used (e.g. using HttpClient). There’s a bug report: Unity Issue Tracker - [Android] DllNotFoundException: MonoPosixHelper

1 Like