尝试运行单声道捆绑程序,但缺少 libgdiplus 异常
我目前正在尝试让我的 C# 程序在 Linux 上运行。在我的 Linux 机器上使用 mono,程序运行良好。所以我使用了 mkbundle 并且它全部编译正确。但是当我尝试在任何其他 Linux 机器上运行捆绑程序时,我收到此错误:
Unhandled Exception: System.TypeInitializationException: An exception was thrown by the
type initializer for System.Windows.Forms.XplatUI --->
System.TypeInitializationException: An exception was thrown by the type initializer for
System.Drawing.GDIPlus ---> System.DllNotFoundException: libgdiplus.so.0
这是我使用的 mkbundle 命令:
mkbundle --static program.exe --deps -o a.out
我也尝试使用 mkbundle2 但没有成功。
我想也许有一种方法可以专门将库包含在 mkbundle 中(比如告诉在哪里可以找到 libgdiplus)。当我使用 mkbundle 时它应该被链接,但我想这不是因为当我在任何其他 Linux 机器(不运行单声道)上运行我的程序时,我收到此错误。
两台机器都运行 Ubuntu 10.10 AMD64。
I am currently trying to get my C# program to run on Linux. Using mono on my Linux machine, the program runs fine. So I used mkbundle and it all compiled and such correctly. But when I try to run the bundled program on any other Linux machine I get this error:
Unhandled Exception: System.TypeInitializationException: An exception was thrown by the
type initializer for System.Windows.Forms.XplatUI --->
System.TypeInitializationException: An exception was thrown by the type initializer for
System.Drawing.GDIPlus ---> System.DllNotFoundException: libgdiplus.so.0
This is the mkbundle command I used:
mkbundle --static program.exe --deps -o a.out
I also tried using mkbundle2 with no luck.
I thought maybe there was a way to specifically include libraries with mkbundle (like telling where to find libgdiplus). It should be linked in when I use mkbundle, but I guess it isn't because when I run my program on any other Linux machine (that isn't running mono), I get this error.
Both machines are running Ubuntu 10.10 AMD64.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
windows 的 mono 3.0 配置文件的 libgdiplus 引用中有错误的条目。
更改文件 C:\Program Files (x86)\Mono-3.0.2\etc\mono\config 的两行
如下:
The mono 3.0 config file for windos has bad entries dor the libgdiplus references.
Change the two lines of the file C:\Program Files (x86)\Mono-3.0.2\etc\mono\config
as follows:
外部帮助程序库未捆绑在可执行文件中,因此您还需要分发 libgdiplus,或者使用 -oo 选项创建一个目标文件,您将在程序中将其与所需的库链接在一起。当然,您还必须添加一个 dllmap 条目以从 libgdiplus 映射到 __Internal。
请注意,如果您只是按原样分发 mkbundle 生成的程序,则会违反 Mono 的自由软件许可证,因此除非您拥有 Novell 的特殊许可证,或者您的程序是自由软件,或者您还分发了目标文件的应用程序,以便人们可以重新链接自己,您不应该使用 mkbundle。
Extrernal helper libraries are not bundled in the executable, so you will either need to distribute libgdiplus as well, or use the -oo option to create an object file that you will link in a program together with the libs that you need. Of course you will also have to add a dllmap entry to map from, for example, libgdiplus to __Internal.
Note that if you just distribute the program generated by mkbundle as is, you're violating mono's free software licence, so unless, for example, you have a special licence from Novell, or you program is free software or you also distribute the object files of the app so people can relink themselves, you shouldn't use mkbundle.
如果在您的“外国”计算机上运行此命令:
您应该能够看到它所期望的共享库。您可能需要将 libgdiplus.so 与您的程序一起分发,或者静态链接到 libgdiplus.a
If on your "foreign" machine you run this:
You should be able to see what shared libraries it is expecting. You may need to distribute libgdiplus.so with your program or perhaps statically link in libgdiplus.a