您的位置:首页 > 运维架构 > Linux

【源码包编译】CentOS-5.7安装GTK+(未完)

2011-11-26 08:45 1596 查看
----------codeblocks依赖的:

wx-config -->  wxWidgets

----------wxWidgets依赖的:

GTK+ - version >= 2.4.0

----------GTK+

查询是否已经安装:

rpm -q gtk+

rpm -qa | grep gtk

没有安装gtk+

----------------------------------------------gtk+的安装-------------------------------------------------

官方手册:《Compiling the GTK+ libraries》http://developer.gnome.org/gtk3/stable/gtk-building.html

所有包都选最新版本,这里可以下载大多数包:http://ftp.gnome.org/pub/gnome/sources/

gtk+版本:gtk+-3.0.0

export LD_LIBRARY_PATH=/opt/gtk+/lib:$LD_LIBRARY_PATH

export PKG_CONFIG_PATH=/opt/gtk+/lib/pkgconfig:$PKG_CONFIG_PATH

./configure --prefix=/opt/gtk+

configure: error: Package requirements (glib-2.0 >= 2.28.0    atk >= 1.30    pango >= 1.20    cairo >= 1.10.0    cairo-gobject >= 1.10.0    gdk-pixbuf-2.0 >= 2.22.0) were not met:

No package 'glib-2.0' found

No package 'atk' found

No package 'pango' found

No package 'cairo' found

No package 'cairo-gobject' found

No package 'gdk-pixbuf-2.0' found

发现系统中已经安装的软件包所有版本都低于所要求的版本

----------pkg-config(已安装)

查询是否已经安装:

rpm -q pkgconfig

rpm -q pkg-config

pkgconfig-0.21-2.el5

----------zlib(已安装)

查看是否已经安装:

rpm -q zlib

zlib-1.2.3-4.el5

----------libpng(已安装)

查看是否已经安装:

rpm -q libpng

libpng-1.2.10-7.1.el5_7.5

----------cairo(已安装)

查询是否已经安装:

rpm -q cairo

cairo-1.2.4-5.el5

----------pango(已安装)

查询是否已经安装:

rpm -q pango

pango-1.14.9-8.el5.centos.3

---------------------------------------全部用源码装最新版本--------------------------------------------------

说明:

1、每一步执行完后echo $?,看是否为0

2、

export LD_LIBRARY_PATH=/opt/gtk+/lib:$LD_LIBRARY_PATH

export PKG_CONFIG_PATH=/opt/gtk+/lib/pkgconfig:$PKG_CONFIG_PATH

仅当前shell有效

----------zlib-1.2.5

./configure --prefix=/opt/gtk+

make && make install

----------libffi-3.0.10

./configure --prefix=/opt/gtk+

make && make install

----------Python-2.5.6

./configure --prefix=/opt/gtk+

make && make install

生成符号链接:

ln -s /opt/gtk+/bin/python2.5 /usr/bin/python2.5

--------- glib-2.31.0

./configure --prefix=/opt/gtk+

configure成功!

make错误1:

configure: error: *** Working zlib library and headers not found ***

make错误2:

configure: error: Package requirements (libffi >= 3.0.0) were not met:

No package 'libffi' found

make错误3:

/usr/bin/env: python2.5: 没有那个文件或目录

解决了make的第3个错误之后,成功安装!

---make

---make install

----------atk-2.2.0

./configure --prefix=/opt/gtk+

configure成功!

make错误:

/bin/sh: glib-genmarshal: command not found

解决:export PATH=/opt/gtk+/bin:$PATH,因为glib-genmarshal位于/opt/gtk+/bin

---make

---make install

----------libpng-1.5.6]

./configure --prefix=/opt/gtk+

configure: error: zlib not installed

解决:export LDFLAGS=-L/opt/gtk+/lib

echo $?

成功!

make一直失败!

make prefix=/opt/gtk+ ZLIBINC=/opt/gtk+/include ZLIBLIB=/opt/gtk+/lib -f scripts/makefile.linux

查看:echo $?

make prefix=/opt/gtk+ install -f scripts/makefile.linux

查看:echo $?

终于成功!

参考博文:《libpng 1.5.6 发布,PNG图片处理》http://www.oschina.net/news/22817/libpng-156-released

----------pixman-0.24.0

./configure --prefix=/opt/gtk+

成功!

---make && make install

----------cairo-1.10.2

./configure --prefix=/opt/gtk+

configure错误1:

configure: WARNING: Could not find libpng in the pkg-config search path

checking whether cairo's PNG functions feature could be enabled... no

configure: error: recommended PNG functions feature could not be enabled

解决:1、保证libpng已安装;2、lib搜索路径中含/opt/gtk+/lib

configure错误2:

checking whether cairo's PostScript surface backend feature could be enabled... no (requires zlib http://www.gzip.org/zlib/)
configure: error: recommended PostScript surface backend feature could not be enabled

解决:./configure --prefix=/opt/gtk+ --enable-ps=no

configure错误3:

checking whether cairo's PDF surface backend feature could be enabled... no (requires zlib http://www.gzip.org/zlib/)
configure: error: recommended PDF surface backend feature could not be enabled

解决:./configure --prefix=/opt/gtk+ --enable-ps=no --enable-pdf=no

推测:zlib出了问题

configure错误4:

checking whether cairo's image surface backend feature could be enabled... no (requires pixman-1 >= 0.18.4 http://cairographics.org/releases/)
configure: error: mandatory image surface backend feature could not be enabled

解决:cairo-1.10.2

configure错误5:

checking for cairo's cairo-script-interpreter feature...

checking whether cairo's cairo-script-interpreter feature could be enabled... no (requires zlib)

configure: error: recommended cairo-script-interpreter feature could not be enabled

说明还是zlib的问题

继续来治标不治本的方法——关闭:./configure --prefix=/opt/gtk+ --enable-ps=no --enable-pdf=no --enable-interpreter=no

注:上面这些选项都是通过./configure --help来的

---make && make install

----------freetype-2.4.8

./configure --prefix=/opt/gtk+

成功!

---make && make install

----------fontconfig-2.8.0

./configure --prefix=/opt/gtk+

错误。。。。。。。。。。。。。。。。。。。。。

---export PATH=/opt/gtk+/bin:$PATH

----------pango-1.29.1

./configure --prefix=/opt/gtk+

configure: Disabling cairo support

configure: error: *** Could not enable any of FreeType, X11, Cairo, or Win32 backends.

*** Must have at least one backend to build Pango.

错误。。。。。。。。。。。。。。。。。。。。。

----------推荐博文

《怎么源码安装 PKG_CONFIG_PATH设置 》http://kangzai.blog.51cto.com/280080/84298

《Centos搭建GTK+Codeblock完整版》http://yuliang.blog.51cto.com/626833/276195
关于/etc/ld.so.conf,ldconfig,PKG_CONFIG_PATH的一篇文章:http://hi.baidu.com/%B6%FE%C3%AB/blog/item/94ac9152b28ef20c0df3e36e.html

----------疑问

1、configure时的选项不同,是不是得到的动态链接库不同?若是这样,当需要用到这些选型对应的功能是,是不是一定要重新编译?

如./configure --prefix=/opt/gtk+ --enable-ps=no --enable-pdf=no --enable-interpreter=no
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息