Problems while creating a Linux-executable file from C# sourcecode using mkbundle(使用 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 可执行文件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 mkbundle 从 C# 源代码创建 Linux 可执行文件时出现问题
基础教程推荐
- 全局 ASAX - 获取服务器名称 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
