简体   繁体   English

mac上的mono的pkg-config路径

[英]pkg-config path for mono on mac

I installed mono in Mac OS X. I was following these instructions on the mono website. 我在Mac OS X中安装了mono。我在mono网站上按照这些说明操作。 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. 但是,当我运行gmcs hello.cs -pkg:gtk-sharp-2.0 ,它告诉我我没有安装pkg-config。 So I installed pkg-config. 所以我安装了pkg-config。 Now I get this error because pkg-config doesn't know the mono package path: 现在我收到此错误,因为pkg-config不知道单声道包路径:

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? 单声道包路径在哪里以及我需要添加到.bash_profile以使Mono可以找到包?

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). 只需从控制台中找到它,使用which mono ,这将给你类似/ opt / local / bin / mono(如果你使用了macports)。 The PKG_CONFIG_PATH then corresponds to /opt/local/lib/pkgconfig/. 然后PKG_CONFIG_PATH对应于/ opt / local / lib / pkgconfig /。 You could also start find /opt/local/ -name "mono.pc" and see which path is revealed. 你也可以开始find /opt/local/ -name "mono.pc"并查看显示的路径。 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. 如果您完全不知道mono所在的位置(/ Developer / Library / Framework也可能是一个很好的猜测),请使用带有“/”的find命令作为路径。

When I was installing Mono on Mac OS 10.4, I saw the same error. 当我在Mac OS 10.4上安装Mono时,我看到了同样的错误。 I tried many different versions of Mono. 我试过很多不同版本的Mono。 Version 2.4.3.1 is what I settled on. 版本2.4.3.1就是我所确定的。 To fix the problem I added this to my ~/.bash_profile file: 为了解决这个问题,我将其添加到〜/ .bash_profile文件中:

# 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. 我很好奇Mono在发布之前对这些可分发的Mono版本进行了多少测试。 It seems like all the PowerPC versions of Mono have some major problem with them that prevents them from working. 似乎Mono的所有PowerPC版本都存在一些阻碍它们工作的主要问题。

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

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