我正尝试编译 gtk+-3.2.0
但我从 ./configure
收到一条错误消息:
checking for GLIB - version >= 2.29.14...
*** 'pkg-config --modversion glib-2.0' returned 2.32.4, but GLIB (2.34.0)
*** was found! If pkg-config was correct, then it is best
*** to remove the old version of GLib. You may also be able to fix the error
*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing
*** /etc/ld.so.conf. Make sure you have run ldconfig if that is
*** required on your system.
*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH
*** to point to the correct configuration files
no
configure: error:
*** GLIB 2.29.14 or better is required. The latest version of
*** GLIB is always available from ftp://ftp.gtk.org/pub/gtk/.
我确实有 GLIB 2.34.0(我也是从源代码编译的)但我不知道如何让 gtk 知道这个库。我已将 PKG_CONFIG_PATH 更改为指向新 glib 安装所在的路径,并在 ldconfig
之后但没有区别。通过修改/etc/ld.so.conf 我真的不知道该怎么做。
最佳答案
PKG_CONFIG_PATH
应包含您要使用的 GLib 版本的 .pc 文件所在目录的路径。
否则,使用您的包管理器检测哪个包安装了您不想使用的 .pc 文件。并删除该包。例如,在基于 rpm 的发行版上,运行:
strace -eopen pkg-config --modversion glib-2.0 2>&1 | grep "\.pc"
它将返回 pkg-config 检测到的 .pc 文件所在的位置。
open("/usr/lib64/pkgconfig/glib-2.0.pc", O_RDONLY) = 3
然后检测这个文件属于哪个包:
rpm -qf /usr/lib64/pkgconfig/glib-2.0.pc
这是我的 Mageia 2 系统上的结果:
lib64glib2.0-devel-2.32.4-1.1.mga2
删除此包将删除阻碍的 .pc。但是,您应该更喜欢 PKG_CONFIG_PATH
方法,因为在删除包的情况下也会尝试删除您仍想使用的其他依赖项。
关于从源代码编译 gtk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13543823/