赞
踩
(一)从源码编译安装GTK开发环境
为了便于获取源码,截止2015-05-26的gtk相关源码的存放于网盘中:
链接: http://pan.baidu.com/s/1gdITvWJ 密码: w2yd
1. 相关网址
Overview of GTK+ and its Libraries
2.下载和编译源码包1)下载源码: (版本:gtk+-3.16.3.tar.xz)
2)解压配置gtk源码$ tar xvfJ gtk+-3.16.3.tar.xz
$ cd gtk+-3.16.3/
$ ./configure --prefix=/opt/gtk
编译GTK需要依赖 glib、atk、pango、cairo、gdk-pixbuf等软件包。
3)编译配置glib及其依赖包zlib、libffi
采用默认configure
采用默认configure
c. 编译安装glib-2.44.1$ ./configure --prefix=/opt/glib-2.44.1
$make
$sudo make install
由于未采取默认配置,设置了自定义安装目录,因此需要声明变量PKG_CONFIG_PATH和LD_LIBRARY_PATH。
以glib为例,.pc文件位于 package/lib/pkgconfig目录下,则添加文件set_pkg_config_path_glib-2.0声明PKG_CONFIG_PATH变量和LD_LIBRAY_PATH$cat /opt/glib-2.44.1/set_pkg_config_path_glib-2.0
export PKG_CONFIG_PATH=/opt/glib-2.44.1/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/opt/glib-2.44.1/lib:$LD_LIBRAY_PATH
对其它的五个package(atk、cairo、pango、cairo-gobject、gdk-pixbuf-2.0)依次采用针对glib-2.0的编译安装和配置方法,解决GTK对多个库依赖问题。
d.编译安装gobject配置gobject,Error:未发现Python头文件( configure: error: Python headers not found)
Solution:$sudo apt-get install python-dev //没有安装python源代码,报找不到 Python.h的头文件错误
gdk-pixbuf依赖glib、libjpeg-turbo、libpng、libtiff,这几个包需要先编译安装。
Gdk Pixbuf Dependencies
RequiredGLib-2.44.1, libjpeg-turbo-1.4.0, libpng-1.6.17 and LibTIFF-.0.3
Recommended
Xorg Libraries (Many GTK+ applications require gdk-pixbuf-xlib).
Optional (Required if building GNOME)
gobject-introspection-1.44.0
Optional: JasPer-1.900.1 and GTK-Doc-1.22
eg.如果为安装libxi则配置时出现如下错误:
Solution:$ sudo apt-get install libxi-dev
configure信息:
g.编译安装pango
pango依赖cairo、glib、freetype,所以这些包需要先编译安装,或者使用$sudo apt-get install gcc g++ libfreetype6-dev libglib2.0-dev libcairo2-dev
$ ./configure --prefix=/opt/pango
configure: error: *** Could not enable any backends.
*** Must have at least one backend to build Pango.
过程中可能还会依赖bzip2,需要补充编译安装。
编译freetype出错:
$sudo make
$sudo make install
安装成功:
Error
Couldn't find include 'GdkPixbuf-2.0.gir' (search path: ['../gdk', '/usr/share/gnome/gir-1.0', '/usr/local/share/gir-1.0', '/usr/share/gir-1.0', '/usr/local/share/gir-1.0', '/usr/share/gir-1.0', '/usr/local/share/gir-1.0'])Solution:
configure时添加参数 --enable-introspection=no(默认为yes)
测试是否安装成功--运行demo程序:~/src/gtk+-3.16.3/demos/gtk-demo$ ./gtk3-demo
参考链接:
There are the depandency problem and the library I install to solve the problem:glib-2.40.0
problemconfigure: error: * Working zlib library and headers not found *
solve: sudo apt-get install ruby sudo apt-get install zlib1g-dev
problemconfigure: error: Package requirements (libffi >= 3.0.0) were not met:
solve sudo apt-get install libffi-devgdk-pixbuf-2.30.8
problemconfigure: WARNING: *** TIFF loader will not be built (TIFF library not found)`
solve sudo apt-get install libtiff4-dev
problemconfigure: WARNING: * PNG loader will not be built (PNG library not found)*
configure: WARNING: * PNG loader will not be built (PNG header file not found) * ````
solve sudo apt-get install libpng-devgobject-introspection-1.40.0
problemconfigure: error: flex not found but required
solve sudo apt-get install flex
problemconfigure: error: bison not found but required
solve sudo apt-get install bison
problemconfigure: error: Python headers not found
solve sudo apt-get install python-devpango-1.36.5
problemconfigure: error: *** Could not enable any backends.
solve sudo apt-get install libcairo-dev sudo apt-get install libcairomm-1.0-devWhat's more, I also install HarfBuzz . I download the source file http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-0.9.22.tar.bz2and compile it.gtk+-3.12.2
problemconfigure: error: *** XInput2 extension not found. Check 'config.log' for more details.
solve sudo apt-get install libXi-dev
problemconfigure: error: Package requirements (atk atk-bridge-2.0) were not met:
No package 'atk-bridge-2.0' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.
Alternatively, you may set the environment variables ATK_CFLAGS and ATK_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.
solve sudo apt-get install libatk-bridge2.0-dev
problemCouldn't find include 'GdkPixbuf-2.0.gir' (search path: ['../gdk', '/usr/share/gnome/gir-1.0', '/usr/local/share/gir-1.0', '/usr/share/gir-1.0', '/usr/local/share/gir-1.0', '/usr/share/gir-1.0', '/usr/local/share/gir-1.0']) make[4]: * [Gdk-3.0.gir] Error 1 make[4]: Leaving directory /home/simowce/GTK/gtk+-3.12.2/gdk'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory/home/simowc
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。