2012-10-13 134 views
2

試圖爲可在Linux上工作的控制檯創建獨立應用程序,工作環境位於Mac OS X 10.7上。Mono c#控制檯應用程序,使用mkbundle錯誤創建獨立程序

1.)打開Monodevelop並創建一個新的解決方案,一個「C#控制檯項目」。 mkbundle -o HelloTest HelloWorld.exe的--deps

: 2.)建立該應用中,exe將在倉/ Release文件夾 3.)在Mac OS X的開路端,轉到文件夾和類型創建

這將發生:

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] 

對我在做什麼有什麼建議嗎?需要一個獨立的Linux應用程序,從osx開發。拉我的頭髮好幾個小時。

+0

MacPack是否適合您? –

回答

3

您不能在OSX上創建將在Linux平臺上使用的二進制文件。請記住,mkbundle構建原生平臺代碼,而不是中間/ JIT編譯/ MSIL代碼。

這並不能解決你在OSX上遇到的錯誤(我不知道發生了什麼問題),但是如果你想讓你的應用在Linux上運行,請在Linux上安裝Mono並從那裏運行mkbundle。