C # program does not work in mono on Linux.

I am trying to make my program written in Visual C # 2010 work on Linux. For this, I used the mkbundle function, so the potential client does not need to install mono. Unfortunately, I am not aware of Linux or Mono, so I just followed this: C # cywgwin mono mkbundle windows 7 - cannot compile file

But for some reason, mkbundle writes [FAIL] at the end, saying something about "There is no such file or directory." I have enclosed the full text below. Does anyone know how to solve this?

$ mkbundle -o MyProgram MyProgram.exe --deps OS is: Windows Sources: 1 Auto-dependencies: True embedding: C:\cygwin\home\Synaps\MyProgram.exe embedding: C:\Mono-2.10.8\lib\mono\4.0\mscorlib.dll embedding: C:\Mono-2.10.8\lib\mono\4.0\System.Drawing.dll embedding: C:\Mono-2.10.8\lib\mono\4.0\System.dll embedding: C:\Mono-2.10.8\lib\mono\4.0\Mono.Security.dll embedding: C:\Mono-2.10.8\lib\mono\4.0\System.Configuration.dll embedding: C:\Mono-2.10.8\lib\mono\4.0\System.Xml.dll embedding: C:\Mono-2.10.8\lib\mono\4.0\System.Security.dll embedding: C:\Mono-2.10.8\lib\mono\4.0\System.Windows.Forms.dll embedding: C:\Mono-2.10.8\lib\mono\4.0\Accessibility.dll embedding: C:\Mono-2.10.8\lib\mono\4.0\Mono.WebBrowser.dll embedding: C:\Mono-2.10.8\lib\mono\4.0\Mono.Posix.dll embedding: C:\Mono-2.10.8\lib\mono\4.0\System.Data.dll embedding: C:\Mono-2.10.8\lib\mono\4.0\Mono.Data.Tds.dll embedding: C:\Mono-2.10.8\lib\mono\4.0\System.Transactions.dll embedding: C:\Mono-2.10.8\lib\mono\4.0\System.EnterpriseServices.dll embedding: C:\Mono-2.10.8\lib\mono\4.0\AForge.Imaging.dll embedding: C:\Mono-2.10.8\lib\mono\4.0\AForge.dll embedding: C:\Mono-2.10.8\lib\mono\4.0\AForge.Math.dll Compiling: as -o temp.o temp.s gcc -mno-cygwin -g -o MyProgram -Wall temp.c `pkg-config --cflags --libs mono-2|d os2unix` temp.o : No such file or directory temp.c: In function `main': temp.c:143: warning: implicit declaration of function `g_utf16_to_utf8' temp.c:143: warning: assignment makes pointer from integer without a cast temp.c:158: warning: assignment makes pointer from integer without a cast [Fail] 

When I tried to use mkbundle on a Linux virtual machine, I successfully received the Linux executable, but I get the following error: whenever I run the program under Ubuntu Linux VM (via the Oracle VM virtual machine):

 Unhandled Exception: System.ArgumentException: A null reference or invalid value was found [GDI+ status: InvalidParameter] at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] in <filename unknown>:0 at System.Drawing.Bitmap.SetResolution (Single xDpi, Single yDpi) [0x00000] in <filename unknown>:0 at (wrapper remoting-invoke-with-check) System.Drawing.Bitmap:SetResolution (single,single) at AForge.Imaging.ColorReduction.ColorImageQuantizer.ReduceColors (System.Drawing.Bitmap image, Int32 paletteSize) [0x00000] in <filename unknown>:0 at FootMeasure.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: A null reference or invalid value was found [GDI+ status: InvalidParameter] at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] in <filename unknown>:0 at System.Drawing.Bitmap.SetResolution (Single xDpi, Single yDpi) [0x00000] in <filename unknown>:0 at (wrapper remoting-invoke-with-check) System.Drawing.Bitmap:SetResolution (single,single) at AForge.Imaging.ColorReduction.ColorImageQuantizer.ReduceColors (System.Drawing.Bitmap image, Int32 paletteSize) [0x00000] in <filename unknown>:0 at FootMeasure.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 
0
linux visual-studio-2010 mono mkbundle
source share
1 answer

As I said in a comment, if you want to create a self-contained Linux executable, you should not use mkbundle on Windows. You must run mkbundle on Linux to get the Linux executable (and you should probably take care of Linux-X86 in 32 bits and Linux-x86-64 in 64 bits, which are different).

I suggest you compile and run the application in the Linux box (you can even install the Linux system inside the virtual machine if you want). Thus, the easiest way is to install a Linux distribution (such as Debian) on your computer.

I don’t think that you can easily find a cross-compiler capable of compiling Mono for Linux in a Windows window.

And what you do (by running mkbundle on Windows), you create a Windows executable (for Cygwin), it cannot provide you with a Linux executable, no matter which option you try.

+5
source share

All Articles