Bug 6019

Summary: Problematic dynamic library loading with 2.11.2 official package
Product: [Mono] Runtime Reporter: stefanor
Component: packagingAssignee: Duncan Mak <duncan.mak>
Status: RESOLVED FIXED    
Severity: major CC: brian, jeremiah, miguel, mono-bugs+mono, mono-bugs+runtime
Priority: High    
Version: unspecified   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

Description stefanor 2012-07-06 14:54:44 UTC
May be related to bug 797.  This is with a clean install of 2.11.2 from 
MonoFramework-MDK-2.11.2.macos10.xamarin.x86.dmg from go-mono.com.

Mac OS X 10.7.4

Stefans-MacBook-Air:2.11.2 sorear$ csharp /r:Mono.Posix
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> Mono.Unix.Native.Syscall.system("date"); 
System.TypeInitializationException: An exception was thrown by the type initializer for Mono.Unix.Native.Stdlib ---> System.DllNotFoundException: libMonoPosixHelper.dylib
  at (wrapper managed-to-native) Mono.Unix.Native.Stdlib:GetDefaultSignal ()
  at Mono.Unix.Native.Stdlib..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at <InteractiveExpressionClass>.Host (System.Object& $retval) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Evaluator.Evaluate (System.String input, System.Object& result, System.Boolean& result_set) [0x00000] in <filename unknown>:0 
  at Mono.CSharpShell.Evaluate (System.String input) [0x00000] in <filename unknown>:0 
csharp>  

Stefans-MacBook-Air:2.11.2 sorear$ LD_LIBRARY_PATH=/Library/Frameworks/Mono.framework/Versions/2.11.2/lib csharp /r:Mono.Posix
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> Mono.Unix.Native.Syscall.system("date"); 
Fri Jul  6 10:28:28 PDT 2012
0
csharp>  

Stefans-MacBook-Air:2.11.2 sorear$
Comment 1 Miguel de Icaza [MSFT] 2012-09-02 13:10:26 UTC
Duncan, 

Do we have a system in the office running 2.11.3 that we can use to debug these issues?

Can you please try to replicate this?
Comment 2 Jeremiah Boyle 2012-10-04 01:08:23 UTC
i'm getting the same DllNotFoundException for libMonoPosixHelper.dylib with 2.11.4.

i worked around it, for the time being, by editing MonoPosixHelper dllmap statement in /Library/Frameworks/Mono.framework/Versions/2.11.4/etc/mono/config to include the full path to the library.
Comment 3 Brian Luczkiewicz 2012-10-04 01:32:29 UTC
I am seeing this too on 2.11.4.

Jeremiah's workaround got me going again, but it would be good to get the packages into a state where they work out-of-the-box.
Comment 4 Duncan Mak 2012-10-09 13:39:56 UTC
This has already been fixed in 2.11.5. The pre-release builds are available in Wrench.

https://wrench.mono-project.com/Wrench/

duncan@dynamic-022:~$ more /Library/Frameworks/Mono.framework/Versions/2.11.5/etc/mono/config 
<configuration>
        <dllmap dll="i:cygwin1.dll" target="libc.dylib" os="!windows" />
        <dllmap dll="libc" target="libc.dylib" os="!windows"/>
        <dllmap dll="intl" target="libintl.dylib" os="!windows"/>
        <dllmap dll="intl" name="bind_textdomain_codeset" target="libc.dylib" os="solaris"/>
        <dllmap dll="libintl" name="bind_textdomain_codeset" target="libc.dylib" os="solaris"/>
        <dllmap dll="libintl" target="libintl.dylib" os="!windows"/>
        <dllmap dll="i:libxslt.dll" target="libxslt.dylib" os="!windows"/>
        <dllmap dll="i:odbc32.dll" target="libodbc.dylib" os="!windows"/>
        <dllmap dll="i:odbc32.dll" target="libiodbc.dylib" os="osx"/>
        <dllmap dll="oci" target="libclntsh.dylib" os="!windows"/>
        <dllmap dll="db2cli" target="libdb2_36.dylib" os="!windows"/>
        <dllmap dll="MonoPosixHelper" target="/Library/Frameworks/Mono.framework/Versions/2.11.5/lib/libMonoPosixHelper.dylib" os="!windows" />
        <dllmap dll="i:msvcrt" target="libc.dylib" os="!windows"/>
        <dllmap dll="i:msvcrt.dll" target="libc.dylib" os="!windows"/>
        <dllmap dll="sqlite" target="libsqlite.0.dylib" os="!windows"/>
        <dllmap dll="sqlite3" target="libsqlite3.0.dylib" os="!windows"/>
        <dllmap dll="libX11" target="libX11.dylib" os="!windows" />
        <dllmap dll="libcairo-2.dll" target="libcairo.so.2" os="!windows"/>
        <dllmap dll="libcairo-2.dll" target="libcairo.2.dylib" os="osx"/>
        <dllmap dll="libcups" target="libcups.so.2" os="!windows"/>
        <dllmap dll="libcups" target="libcups.dylib" os="osx"/>
        <dllmap dll="i:kernel32.dll">
                <dllentry dll="__Internal" name="CopyMemory" target="mono_win32_compat_CopyMemory"/>
                <dllentry dll="__Internal" name="FillMemory" target="mono_win32_compat_FillMemory"/>
                <dllentry dll="__Internal" name="MoveMemory" target="mono_win32_compat_MoveMemory"/>
                <dllentry dll="__Internal" name="ZeroMemory" target="mono_win32_compat_ZeroMemory"/>
        </dllmap>
        <dllmap dll="gdiplus" target="/Library/Frameworks/Mono.framework/Versions/2.11.5/lib/libgdiplus.dylib" />
        <dllmap dll="gdiplus.dll" target="/Library/Frameworks/Mono.framework/Versions/2.11.5/lib/libgdiplus.dylib" />
</configuration>