尝试运行单声道捆绑程序,但缺少 libgdiplus 异常

发布于 2024-10-01 18:27:21 字数 765 浏览 2 评论 0原文

我目前正在尝试让我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

爱,才寂寞 2024-10-08 18:27:21

windows 的 mono 3.0 配置文件的 libgdiplus 引用中有错误的条目。

更改文件 C:\Program Files (x86)\Mono-3.0.2\etc\mono\config 的两行
如下:

 <dllmap dll="gdiplus" target="/tmp/install/lib/libgdiplus.so" os="!windows"/>
 <dllmap dll="gdiplus.dll" target="/tmp/install/lib/libgdiplus.so" os="!windows"/>

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:

 <dllmap dll="gdiplus" target="/tmp/install/lib/libgdiplus.so" os="!windows"/>
 <dllmap dll="gdiplus.dll" target="/tmp/install/lib/libgdiplus.so" os="!windows"/>
隐诗 2024-10-08 18:27:21

外部帮助程序库未捆绑在可执行文件中,因此您还需要分发 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.

淡淡的优雅 2024-10-08 18:27:21

如果在您的“外国”计算机上运行此命令:

ldd a.out

您应该能够看到它所期望的共享库。您可能需要将 libgdiplus.so 与您的程序一起分发,或者静态链接到 libgdiplus.a

If on your "foreign" machine you run this:

ldd a.out

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文