我正在尝试使用MKBundle,以便可以分发GTK#应用程序,而无需用户安装.NET/MONO或GTK#。我已经成功地捆绑了一个使用Winforms的应用程序,但是由于某种原因,当我使用GTK#应用程序做同样的情况时,它将无法正常工作。

这就是我从Cygwin中得到的:

$ mkbundle --deps a.exe OS is: Windows Sources: 1 Auto-dependencies: True

未经处理的异常:system.io.filenotfoundException:无法加载文件或汇编“ gtk-sharp”或其依赖项之一。该系统找不到指定的文件。
文件名:'gtk-sharp'
at System.AppDomain.load(System.Reflection.SemblyName AssemblyRef,System.Security.policy.policy.policy.policy.vience汇编)[0x00000] in:0
at(包装器远程互动与检查检查)系统。应用程序:load(system.reflection.semblyname,system.security.policy.policy.policy.policy.policy.policy))
at System.AppDomain.load(System.Reflection.SemblyName AssemblyRefRef)[0x00000] in:0
at(包装器远程互动与检查检查)系统.AppDomain:load(System.Reflection.semblyName)
at System.Reflection.Sembly.Load(System.Reflection.SemblyName AssemblyRefref)[0x00000] in:0
在makebundle.queueassembly(System.Collections.ArrayList文件,System.String Codebase)[0x00000] in:0
在makebundle.main(system.string [] args)[0x00000] in:0
错误]致命的未经治疗异常:system.io.filenotfoundException:无法加载文件或汇编“ gtk-sharp”或其依赖项之一。该系统找不到指定的文件。
文件名:'gtk-sharp'
at System.AppDomain.load(System.Reflection.SemblyName AssemblyRef,System.Security.policy.policy.policy.policy.vience汇编)[0x00000] in:0
at(包装器远程互动与检查检查)系统。应用程序:load(system.reflection.semblyname,system.security.policy.policy.policy.policy.policy.policy))
at System.AppDomain.load(System.Reflection.SemblyName AssemblyRefRef)[0x00000] in:0
at(包装器远程互动与检查检查)系统.AppDomain:load(System.Reflection.semblyName)
at System.Reflection.Sembly.Load(System.Reflection.SemblyName AssemblyRefref)[0x00000] in:0
在makebundle.queueassembly(System.Collections.ArrayList文件,System.String Codebase)[0x00000] in:0
在makebundle.main(system.string [] args)[0x00000] in:0`

但是,我的路径变量中有/cygdrive/c/gtksharp/2.12/lib。我可以检查一下,好像我在cygwin中键入“ gtk-sharp.dll”一样,我会返回以下内容:

$ gtk-sharp.dll bash: /cygdrive/c/GtkSharp/2.12/lib/gtk-sharp-2.0/gtk-sharp.dll: cannot execute binary file

因此,它应该能够找到文件!

任何帮助将非常感激。

有帮助吗?

解决方案

我找到了一个完成所有这些内容并将其修改为最新版本的Shell脚本,截至2013年5月,您可以使用以下脚本:

https://gist.github.com/tebjan/5581296

1.)安装Cygwin并确保选择以下软件包:-GCC-MINGW-PKG-CONFIG-MINGW-ZLIB1-MINGW-ZLIB-DEVEL

2.)安装单声道发布程序包:“ Windows,GTK#和XSP的单声道”

3.)下载脚本以外的应用程序并将其修改以适合您的环境(仔细阅读文件中的评论)。

4.)打开cygwin并导航到您应用程序的输出文件夹,例如,可播种和scipt位于scipt中,例如yourproject/bin/preason

5.)用命令执行脚本:./mkbundle_cygwin.sh

故障排除:如果您的捆绑可执行文件无法正常工作,请确保原始.NET应用程序在单声道上起作用。您可以通过调用mono.exe并将.NET应用程序传递给它,或者通过安装Xamarinstudio并从那里运行项目(使您将单声道设置为运行时)来测试。

其他提示

好吧,我不知道这是否是一个真正的解决方案,但是我只是从c: gtksharp 2.12 lib lib gtk-sharp-2.0复制了组件,现在,似乎使用以下步骤将OK捆绑在一起:

mkbundle -c -o host.c -oo bundle.o --deps app.exe

nano host.c

从以下方式更改以下内容:

#ifdef _WIN32
#include <windows.h>
#endif`

#ifdef _WIN32
#include <windows.h>
#endif
#undef _WIN32

最后:

gcc -mno-cygwin -o bundled.exe -Wall host.c `pkg-config --cflags --libs mono-2|dos2unix` bundle.o

那对我有用。尽管我还需要从c: mono-2.10.5 etc mono 4.0复制机器。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top