繁体   English   中英

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

[英]Linux glib needs pkg-config and pkg-config needs 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 

好的,缺少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

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

下一步安装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.

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

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

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

它已包含在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。

export GLIB_CFLAGS="$(pkg-config --cflags glib-2.0)" 
export GLIB_LIBS="$(pkg-config --libs glib-2.0)"
printf '# In the case of a RHEL6.5\n\tGLIB_CFLAGS=%s\n\tGLIB_LIBS=%s\n' "$GLIB_CFLAGS" "$GLIB_LIBS"
# In the case of a RHEL6.5
        GLIB_CFLAGS=-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
        GLIB_LIBS=-lglib-2.0

# _now_ it is a no-brainer.

libudev现在是systemd的一部分,它不依赖于glib。

大多数Linux发行版都为pkg-config,libudev和glib提供二进制文件。 它们可能已经安装,但如果没有,您可以使用包管理器来获取它们。

如果你确实需要自己编译这些东西,可以考虑使用pkgconf ,这是一个不使用glib的pkg-config的轻量级实现。

暂无
暂无

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

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