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

可紊 提交于 2020-01-15 06:20:13

问题


As per suggestions from this thread on running C# apps sans .NET I've compiled my app using mono. I built the original app using the latest Visual C# .NET Express Edition. It runs fine on .NET on Windows. I then opened up Cygwin and navigated to my source where I compiled the project again, under mono using the following command:

$ 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. 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 -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. 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...).

Anyone ever run into anything like this? I'm stumped...


回答1:


It seems like it's trying to output into MyProject.exe, which is the same as the input file.

Try running

$ mkbundle -o ProgramOutput Program.exe --deps

This is just a guess, by the way, since I don't know mkbundle.



来源:https://stackoverflow.com/questions/558707/mono-mkbundle-tool-unable-to-create-binary-with-complaint-that-output-file-is-un

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!