Linux glib需要pkg-config和pkg-config需要glib吗?

Pet*_*ter 24 linux pkg-config glib

我尝试安装udev.而udev在这期间给了我一个错误./configure

--exists: command not found configure: error:
pkg-config and "glib-2.0 >= 2.16" not found, please set GLIB_CFLAGS and GLIB_LIBS
to the correct values or pass --with-internal-glib to configure 
Run Code Online (Sandbox Code Playgroud)

好的,缺少pkg-config和glib-2.0.

起初我尝试安装pkg-config.我收到了这条消息:

checking whether to list both direct and indirect dependencies... no
checking for Win32... no
checking if internal glib should be used... no
checking for pkg-config... no
./configure: line 13557: --exists: command not found
configure: error: pkg-config and "glib-2.0 >= 2.16" not found,
please set GLIB_CFLAGS and GLIB_LIBS to the correct values or 
pass --with-internal-glib to configure
Run Code Online (Sandbox Code Playgroud)

好吧,我解释说,那个滑稽的缺失.

下一步安装Glib.

我收到了这条消息:

configure: error: in `/root/glib-2.33.3':
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 LIBFFI_CFLAGS
and LIBFFI_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
Run Code Online (Sandbox Code Playgroud)

但我现在很困惑.他们需要彼此吗?我的错是什么?

use*_*136 28

正如您已经观察到的那样,pkg-config和glib之间确实存在循环依赖关系.为了打破它,pkg-config的源代码包含一个glib版本,足以编译它.这应该打破依赖循环.

尝试使用配置pkg-config --with-internal-glib.

  • @Peter 你试过用 `./configure --with-internal-glib` 编译 `udev` 吗? (2认同)

ypn*_*nos 8

它已包含在glib错误消息中:

或者,您可以设置环境变量LIBFFI_CFLAGS和LIBFFI_LIBS以避免需要调用pkg-config.有关更多详细信息,请参见pkg-config手册页.

Glib构建脚本使用pkg-config来查找libffi.但您也可以通过设置环境变量手动提供信息.然后不需要调用pkg-config.Glib本身根本不需要pkg-config.

pkg-config人员提供了另一个问题的解决方案.再次,在错误消息的末尾:

请将GLIB_CFLAGS和GLIB_LIBS设置为正确的值或传递--with-internal-glib进行配置

在这种情况下,pkg-config本身包含了构建所需的所有内容,而系统上没有Glib.