[Gtk-sharp-list] Installing on OS X

Chris Ridd chris.ridd@isode.com
Fri, 18 Jun 2004 23:38:26 +0100

On 18/6/04 10:26 pm, Matt Spong <mspong@gmail.com> wrote:

> Hi
> I'm trying to get GTK# installed on OS X with the binary package
> version of Mono from go-mono.com.  GTK# built from source and seemed
> to install with no problems, but when trying to run the sample
> programs, I get an error about the gtk-sharp assembly not being found:
> ** (menu.exe:29471): WARNING **: Could not find assembly gtk-sharp,
> references from /Users/spong/Desktop/gtk-sharp-0.93/sample/menu.exe
> (assemblyref_index=1)
>      Major/Minor: 1,0
>      Build:       0,0
>      Token:       35e10195dab3c99f
> I even tried manually installing the built DLLs from
> /usr/local/lib/mono into the gac using gacutil, and they seemed to be
> in the gac fine, but it's still not finding them.
> Does anybody know what the problem might be?
> thanks
> Matt

I saw something like this in beta2, and it seems like a bug in the mono
build (or the osx port). Essentially mono can't locate the native shared
library that's used by gtk-sharp.dll as despite being built with
prefix=/opt/local, mono searches for native shared libraries in "",
"/usr/local/lib", "/lib", "/usr/lib" and ".".

The workaround for me was to set the DYLD_LIBRARY_PATH environment variable
to point to the directory containing libgtk-x11-2.0.0.dylib (dylibs are
native shared libraries), and then run the program.

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

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

% setenv DYLD_LIBRARY_PATH /opt/local/lib
% mono helloworld.exe
(it works)

I haven't tried to see if this is still required in beta3.