C#程序没有下单在Linux下工作。 [英] C# program doesn't work under mono in Linux.

查看:260
本文介绍了C#程序没有下单在Linux下工作。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我的程序写在Linux上的Visual C#2010年工作。对于这一点,我已经使用mkbundle功能,从而使潜在的客户端没有安装单。可惜我不是熟知Linux或单声道,所以我只是跟着这样的:<一href="http://stackoverflow.com/questions/1906843/c-sharp-cywgwin-mono-mkbundle-windows-7-cannot-compile-file">c# cywgwin单mkbundle Windows 7的 - 无法

编译文件

但由于某些原因mkbundle写道[FAIL]到底,说什么没有这样的文件或目录。我已经粘贴了以下全文。有谁知道如何解决这个问题?

  $ mkbundle -o MyProgram MyProgram.exe --deps
操作系统是:WINDOWS
资料来源:1自动依赖关系:真
   嵌入:C:\ cygwin的\家\ SYNAPS \ MyProgram.exe
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ mscorlib.dll中
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ System.Drawing.dll程序
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ System.dll中
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ Mono.Security.dll
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ System.Configuration.dll
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ system.xml.dll的
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ System.Security.dll
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ System.Windows.Forms.dll中
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ Accessibility.dll
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ Mono.WebBrowser.dll
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ Mono.Posix.dll
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ System.Data.dll中
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ Mono.Data.Tds.dll
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ System.Transactions.dll
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ System.EnterpriseServices.dll
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ AForge.Imaging.dll
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ AForge.dll
   嵌入:C:\单-2.10.8 \ lib目录\单声道\ 4.0 \ AForge.Math.dll
编译:
作为-o temp.o temp.s
gcc的-mno-cygwin的-g -o MyProgram -Wall temp.c`pkg配置--cflags --libs单2 | D
os2unix` temp.o
: 无此文件或目录
temp.c:在函数'主':
temp.c:143:警告:功能`g_utf16_to_utf8隐式声明
temp.c:143:警告:赋值时将整数指针,未作类型转换
temp.c:158:警告:赋值时将整数指针,未作类型转换
[失败]
 

当我试图用mkbundle在Linux虚拟机,我成功地获得了Linux的可执行文件,但收到以下错误,当我运行在Ubuntu Linux操作系统的虚拟机程序(由Oracle VM虚拟框):

 未处理的异常信息:System.ArgumentException:空引用或无效的价值被发现[GDI +的状态:InvalidParameter]
  在System.Drawing.GDIPlus.CheckStatus(状态状态)[0x00000]与&lt;文件名不明&GT;:0
  在System.Drawing.Bitmap.SetResolution(单xDpi,单yDpi)[0x00000]与&lt;文件名不明&GT;:0
  在(包装远程处理调用,以检查)System.Drawing.Bitmap:SetResolution(单曲一次,单曲)
  在AForge.Imaging.ColorReduction.ColorImageQuantizer.ReduceColors(System.Drawing.Bitmap图像,的Int32 paletteSize)[0x00000]与&lt;文件名未知&GT;:0
  在FootMeasure.Program.Main(System.String []参数)[0x00000]与&lt;文件名不明&GT;:0
[错误]致命未处理的异常信息:System.ArgumentException:空引用或无效的价值被发现[GDI +的状态:InvalidParameter]
  在System.Drawing.GDIPlus.CheckStatus(状态状态)[0x00000]与&lt;文件名不明&GT;:0
  在System.Drawing.Bitmap.SetResolution(单xDpi,单yDpi)[0x00000]与&lt;文件名不明&GT;:0
  在(包装远程处理调用,以检查)System.Drawing.Bitmap:SetResolution(单曲一次,单曲)
  在AForge.Imaging.ColorReduction.ColorImageQuantizer.ReduceColors(System.Drawing.Bitmap图像,的Int32 paletteSize)[0x00000]与&lt;文件名未知&GT;:0
  在FootMeasure.Program.Main(System.String []参数)[0x00000]与&lt;文件名不明&GT;:0
 

解决方案

正如我所说的评论,如果你想制作一个自给自足的的Linux 的二进制可执行文件,你不应该使用 mkbundle 在Windows上。 您应该运行 mkbundle 在Linux ,以获得一个Linux的可执行文件(你也许应该在32位关心Linux的X86和Linux X86-64在64位,这是不同的)。

我建议你编译和运行在Linux机器你的应用程序(你甚至可以安装Linux系统内部的虚拟机,如果你想)。所以,最简单的方法就是为你的机器上安装一个Linux发行版(如Debian的)。

我不认为你会很容易找到的交叉编译器的能够在单声道的方案针对Linux的编译,在Windows中,

和你正在做的(运行 mkbundle 在Windows上)是生产一个Windows可执行文件(用于Cygwin的)东西,它不能给你的Linux二进制可执行文件,无论选择尝试

I am trying to make my program written in Visual C# 2010 work on Linux. For that, I have used mkbundle feature, so that potential client doesn't have to install mono. Unfortunately I am not knowledgeable about Linux or Mono, so I have just followed this: c# cywgwin mono mkbundle windows 7 - cannot compile file

But for some reason mkbundle writes [FAIL] in the end, saying something about "No such file or directory". I have pasted the full text below. Does anybody 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 Linux virtual machine, I successfully obtained Linux executable, but get the following error, whenever I run the program under Ubuntu Linux VM (by Oracle VM Virtual Box):

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 

解决方案

As I said in a comment, if you want to produce a self-sufficient Linux executable binary, you should not use mkbundle on Windows. You should run mkbundle on Linux to get a Linux executable (and you probably should care about Linux-X86 in 32 bits and Linux-x86-64 in 64 bits, which are different).

I suggest you to compile and run your application in a Linux box (you could even install a Linux system inside a VM if you want). So the simplest way is to install a Linux distribution (e.g. Debian) on your machine.

I don't think you'll easily find a cross-compiler able to compile, on a Windows box, a Mono program targeted for Linux.

And what you are doing (running mkbundle on Windows) is producing a Windows executable (for Cygwin), it cannot give you a Linux binary executable, whatever option you try.

这篇关于C#程序没有下单在Linux下工作。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆