首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Linux glib需要pkg-config,pkg-config需要glib?

Linux glib需要pkg-config,pkg-config需要glib?
EN

Stack Overflow用户
提问于 2012-09-04 19:51:26
回答 4查看 35.9K关注 1票数 26

我尝试安装udev。并且udev在./configure期间给了我一个错误

代码语言:javascript
复制
--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。我收到了这样的消息:

代码语言:javascript
复制
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。

我收到了这样的信息:

代码语言:javascript
复制
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.

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

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2012-09-04 20:29:08

正如您已经注意到的,pkg-config和glib之间确实存在循环依赖关系。为了打破它,pkg-config的source code包含了一个glib版本,足以编译它。这应该会打破依赖循环。

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

票数 33
EN

Stack Overflow用户

发布于 2012-09-04 20:27:19

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

配置或者,您可以设置环境变量LIBFFI_CFLAGS和LIBFFI_LIBS,以避免调用pkg-

。有关详细信息,请参阅pkg-config手册页。

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

这个问题的另一个解决方案由pkg-config人员提供。同样,在错误消息的末尾:

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

在这个场景中,pkg-config本身打包了构建所需的所有内容,而不需要在系统上安装Glib。

票数 8
EN

Stack Overflow用户

发布于 2014-05-06 17:38:14

代码语言:javascript
复制
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.
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12262925

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档