从源代码编译gtk

时间:2012-11-24 17:44:25

标签: c build compilation gtk gtk3

我要编译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我真的不知道该怎么做。

1 个答案:

答案 0 :(得分:1)

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方法,并尝试删除您仍想使用的其他依赖项。