找不到pkg-config错误

Shi*_*bii 45 linux macos

我正在尝试在我的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
Run Code Online (Sandbox Code Playgroud)

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

显示如何定向PATH变量的链接

export PATH=$PATH:/opt/local/bin     # Fixed typo as mentioned in comment
Run Code Online (Sandbox Code Playgroud)

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

小智 67

对于Ubuntu/Debian OS,

apt-get install -y pkg-config

对于Redhat/Yum OS,

yum install -y pkgconfig

  • 请注意,有人问过有关osx的问题。 (3认同)
  • 谷歌仍然可以在ubuntu上使用浏览器,它让我来到这里.并且一个包管理器在一个不安全的连接上运行任意代码"curl",就像接受的答案所暗示的那样. (2认同)
  • 当我在我的 Ubuntu 上执行命令时,它需要 root 权限,即-`sudo apt-get install -y pkg-config`(认为值得一提)。 (2认同)

Shi*_*bii 28

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

$ 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
Run Code Online (Sandbox Code Playgroud)

从以下链接:上面显示的链接

感谢大家的评论,对不起我的linux/OSX无知!

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

  • 在Ubuntu 12.04上运行这些命令会出现错误:`configure:error:找不到以前安装的pkg-config或"glib-2.0> = 2.16".请将GLIB_CFLAGS和GLIB_LIBS设置为正确的值,或者通过--with-internal-glib配置为使用捆绑的副本. (7认同)
  • 对于ubuntu,您可以使用`sudo apt-get install pkg-config`进行安装 (7认同)

Mig*_*azq 25

对我来说,(OSX)解决了这个问题:

brew install pkg-config
Run Code Online (Sandbox Code Playgroud)


小智 9

如果你有这个错误:

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.
Run Code Online (Sandbox Code Playgroud)

而不是这个命令:

$ ./configure && make install
Run Code Online (Sandbox Code Playgroud)

去做 :

./configure --with-internal-glib && make install
Run Code Online (Sandbox Code Playgroud)

  • 嗨,我有这个错误,而我做安装"找不到架构x86_64的符号" (5认同)