-->

mkbundle on Mac with Mono: “mono/metadata/mono-con

2019-04-18 23:19发布

问题:

I'm trying to create a Mac bundle with Mono. When I execute:

    mkbundle file.exe --deps -o FILE

I get this during compilation:

    fatal error: "mono/metadata/mono-config.h" file not found

Am I missing something?

回答1:

I had this same problem on my Mac. I solved it by setting pkg-config.

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/3.0.12/lib/pkgconfig

Just a heads up, for Mac you have to...

export AS="as -arch i386"
export CC="cc -arch i386"

...as stated here An issue when running mono 2.10.2 mkbundle on Mac OS X snow leopard but on Mountain Lion, I had to do this instead so that the app could run on Lion.

export AS="as -arch i386"
export CC="clang -arch i386 -mmacosx-version-min=10.6"


回答2:

The key is the preceding error (sh: pkg-config: command not found), note that pkg-config is stored at '/Library/Frameworks/Mono.framework/Commands'.

Solution (see here and here):

Prepend the "/Library/Frameworks/Mono.framework/Commands" folder to your PATH variable:

export PATH=/Library/Frameworks/Mono.framework/Commands:$PATH

In addition (as proposed by aiapatag and the objective-c runtime and CoreFoundation framework solution proposed here).

export AS="as -arch i386"
export CC="cc -arch i386 -framework CoreFoundation -lobjc -liconv"


回答3:

Try reinstalling Mono Development Kit (MDK). Do not install Mono Runtime Environment (MRE) on top of MDK. MDK will suffice.

Then, if you're using Windows (but I guess you're on OSX -- but just to mention): you will need a Unix-like toolchain for mkbundle to to work.

Excerpt: from their site

On Windows systems, it it necessary to have Unix-like toolchain to be installed for mkbundle to work. You can use cygwin's and install gcc, gcc-mingw and as packages. (sic)