mono桌面应用移到android,c# – 使用mkbundle将Mono GTK#应用程序移植到其他平台

我是一个长期的C#开发人员,但是对Mono来说是新的,特别是Gtk#.我开发了一个使用C#和Gtk#的小应用程序.我需要这个程序在

Windows,

Linux和Mac上工作,所以我决定去单声道,到目前为止,它似乎是一个很酷的框架.

我的简单应用程序是根据用户选择的本地目录和端口启动XSP Web服务器.在理想情况下,我希望我的应用程序能够正常工作,而无需首先安装Mono框架,但这不是必须的.我正在使用以下图书馆:

using System;

using Gtk;

using System.Net;

using Mono.WebServer;

using System.Diagnostics;

我正在Mac上开发(Snow Leopard,10.6.7).我的可执行文件在我的Mac上完美无缺.但是我有Ubuntu和Windows的问题.我的应用程序部分在Ubuntu(11.04)上运行 – 它启动并且似乎工作,但是当我尝试启动XSP Web服务器时失败,这似乎是可以预期的,因为Mono.Webserver可能没有安装在我的Ubuntu机器上.在Windows(7,64位)上,当我双击它时,我的应用程序会立即崩溃.崩溃报告告诉我发生了System.IO.FileNotFoundException错误.可能是因为缺少XSP库吗?

无论如何,我在互联网上环顾四周,了解到mkbundle.我已经执行了各种论坛线程建议的以下设置:

export AS="as -arch i386"

我已导航到我的项目的/ bin / Release目录,然后运行以下命令:

mkbundle MivandoLocalServer.exe -o MivandoLocalServer --deps

但是我得到以下输出,最终失败:

Compiling:

as -arch i386 -o temp.o temp.s

cc -g -o MivandoLocalServer -Wall temp.c `pkg-config --cflags --libs mono-2` temp.o

Package mono-2 was not found in the pkg-config search path.

Perhaps you should add the directory containing `mono-2.pc'

to the PKG_CONFIG_PATH environment variable

No package 'mono-2' found

temp.c:2:36: error: mono/metadata/assembly.h: No such file or directory

temp.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘assembly_bundle_MivandoLocalServer_exe’

temp.c:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

temp.c:18: error: ‘NULL’ undeclared here (not in a function)

temp.c: In function ‘mono_mkbundle_init’:

temp.c:22: warning: implicit declaration of function ‘mono_register_bundled_assemblies’

temp.c:22: error: ‘bundled’ undeclared (first use in this function)

temp.c:22: error: (Each undeclared identifier is reported only once

temp.c:22: error: for each function it appears in.)

temp.c: In function ‘main’:

temp.c:114: warning: implicit declaration of function ‘mono_set_dirs’

[Fail]

我真的不知道从这里做什么.我已经安装了MacPorts,我已经阅读,这可能会导致一些关于pkg-config目录的问题.这是真的?如果是的话,我该怎么做才能使它工作?

我希望有人能够帮助我.谢谢!

最好的祝福,

塞巴斯蒂安

PS.我也在Mono的主页的论坛上发布了这个问题,但迄今没有任何回应.

更新:我怀疑MacPorts干扰我的pkg-config目录设置.当我在终端中输入以下命令时,mkbundle允许我编译.但我仍然遇到一些问题.

export PKG_CONFIG_PATH="/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig/"

export AS="as -arch i386"

export CC="cc -arch i386"

执行以下mkbundle命令会导致包含所有必需依赖关系的4.9 MB的Unix存档.当我在Mac上双击这个新文件时,会弹出一个终端窗口并启动我的应用程序.甜!但是这在Windows和Ubuntu中都不起作用.

mkbundle MivandoLocalServer.exe -o MivandoLocalServerBundle --deps -z

我想要收到的是可以在Windows和Ubuntu中运行的捆绑的可执行文件.到目前为止,我还没有遇到一个让我这样做的解决方案.我试图在我的Windows 7机器上安装MonoDevelop,复制我的解决方案并在那里构建.但是,由于我的应用程序依赖于Mono.WebServer2库,我无法在Windows上构建它.我无法找到Mono.WebServer2.dll在Windows上的任何地方下载.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值