[Mono-osx] Redistributable Mac OSX app without mono using mkbundle2

dgdw david.drysdale-wilson at linn.co.uk
Fri May 14 07:13:05 EDT 2010


Hi,

I am in the process of trying to produce a Mac application that can be run
without the need for our users to first install mono - However I am running
into a lot of issues and I hope that someone here will be able ti give me
some pointers as to what I am doing wrong.

My development environment is a Mac with Snow Leopard 10.6.3, Mono 2.6.4 and
Monobjc 2.0.492.0 and XCode 3.2.1.

So far I have managed to create a working Mac application by creating the
appropriate .app directory structure, populated it with the required
assemblies, exe, pInfo and shell script (which invokes my exe with mono).
The next step is to remove the need to have mono installed.

The first issue I had with mkbundle2 is that the compilation of the auto
generated assembly fails with the following errors,

as -o temp.o temp.s
temp.s:2:unknown section type: symbol_stubs
temp.s:2:Rest of line ignored. 1st junk character valued at 112 (p).
<snip>

I saw a post about this issue (it appears to be an issue of the assembler
requiring information about the architecture to compile against), so I set
the AS environment variable to 'as -arch i386'. Next the compilation fails
with the following errors,

cc -g a.out -Wall temp.c 'pkg-config --cflags --libs mono'  temp.o
temp.c: In function 'install_dll_config_files':
temp.c:47: warning: pointer targets in passing argument 2 of
'mono_register_config_for_assembly' differ in signedness
ld: warning: in
/Library/Frameworks/Mono.framework/Versions/2.6.4/lib/libmono.dylib, file is
not of required architecture
<snip>

So I set the CC environment variable to 'cc -arch i386'. Now the compilation
fails with the following errors,

cc -g a.out -Wall temp.c 'pkg-config --cflags --libs mono'  temp.o
In file included from temp.c:2
/Library/Frameworks/Mono.framework/Versions/2.6.4/include/mono-1.0/mono/metadata/assembly.h:4:18:
error: glib.h: No such file or directory
<snip>

The output from 'pkg-config --cflags --libs mono' gives,

-D_THREAD_SAFE
-I/Library/Frameworks/Mono.framework/Versions/2.6.4/include/mono-1.0 
-pthread -L/Library/Frameworks/Mono.framework/Versions/2.6.4/lib/ -lmono
-lpthread -lm

No mention of glib, so I looked in the mono.pc file in
/Library/Frameworks/Mono.framework/Versions/2.6.4/lib/pkgconfig/ and
discovered the line 'Requires: glib-2.0 gthread-2.0 was commented out. I
uncommented the line and finally mkbundle2 produces a compiled version of my
exe.

The next step is the use otool to get a list of the mono libraries my
compiled executable is dependent on, move them to the Frameworks directory
in my .app directory and fix up the libraries and compiled executable
library references using install_name_tool.

I theory this .app should now run without mono installed. On launching the
application I get a brief glimpse of the main form and then it closes, so I
am close but not there yet. On launching from a terminal it appears that my
application depends on libgdiplus.dylib - However otool does not show this
to be the case, so I am now completely stumped as to what the next step is
in order to get this external dependency resolved. Does anyone have any idea
of how to correct this problem or a work around?

Thanks for any help,
David
-- 
View this message in context: http://mono.1490590.n4.nabble.com/Redistributable-Mac-OSX-app-without-mono-using-mkbundle2-tp2216423p2216423.html
Sent from the Mono - OSX mailing list archive at Nabble.com.


More information about the Mono-osx mailing list