繁体   English   中英

OSX 上的“找不到 pkg-config 脚本”

[英]"pkg-config script could not be found" on OSX

我正在尝试在我的 Mac 上安装一些软件; 但是我一直收到同样的错误:

configure: error: The pkg-config script could not be found or is too old.  Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.

Alternatively, you may set the environment variables XMEDCON_GLIB_CFLAGS
and XMEDCON_GLIB_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See `config.log' for more details

我不太确定如何将 pkg-config 添加到 PATH 中。 我在网上看到(见链接)我应该添加以下内容:

显示如何引导 PATH 变量的链接

export PATH=$PATH:/opt/local/bin     # Fixed typo as mentioned in comment

这是我放置 pkg-config 的地方。 尽管每次尝试使用 ./configure 配置文件时,我仍然会不断收到错误消息。 任何帮助将不胜感激!

对于 Ubuntu/Debian 操作系统,

apt-get install -y pkg-config

对于 Redhat/Yum 操作系统,

yum install -y pkgconfig

对于 Archlinux 操作系统,

pacman -S pkgconf

对我来说,(OSX)问题是这样解决的:

brew install pkg-config

对我的问题的回答(经过几次谷歌搜索)揭示了以下内容:

$ curl https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.tar.gz -o pkgconfig.tgz
$ tar -zxf pkgconfig.tgz && cd pkg-config-0.29
$ ./configure && make install

来自以下链接: 上面显示的链接

感谢大家的评论,并为我对 linux/OSX 的无知感到抱歉!

这样做解决了我上面提到的问题。

如果你有这个错误:

configure: error: Either a previously installed pkg-config or "glib-2.0 >= 2.16" could not be found. Please set GLIB_CFLAGS and GLIB_LIBS to the correct values or pass --with-internal-glib to configure to use the bundled copy.

而不是执行此命令:

$ ./configure && make install

去做 :

./configure --with-internal-glib && make install

尝试

macOS 用户

不幸的是,pkg-config 默认情况下不随 OS X 一起提供。 这里有一些关于如何从源代码编译的注意事项。 它假定您已安装 Xcode。

  1. 下载并解压
curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz tar xfz pkg-config-0.28.tar.gz
  1. 配置和安装
cd pkg-config-0.28 setenv CC /usr/bin/cc (for tcsh) export CC=/usr/bin/cc (for bash)

2a) 如果你有超级用户权限

./configure --prefix=/usr/local CC=$CC --with-internal-glib make sudo make install

2b) 如果没有

./configure --prefix=$HOME/someplace/in/my/path CC=$CC --with-internal-glib make make install

来源: https ://opensource.ncsa.illinois.edu/confluence/display/DESDM/Installing+pkg-config+from+source+for+OSX

暂无
暂无

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

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