pkg-config path for mono on mac

陌路散爱 提交于 2020-01-04 07:04:10

问题


I installed mono in Mac OS X. I was following these instructions on the mono website. The first console application worked because it didn't use any packages. However, when I ran gmcs hello.cs -pkg:gtk-sharp-2.0, it told me I didn't have pkg-config installed. So I installed pkg-config. Now I get this error because pkg-config doesn't know the mono package path:

Perhaps you should add the directory containing `gtk-sharp-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk-sharp-2.0' found
error CS8027: Error running pkg-config. Check the above output.

Where is the mono package path and what do I need to add to .bash_profile to make it so that Mono can find the packages?


回答1:


Well it depends on the location of mono. Just locate it from the console using which mono, which will give you something like /opt/local/bin/mono (if you did use macports). The PKG_CONFIG_PATH then corresponds to /opt/local/lib/pkgconfig/. You could also start find /opt/local/ -name "mono.pc" and see which path is revealed. If you have absolutely no clue where mono resides (/Developer/Library/Framework might be a good guess, too) use the find command with "/" as path.




回答2:


When I was installing Mono on Mac OS 10.4, I saw the same error. I tried many different versions of Mono. Version 2.4.3.1 is what I settled on. To fix the problem I added this to my ~/.bash_profile file:

# Add Mono's pkgconfig folder to the PKG_CONFIG_PATH variable
export PKG_CONFIG_PATH="/Library/Frameworks/Mono.framework/Versions/2.4.3.1/lib/pkgconfig":$PKG_CONFIG_PATH

An easy way to open this file is open a new terminal window, then paste this command:

open ~/.bash_profile

I am curious how much testing went into these distributable versions of Mono before they were released. It seems like all the PowerPC versions of Mono have some major problem with them that prevents them from working.



来源:https://stackoverflow.com/questions/3420931/pkg-config-path-for-mono-on-mac

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