Opened 20 years ago

Last modified 5 years ago

#1936 closed defect

BUG: devel/mono doesn't look in /opt/local/lib at runtime — at Version 19

Reported by: chris.ridd@… Owned by: mww@…
Priority: Normal Milestone:
Component: ports Version: 1.0
Keywords: Cc: markd@…, andi@…, nox@…
Port: mono

Description (last modified by ryandesign (Ryan Carsten Schmidt))

The mono-config file included by devel/gtk-sharp maps 'libgtk-win32-2.0.0.dll' to 'libgtk-x11 -2.0.0.dylib', however an application using Gtk fails to load the dylib. This is because it appears to look for the dylib in the paths "", "/usr/local/lib", "/lib", "/usr/lib" and "." (and then across those paths in reverse order, Just In Case.)

If I set DYLD_LIBRARY_PATH to /opt/local/lib, the dylib is located correctly.

% mcs helloworld.cs -L /opt/local/lib/mono/gtk-sharp -r gtk-sharp.dll -r glib-sharp.dll
Compilation succeeded
% unsetenv DYLD_LIBRARY_PATH
% mono helloworld.exe

Unhandled Exception: System.DllNotFoundException: libgtk-win32-2.0-0.dll
in <0x000dc> (wrapper managed-to-native) Gtk.Application:gtk_init (int&,intptr&)
in <0x0004c> Gtk.Application:Init ()
in <0x0001c> Hello:Main ()

% setenv DYLD_LIBRARY_PATH /opt/local/lib
% mono helloworld.exe

(it works)

Change History (21)

comment:1 Changed 20 years ago by olegb@…

Owner: changed from darwinports-bugs@… to jkh@…

assigning to maintainer, is this still a issue ? jkh has been poking mono alot lately..

comment:2 Changed 20 years ago by chris.ridd@…

Yes, this is still a problem. I just updated and rebuilt devel/mono and x11/gtk-sharp to make sure!

Changed 19 years ago by chris.ridd@…

Attachment: patch-dyld added

Patch for mono/metadata/loader.c

comment:3 Changed 19 years ago by chris.ridd@…

The appended diff patches (see attachment) the mono sources to avoid this problem. The patch has been been submitted up-stream.

Index: Portfile
===================================================================
RCS file: /Volumes/src/cvs/od/proj/darwinports/dports/devel/mono/Portfile,v
retrieving revision 1.27
diff -u -r1.27 Portfile
--- Portfile    4 Nov 2004 18:52:05 -0000       1.27
+++ Portfile    10 Nov 2004 21:55:27 -0000
@@ -29,6 +29,8 @@
                                --enable-threads=pthreads \
                                --mandir=${prefix}/share/man
 
+patchfiles     patch-dyld
+
 destroot.destdir       DESTDIR=${destroot}
 destroot.env   DYLD_LIBRARY_PATH=${worksrcpath}/mono/mini/.libs:${worksrcpath}/mono/interpreter/.libs:/opt/local/lib:${x11prefix}/lib
Last edited 8 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:4 Changed 19 years ago by chris.ridd@…

Cc: mww@… added
Owner: changed from jkh@… to mww@…

comment:5 Changed 19 years ago by chris.ridd@…

attachments.isobsolete: 01

comment:6 Changed 19 years ago by chris.ridd@…

op_sys: All
rep_platform: All

A better fix is to to change the dllmap in the config file installed with a "glue" dll.

comment:7 Changed 19 years ago by mww@…

does this problem still persist on version 1.1.7?

comment:8 Changed 19 years ago by bportmann@…

(In reply to comment #6)

does this problem still persist on version 1.1.7?

Well yes (sometimes). I'm using 1.1.8 (darwinports) and I did not need to set DYLD_LIBRARY_PATH until I tried to use a method from Mono.Unix and then I got the error:

Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for Mono.Unix.Syscall ---> System.DllNotFoundException: libMonoPosixHelper.dylib in (wrapper managed-to-native) Mono.Unix.Syscall:_L_ctermid () in <0x00090> Mono.Unix.Syscall:.cctor ()--- End of inner exception stack trace ---

which goes away if I set: export DYLD_LIBRARY_PATH=/opt/local/lib

Note that I've used lots of stuff from gtk# without needing the DYLD var set.

comment:9 Changed 18 years ago by schlu-do@…

I got the same problem with the current mono version 1.1.10, when using an app called 'autopano-sift' it doesn't find the required libgdaplus (the latter one installed by DarwinPorts for mono). I worked around that by specifying the dll mapping manually in a 'System.Drawing.dll.config'.

comment:10 Changed 18 years ago by markd@…

Cc: markd@… added

Is this still an issue with mono 1.1.12?

comment:11 Changed 18 years ago by markd@…

Resolution: fixed
Status: newclosed

Mono is up to 1.1.14 now. Reopen this bug if you still have a problem with the port.

comment:12 Changed 16 years ago by cliff.spradlin@…

Resolution: fixed
Status: closedreopened

This is occuring to me in MacPorts 1.6 with Mono 1.9. Specifically, mono is not referencing libgdiplus.dylib in /opt/local/lib. /opt/local/etc/mono/config doesn't seem to contain an entry for this.

I get: System.DllNotFoundException: gdiplus.dll

comment:13 Changed 16 years ago by cliff.spradlin@…

I tried adding

<dllmap dll="gdiplus.dll" target="/opt/local/lib/libgdiplus.dylib" os="!windows" />

to the mono/config file.

But then when i run the program i get: Unhandled Exception: System.EntryPointNotFoundException: GdipCreateFromContext_macosx

Am I missing something?

comment:14 Changed 16 years ago by jmroot (Joshua Root)

Cc: mww@… removed
Milestone: Port Bugs

comment:15 Changed 16 years ago by andi@…

Cc: andi@… added

Cc Me!

comment:16 in reply to:  13 Changed 16 years ago by andi@…

Replying to cliff.spradlin@…:

I tried adding

<dllmap dll="gdiplus.dll" target="/opt/local/lib/libgdiplus.dylib" os="!windows" />

to the mono/config file.

But then when i run the program i get: Unhandled Exception: System.EntryPointNotFoundException: GdipCreateFromContext_macosx

I did the same changes and get the same result, so this problem still isn't fixed...

comment:17 Changed 15 years ago by nox@…

Cc: nox@… added
Description: modified (diff)

I've fixed this problem in gtk-sharp and gtk-sharp2, I'll soon attach a patch to fix mono.

Changed 15 years ago by nox@…

Attachment: mono-2.0.1_1.diff added

Patch against mono 2.0.1 portfile

comment:18 Changed 15 years ago by nox@…

Markus, could you look at the patch I've just attached to the ticket? The changes:

  • Patch etc/mono/config to fix the DllImport bug.
  • Fixed dependencies (mono depends on sqlite3 and cairo, see Mono.Data.Sqlite and Mono.Cairo).
  • Kept icu dependency in darwin_9 platform, there is no reason to use the Apple provided icu library.

comment:19 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Port: mono added
Note: See TracTickets for help on using tickets.