简体   繁体   中英

Mono Pkg-Config.exe Keeps Crashing?

I'm new to Mono - thought I'd give cross platform a try - my main IDE is Visual Studio and so the process of building applications through the command prompt is a bit foreign to me.

I was following the Mono Basics tutorial, and have gotten to the point where it says Winforms Hello World . I copied the code provided and saved it to a .cs file (on the Desktop).

I then opened up a command prompt and pointed it towards the Desktop directory. I ran the command:

mcs hello.cs -pkg:dotnet

And the result was: Pkg-Config.exe无法正常工作

The console told me that it was a CS8027 error but nothing else.

I have 3 environment variables that I added, with no fix:

  • PATH -> path to mono\\bin
  • PATH -> path to mono\\lib\\pkgconfig
  • PKG_CONFIG_PATH -> path to mono\\lib\\pkgconfig

This happens whenever I try to use pkg-config.exe (tried to use pkg-config.exe --list-all but the same problem arose).

I've checked other answers/questions about the CS8027 error but the solutions did not help - it still crashes every time!

Had the same problem. I had all the proper VC++ runtimes installed, but still crashed.

pkg-config.exe references librares (.dll) that are compiled in different versions of .Net. Your PATH (or pkg-config itself) might be referencing a different version than the one the .dll uses, or not have it at all.

pkg-config is a short-hand anyway. I fixed it by explicitly including the .dll I'm referencing using the proper version of .Net for me:

mcs hello.cs -r:"C:\Program Files\Mono\lib\mono\4.5-api\System.Windows.Forms.dll"

pkg-config is built with a different version of MSVC to Mono itself. You need the 32-bit VC++12 runtime installed for it to work. That ought to be included with mono.msi, as per https://github.com/mono/release/commit/8394dcc254510977c3e654abf916a48c6c6894fb

If you check the Windows event log, under Applications, you might get more information on what didn't work.

I had this problem, could help some.

D:\Code\Mono>mcs hello.cs -pkg:dotnet
error CS8027: Error running pkg-config. Check the above output.

I needed to download the following DLL:s from https://www.dll-files.com/

  • libiconv-2.dll
  • libgcc_s_sjlj-1.dll
  • libintl-8.dll
  • libglib-2.0-0.dll

Put them in C:\\Program Files\\Mono\\bin

All DLLs should be 32 bits even if Mono was 64 bits.

In my system the problem was the empty space inside the path of install and how that is managed inside of the pc files.

A workaround is to edit the pc files to change the prefix entry to the short path. In my system:

prefix=C:/PROGRA~1/Mono

instead of

prefix=${pcfiledir}/../..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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