使用 mkbundle 从 C# 源代码创建 Linux 可执行文件时出现问题 [英] Problems while creating a Linux-executable file from C# sourcecode using mkbundle

查看:24
本文介绍了使用 mkbundle 从 C# 源代码创建 Linux 可执行文件时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如本文所述 thread 以及 这里 我正在使用 mkbundle -o newfile oldfile.exe --static (OS: Ubuntu 11.10 64bit, Mono: 2.10.5) 创建一个可执行文件Apache Web 服务器(操作系统:Debian GNU/Linux 32 位).这里,oldfile.exe 是使用 mcs oldfile.cs 编译 C#-Hello-World-Code 的结果.在原始系统(使用 Ubuntu)上,该文件是可执行的.但是,当我在 Apache Web 服务器上调用 newfile 时,我会收到错误消息:

As mentioned in this thread as well as here I am using mkbundle -o newfile oldfile.exe --static (OS: Ubuntu 11.10 64bit, Mono: 2.10.5) to create a file which shall be executable on an Apache Web Server (OS: Debian GNU/Linux 32bit). Here, the oldfile.exe was the result of the compilation of a C#-Hello-World-Code using mcs oldfile.cs. On the original system (with Ubuntu) the file is executable. However, whenver I call newfile on the Apache Web Server I get the error:

无法执行二进制文件

另外,在执行 file newfile 时会说

Also, when doing file newfile it says

ELF 64 位 LSB 可执行文件,x86-64,版本 1 (SYSV),动态链接(使用共享库),未剥离

ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), not stripped

我怀疑如果 mkbundle 按预期工作,那么它应该已经读取

I suspect if mkbundle worked as it is supposed to, then it should have read

...静态链接...

不应该吗?任何人都知道为什么该文件在服务器上不可执行?是不是因为32bit/64bit的问题?

shouldn't it? Anyone an idea why the file is not executable on the Server? Is it a problem because of 32bit/64bit?

推荐答案

mkbundle from 64-bit Mono 生成 64-bit 可执行文件,您无法在 32-bit 内核上运行 64-bit 可执行文件.由于 mkbundle 没有生成 32 位二进制文​​件的选项,您显然需要使用 32 位 Mono 生成可执行文件(理论上您可以在 64 位系统上安装 32 位 Mono,但是不是很容易,所以我建议在某个地方安装一个 32 位系统,也许在 VM 中).

mkbundle from 64-bit Mono generates 64-bit executables and you cannot run a 64-bit executable on 32-bit kernel. As mkbundle doesn't have an option to generate 32-bit binaries you apparently need to generate your executable with 32-bit Mono (theoretically you can install 32-bit Mono on your 64-bit system but that is not very easy so I suggest installing a 32-bit system somewhere, maybe in VM).

这篇关于使用 mkbundle 从 C# 源代码创建 Linux 可执行文件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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