Backer
Backer

Reputation: 121

Mono c# console app, create standalone with mkbundle errors

Trying to create a standalone app for console that will work on Linux, working environment is on Mac os x 10.7.

1.) Open Monodevelop and create new solution, a "C# Console Project". 2.) Build the app, the exe will be created in bin/Release folder 3.) In mac os x open terminal, goto folder and type: mkbundle -o HelloTest HelloWorld.exe --deps

This will happen:

OS is: Darwin
Sources: 1 Auto-dependencies: True
   embedding: /Users/fredrickbacker/Documents/Mono/HelloWorld/HelloWorld/bin/Release/HelloWorld.exe
   embedding: /Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/4.0/mscorlib.dll
Compiling:
as -arch i386 -o temp.o temp.s 
cc -arch i386 -g -o HelloTest -Wall temp.c `pkg-config --cflags --libs mono-2`  temp.o
temp.c:2:39: error: mono/metadata/mono-config.h: No such file or directory
temp.c:3:36: error: mono/metadata/assembly.h: No such file or directory
temp.c:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘assembly_bundle_HelloWorld_exe’
temp.c:8: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘assembly_bundle_mscorlib_dll’
temp.c:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
temp.c:22: error: ‘NULL’ undeclared here (not in a function)
temp.c: In function ‘mono_mkbundle_init’:
temp.c:26: warning: implicit declaration of function ‘mono_register_bundled_assemblies’
temp.c:26: error: ‘bundled’ undeclared (first use in this function)
temp.c:26: error: (Each undeclared identifier is reported only once
temp.c:26: error: for each function it appears in.)
temp.c: In function ‘main’:
temp.c:118: warning: implicit declaration of function ‘mono_set_dirs’
[Fail]

Any suggestions on what I'm doing wrong? Want a standalone linux app, developed from osx. Pulling my hair for hours.

Upvotes: 2

Views: 1062

Answers (1)

mbarthelemy
mbarthelemy

Reputation: 12913

You cannot build a binary that will be used on a Linux platform from an OSX one. Remember that mkbundle builds native platform code, not intermediate/JIT-compilable/MSIL code.

That does not solve the errors you have on OSX (I have no idea about what's going wrong), but if you want your app to run on Linux, install Mono on a Linux box and run mkbundle from there.

Upvotes: 3

Related Questions