简体   繁体   English

Mono Mkbundle工具无法创建二进制文件,并抱怨输出文件不可用

[英]Mono mkbundle tool unable to create binary with complaint that output file is unavailable

As per suggestions from this thread on running C# apps sans .NET I've compiled my app using mono. 根据该线程有关在无.NET的情况下运行C#应用程序的建议,我已经使用mono编译了我的应用程序。 I built the original app using the latest Visual C# .NET Express Edition. 我使用最新的Visual C#.NET Express Edition构建了原始应用程序。 It runs fine on .NET on Windows. 它在Windows的.NET上运行良好。 I then opened up Cygwin and navigated to my source where I compiled the project again, under mono using the following command: 然后,我打开Cygwin并导航到我的源代码,在这里使用mono再次使用以下命令对项目进行编译:

$ mcs <myProjectHere>.cs

This produces MyProject.exe, which can be run from within Cygwin with success, and can be run from the Window command line successfully. 这将生成MyProject.exe,可以成功在Cygwin内运行它,也可以从Window命令行成功运行。 Commands used are: 使用的命令是:

$ mono MyProject.exe
C:\...>mono MyProject.exe

and just for kicks, simply: 只是为了踢,简单地:

C:\...>MyProject.exe

All work as expected. 所有工作都按预期进行。 I then tried to build the mono compiled executable into a statically linked binary using the mkbundle command as follows: 然后,我尝试使用mkbundle命令将单声道编译的可执行文件构建为静态链接的二进制文件,如下所示:

$ mkbundle -o MyProject MyProject.exe --deps

This is where things begin to go downhill. 这是事情开始下坡的地方。 It starts off well enough and then complains that the output file (presumably, MyProject.exe) cannot be opened because it is busy. 它启动得足够好,然后抱怨输出文件(可能是MyProject.exe)由于打开而无法打开。 The full output of it all is here: 这的全部输出在这里:

$ mkbundle -o Program Program.exe --deps
    OS is: Windows
    Sources: 1 Auto-dependencies: True
       embedding: c:\Documents and Settings\bsweeney\My Documents\Visual Studio 2008
    \Projects\TestConsole\TestConsole\Program.exe
       embedding: C:\PROGRA~1\Mono-2.2\lib\mono\2.0\mscorlib.dll
    Compiling:
    as -o temp.o temp.s
    gcc -mno-cygwin -g -o Program -Wall temp.c `pkg-config --cflags --libs mono|dos2
    unix`  temp.o
    /usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/bin/ld: cannot op
    en output file Program.exe: Device or resource busy
    collect2: ld returned 1 exit status
    [Fail]

I claim that my unix gcc toolchain is installed and in good condition because I've been able to successfully compile a few c++ apps in eclipse using it recently (although i supposed i should be open to any number of problems...). 我声称我的unix gcc工具链已安装且状态良好,因为最近我已经能够使用它成功地在eclipse中编译一些c ++应用程序(尽管我认为我应该对任何数量的问题持开放态度...)。

Anyone ever run into anything like this? 有人遇到过这样的事情吗? I'm stumped... 我难过...

It seems like it's trying to output into MyProject.exe , which is the same as the input file. 似乎正在尝试输出到MyProject.exe ,它与输入文件相同。

Try running 尝试跑步

$ mkbundle -o ProgramOutput Program.exe --deps

This is just a guess, by the way, since I don't know mkbundle . 顺便说一下,这只是一个猜测,因为我不知道mkbundle

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

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