简体   繁体   English

从在Mono上运行的C#进程运行C ++应用程序。 运行检测器错误

[英]Running C++ app from C# process running on Mono. run-detectors error

I'm currently working on porting a tool to Linux. 我目前正在将工具移植到Linux。 I'm using mono to to this, and have got the main tool running. 我正在为此使用mono,并已运行主要工具。 However, this tool calls another program, which is written in C++ and compiled natively on Linux with g++. 但是,此工具将调用另一个程序,该程序用C ++编写,并在Linux上使用g ++进行本地编译。 I've had a lot of difficulty porting this over, but have it working and running (runs as expected with ./othertool.exe). 我在移植此文件时遇到了很多困难,但是却可以正常运行(与./othertool.exe一样运行)。

However, when trying to run the original tool on Mono, it fails at launching the other tool, giving a error. 但是,当尝试在Mono上运行原始工具时,它在启动另一个工具时失败,并显示错误。

run-detectors: unable to find an interpreter for .../othertool.exe

I'm not sure why this happens, as when testing with a hello world, I managed to get a C++ program running by calling it from C# on Mono. 我不确定为什么会这样,因为在用hello世界进行测试时,我设法通过在Mono上从C#调用C ++程序来使其运行。 I'm running the other tool using the Process class (see code) which works fine with the hello world example. 我正在使用Process类(请参见代码)运行另一个工具,该类在hello world示例中运行良好。

var process = new Process
{
    StartInfo =
    {
        FileName = baseDir +
                   Path.DirectorySeparatorChar +
                   "tools" +
                   Path.DirectorySeparatorChar +
                   "othertool.exe",
        Arguments = arguments.ToString(),
        UseShellExecute = false
    }
};

process.Start();
process.WaitForExit();

Anyone know why this happens? 有人知道为什么会这样吗? Google does not yield anything so I guess this might not be common. Google不会产生任何结果,所以我想这可能并不常见。 Feel free to ask for more information or clarity, as I've probably left something out. 随意询问更多信息或澄清,因为我可能遗漏了一些内容。

Ok so turns out that I was somehow using the Windows built version of othertool instead of the Linux one. 好的,事实证明我在某种程度上使用Windows构建的othertool版本而不是Linux版本。 Who let that happen? 谁让那件事发生? Runs 'fine' when using the correct one. 使用正确的命令时运行“精细”命令。 – Cameron –卡梅伦

Cool, run-detectors/interpreter failures usually (always?) are related to PE executable ( .exe ) issues (and other non-Linux binaries), assuming you are on a Linux disto (like Ubuntu) that support launching PE format but without something like Wine installed, you will get a failure. 假设您使用支持启动PE格式但不支持启动PE格式的Linux发行版(例如Ubuntu),则运行检测器/解释器很酷的故障通常(总是?)与PE可执行文件( .exe )问题(以及其他非Linux二进制文件)有关。像安装Wine一样,您会失败。 IMHO: Naming non-PE/non-CIL files as an .exe is bad-form on Linux... – SushiHangover 恕我直言:在Linux上,将非PE /非CIL文件命名为.exe是错误的格式... – SushiHangover

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM