计划在Ubuntu Lucid Lynx x86机器上面安装GTK+
1)首先打开 http://www.gtk.org/download/linux.php
找到相关的 几个主要下载包
To build GTK+ 3.6, see the installation guide. For additional help, the FAQ is a good starting point.
GTK+ 3.6
GLib 2.34
Pango 1.32
Gdk-Pixbuf 2.26
ATK 2.6
Cairo
Glib 是一种通用的函数库。她提供了各种各样的语言特性,譬如说:各种数据类型,字符串函数,错误通知,消息队列和线程。
Pango 是一种函数库,用来实现国际化和本地化的功能。
GDK 是一种函数库,她为整个 GTK+图形库系统提供了一些底层的“图形实现”和“窗口实现”的方法。在 Linux 中 GDK 是位于 X 服务器和 GTK+函数库之间的。在最近的 GTK+发行版本中,越来越多的功能性函数,都交给了 Cairo 函数库来处理。
GdkPixbuf 函数库是一种函数库工具包用于加载图像和维护图像“缓存”的(pixel buffer).
ATK是一种平易近人的工具函数包,她提供了快捷键服务为肢体有缺陷的人使用电脑提供了便利。
Cairo 是一种函数库用于制作二维图像。从 GTK+2.8 版本以后,Cairo 就正式成为 GTK+系统中的一员了。
Gnome and XFce 桌面环境系统都是用 GTK+来编程实现的. SWT and wxWidgets 是种很著名的编程框架,也是用 GTK+来编程实现的。最杰出的 GTK+软件的代表是 Firefox (火狐浏览器)和 Inkscape。
2)GTK+ 依赖于 GLib, 因此需要先安装GLib
GLib ./configure 命令提示确实缺少 libffi。 sudo apt-get install libffi 无果。后来用新立得找到并尝试安装 libffi-dev 成功。
./configure
make
sudo make install
编译并安装到缺省目录。根据GLib INSTALL文件介绍,
3)编译并安装pango-1.32.6
悲催的发现这个库依赖于Cario库。还是先安装Cario把。
checking for CAIRO... yes
checking which cairo font backends could be used... none
configure: Disabling cairo support
configure: error: *** Could not enable any backends.
*** Must have at least one backend to build Pango.
新立得安装如下Cario 库 (当前机器上面实际缺少的)
libcariomm-1.0-dev
libcairo-directfb2
libcairo-directfb2-dev
libcairo2-dbg
安装后还是./configure 失败。
查询网络资料后,如果仅仅修改configure文件
have_cairo=true
have_cairo_png=true
have_cairo_freetype=true
将会导致./configure 通过,但是编译失败。
pango-ot-buffer.c:181: error: 'PangoOTBuffer' has no member named 'buffer'
pango-ot-buffer.c:182: warning: implicit declaration of function 'hb_buffer_reverse'
pango-ot-buffer.c:182: error: 'PangoOTBuffer' has no member named 'buffer'
pango-ot-buffer.c:187: warning: implicit declaration of function 'hb_buffer_get_glyph_positions'
pango-ot-buffer.c:205: error: 'PangoOTBuffer' has no member named 'buffer'
pango-ot-buffer.c:206: error: 'PangoOTBuffer' has no member named 'buffer'
make[4]: *** [pango-ot-buffer.lo] Error 1
make[4]: Leaving directory `/home/zyang/Downloads/pango-1.32.6/pango'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/zyang/Downloads/pango-1.32.6/pango'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/zyang/Downloads/pango-1.32.6/pango'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/zyang/Downloads/pango-1.32.6'
make: *** [all] Error 2
另有说法是需要Ubuntu GNOME 安装完整的X Window 软件开发包。根据新立得查找如下库:
sudo apt-get install gnome-core-devel
sudo apt-get install libglib2.0-doc libgtk2.0-doc
sudo apt-get install devhelp
sudo apt-get install glade-gnome glade-common glade-doc
sudo apt-get install bison
sudo apt-get install flex
单独安装库文件完成后,都不能进行 pango 的./configure。
查阅 gtk+ 的官方文档,发现需要 X org的支持。但是当前系统直接安装 X 库一直有 libxv-dev的依赖关系问题。
似乎 Lucid Lynx 安装的是 libxv-ubuntu-xxx版本并且无法替换。
另外,pango还依赖GLib。
4) 编译并安装 atk-2.6.0
atk-2.6.0 库依赖于 GLib库。 因此必须要前面安装 GLib库成功。
tar xf atk-2.6.0.tar.xz
./configure
make
sudo make install
根据 atk INSTALL文件介绍,还支持如下编译命令:
make uninstall // 删除atk安装包
make clean // 删除编译产生的文件,但是不保证全部删除成功
make distclean // 删除./configure产生文件,为另一体系结构的机器编译作准备
5)安装并编译 gdk-pixbuf-2.26.5
tar xf gdk-pixbuf-2.26.5
./configure
make
sudo make install
6) 查阅了若干资料,在当前的 Lucid Lynx系统上库的依赖关系混乱了,并且找不到好的软件源支持。
决定直接升级到 12.04 LTS 版本。
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get dselect-upgrade
升级完成后, 编译一个简单的GTK+ 程序,报如下错误。
/usr/bin/ld: warning: libffi.so.5, needed by /usr/local/lib/libatk-1.0.so, not found (try using -rpath or -rpath-link)
/usr/local/lib/libgobject-2.0.so: undefined reference to `ffi_type_pointer'
/usr/local/lib/libgobject-2.0.so: undefined reference to `ffi_type_float'
/usr/local/lib/libgobject-2.0.so: undefined reference to `ffi_type_void'
/usr/local/lib/libgobject-2.0.so: undefined reference to `ffi_type_sint64'
/usr/local/lib/libgobject-2.0.so: undefined reference to `ffi_prep_cif'
/usr/local/lib/libgobject-2.0.so: undefined reference to `ffi_type_uint32'
/usr/local/lib/libgobject-2.0.so: undefined reference to `ffi_type_double'
/usr/local/lib/libgobject-2.0.so: undefined reference to `ffi_call'
/usr/local/lib/libgobject-2.0.so: undefined reference to `ffi_type_sint32'
/usr/local/lib/libgobject-2.0.so: undefined reference to `ffi_type_uint64'
collect2: ld returned 1 exit status
简单的做个软链接后,问题解决。
zyang@zyang-laptop-Lucid:/usr/lib/i386-linux-gnu$ ln -s libffi.so libffi.so.5
7)至此,终于在 Ubuntu 12.04 LTS 上建立了一个可工作的 GTK+ 2.0 环境。