1 概述 2 准备工作核心包有6个,分别如下:glib-2.12.13,atk-1.19.3,pango-1.16.4,DirectFB-1.1.0,cairo-1.4.10,gtk+-2.10.14打开他们的README和INSTALL文件查看他们的依赖包,分别如下:glib-2.12.13      依赖包: 无atk-1.19.3        依赖包:glib-2.12.13pango-1.16.4      依赖包:glib-2.12.13,fontconfig-2.4.2 ,cairo-1.4.10DirectFB-1.1.0    依赖包:freetype-2.3.5,,jpegsrc.v6b,libpng-1.2.19,zlib-1.2.3,pkg-config-0.20(建议安装)                                        expat-2.0.1,libxml2-2.6.29cairo-1.4.10      依赖包:freetype-2.3.5,zlib-1.2.3。注:这个和前端后端有关,最好自 己看一下README文件gtk+-2.10.14      依赖包:atk-1.9.1,cairo-1.2.6,jpegsrc.v6b,libpng-1.2.8,                                                 pkg-config-0.20,tiff-3.7.4。注:这个在                        ftp://ftp.gtk.org/pub/gtk/v2.10/dependencies/有说明。宗上所述,需要依赖包如下:fontconfig-2.4.2,freetype-2.3.5,,jpegsrc.v6b,libpng-1.2.19,zlib-1.2.3,pkg-config-0.20,tiff-3.7.4,expat-2.0.13 开始逐个编译安装export PATH=/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/bin:$PATHexport PREFIX=/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/localexport PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig4 glib编译    4.1 编译脚本cd /home/qiuzhongming/glib-2.21.6/glib-2.21.6#PKG_CONFIG_PATH=/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib/pkgconfigCC="/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/bin/i686-cm-linux-gcc"CPPFLAGS="-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/include"CFLAGS="-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/include" LDFLAGS="-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib"cat > config.cache glib_cv_stack_grows=noglib_cv_has__inline=yesglib_cv_working_bcopy=noglib_cv_uscore=noac_cv_func_posix_getpwuid_r=yesac_cv_func_posix_getgrgid_r=yesEOF./configure --host=i686-linux --prefix=/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local --cache-file=config.cachemake && make install    4.1 错误及解决没有遇到错误,一次成功编译出来。5 atk编译    5.1 编译脚本    5.1 错误及解决6 pixman 编译    6.1 编译脚本cd /home/qiuzhongming/pixman-0.16.0/pixman-0.16.0PKG_CONFIG_PATH=/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib/pkgconfigCC="/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/bin/i686-cm-linux-gcc-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/lib-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/lib-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib -I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/include-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/include-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/include" ./configure --host=i686-linux --prefix=/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local --disable-gtk --disable-staticmake && make install    6.2 错误及解决遇到的问题:  (1) 提示/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/include目录下的config.h文件中,在FILE *的*号前少)符号。        原因是,FILE类型无法识别,FILE的定义在stdio.h,把该头文件加入到config.h中就解决了。  (2) 提示pixman-private.h中输出错误如下:#  error config.h must be included before pixman-private.h查看pixman-private.h文件发现开始的地方有如下定义:#ifndef PACKAGE#  error config.h must be included before pixman-private.h#endif解决办法是,在pixman-access.c的包含头文件config.h,在#ifdef HAVE_CONFIG_H#include #endif后面加入一行:#include 问题解决。上面的问题解决了,编译正常通过。7 fontconfig编译    7.1 编译脚本cd /home/qiuzhongming/fontconfig-2.7.3/fontconfig-2.7.3PKG_CONFIG_PATH=/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib/pkgconfigFC_DEFAULT_FONTS='/usr/share/fonts'CC="/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/bin/i686-cm-linux-gcc-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/lib-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/lib-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib -I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/include-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/include-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/include" ./configure--host=i686-linux --with-arch=i686 --prefix=$PREFIX--with-freetype-config=/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/bin/freetype-configmake && make install    7.2 错误及解决 报错如下,如果不添加上面编译脚本红色一行,编译的时候总是会报错FC_DEFAULT_FONTS未定义。--with-freetype-config=/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/bin/freetype-config 是之前已经安装好了的freetype conffig文件路径,要家进来。8 cairo编译    8.1 编译脚本cd /home/qiuzhongming/cairo-1.8.8/cairo-1.8.8#PKG_CONFIG_PATH=/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib/pkgconfigCC="/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/bin/i686-cm-linux-gcc-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/lib-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/lib-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib -I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/include-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/include-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/include" #./configure--prefix=/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local--without-x --enable-directfb=yes --enable-xlib=no --host=i686-linux--enable-ps=yes --enable-svg=yes --enable-pdf=yes./configure--prefix=/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local--without-x --disable-xlib --disable-xlib-xrender --enable-directfb--enable-freetype --disable-win32 --enable-pdf --enable-ps--disable-svg --enable-pngmake && make install    8.2 错误及解决(1)警告:checking for cairo's PDF surface backend feature...checking whether cairo's PDF surface backend feature could be enabled... yeschecking for POPPLER... nonoconfigure: WARNING: PDF backend will not be tested since poppler >= 0.9.2 is not available 这个警告会导致其他的编译错误,所以要先升级poppler到最新版本,所以回到上述错误:(1) 找不到fontconfig.h文件, In file included from cairo-ft-private.h:40,                 from cairo-type1-subset.c:54:cairo-ft.h:46:35: error: fontconfig/fontconfig.h: No such file or directory估计是没有安装fontconfig包吧,所以先安装fontconfig再说。(2) 找不到EGL/egl.h文件经过查找后发现该文件在编译环境的/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/include路径下有,但是不知道为什么编译的时候会找不到该文件,该路径是已经加入到了CC项里的。先解决再说,直接把EGL文件夹拷贝到cairo文件夹下,还有KHR文件夹也一起拷贝过来。编译和安装都能顺利了。cairo编译和安装成功之后,再回头重新编译安装poppler吧。9 poppler编译    9.1 编译脚本    9.2 错误及解决编译错误:(1)poppler-action.cc: In function ‘GType poppler_dest_get_type()’:poppler-action.cc:22: 错误:‘g_once_init_enter’ 在此作用域中尚未声明poppler-action.cc:22: 错误:‘g_once_init_leave’ 在此作用域中尚未声明poppler-action.cc: In function ‘GType poppler_action_get_type()’:poppler-action.cc:65: 错误:‘g_once_init_enter’ 在此作用域中尚未声明poppler-action.cc:65: 错误:‘g_once_init_leave’ 在此作用域中尚未声明google了一下,有网友解答如下:Looks to me like GLib is out of date. Perhaps you have a newer version of GTK+ but older version of GLib.The functions that are missing are new as of GLib 2.14. Try this command:pkg-config --modversion glib-2.0You should have 2.14 or greater.我检查了一下已经安装的glib版本,[root@localhost lib]# pkg-config --modversion glib-2.02.12.11有可能是glib版本太旧了。安装最新的版本glib-2.21.6之后,该问题解决。(2) (1)的问题解决之后重新编译,/home/qiuzhongming/poppler/poppler-0.12.0/glib路径下出现错误提示如下:poppler-document.cc: In function ‘void poppler_document_finalize(GObject*)’:poppler-document.cc:339: 错误:‘struct _PopplerDocument’ 没有名为 ‘output_dev’ 的成员    分析:个恩你嗯 (2) #编译的时候报错如下,#libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I.. -I../goo-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/include/cairo-I/tmp/x86_gst/include/libxml2-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/include/freetype2-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/include-Wall -Wno-write-strings -Woverloaded-virtual -g -O2 -pthread -MTABWOutputDev.lo -MD -MP -MF .deps/ABWOutputDev.Tpo -c ABWOutputDev.cc -fPIC -DPIC -o .libs/ABWOutputDev.o#在包含自 ABWOutputDev.cc:31 的文件中:#ABWOutputDev.h:25:27: 错误:libxml/parser.h:没有那个文件或目录分析:编译找不到/libxml/parser.h,该文件所在的目录为:/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/include/libxml2 把该路径加入到CC和CPPFLAGS中之后,还是会报一样的错误,可以看出该路径还是没有成功的加入到编译中来。先解决,把libxml文件夹拷贝到/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/include10 pango编译安装    10.1 编译脚本cd /home/qiuzhongming/pango/pango-1.25.6CC="/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/bin/i686-cm-linux-gcc-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/lib-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/lib-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib -I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/include-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/include-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/include" CPPFLAGS="-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/include"CFLAGS="-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/include" LDFLAGS="-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib"./configure --host=i686-linux --without-x --prefix=$PREFIXmake && make install    10.2 错误及解决一次搞定。11 GTK+编译安装    11.1 编译脚本cd /home/qiuzhongming/gtk+2.16.6/gtk+-2.16.6CC="/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/bin/i686-cm-linux-gcc-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/lib-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/lib-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib -I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/include-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/include-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/include" CPPFLAGS="-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/include"CFLAGS="-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/include" LDFLAGS="-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib"./configure --host=i686-linux --prefix=$PREFIX --with-gdktarget=directfb --without-x --without-libjasper#--without-libjasper for JPEG2000,because we have not install it,so without it.make && make install    11.2 错误及解决错误:(1) Glib冲突,不知道为什么虚拟机中的Linux上的Glib会被交叉编译检测到。检测Glib的版本是否足够高的时候,提示交叉编译环境中的Glib的版本符合要求,但是发现虚拟机中的Glib版本太低,报错。解决的办法是按照提示,把LB_LIBRARY_PATH设置为交叉编译下的Glib的路径,如下:export LD_LIBRARY_PATH=/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib就解决了这个问题。(2) 解决(1)之后重新编译,报错如下:包含自 gdkdirectfb.h:41 的文件中,                 从 gdkcolor-directfb.c:43:/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/include/directfb/directfb.h:5679:21: 错误:EGL/egl.h:没有那个文件或目录分析:找不到EGL/egl.h,和之前编译cairo的时候问题一样。暂时解决的方法是:直接把EGL文件夹拷贝到-I/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/include/cairo文件夹下,还有KHR文件夹也一起拷贝过来。其实拷贝到控制台上显示的GCC后面的-I中任何一个文件夹下都可以,只是因为前面也是在编译cairo的时候出现该问题,所以就拷贝到cairo目录下。(3) 解决上述(1)(2)问题之后重新编译,编译的时候报错如下:/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/lib/librt.so: undefined reference to `__fortify_fail@GLIBC_PRIVATE'collect2: ld returned 1 exit statusmake: *** [pixbuf-threads] 错误 1      原因分析:librt.so依赖的某个库中的__fortify_fail接口未定义,原因可能是所依赖的这个库找不到,或者是库存在但是该接口未定义。通过命令ldd -r -v librt.so得到如下信息:symbol __fortify_fail, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference  (./librt-2.7.so)        linux-gate.so.1 =>  (0x0039c000)        libc.so.6 => /lib/libc.so.6 (0x0012a000)        libpthread.so.0 => /lib/libpthread.so.0 (0x0063a000)        /lib/ld-linux.so.2 (0x004b4000)        Version information:        ./librt-2.7.so:                libpthread.so.0 (GLIBC_2.1) => /lib/libpthread.so.0                libpthread.so.0 (GLIBC_2.2) => /lib/libpthread.so.0                libpthread.so.0 (GLIBC_PRIVATE) => /lib/libpthread.so.0                libpthread.so.0 (GLIBC_2.0) => /lib/libpthread.so.0                libc.so.6 (GLIBC_2.1.3) => /lib/libc.so.6                libc.so.6 (GLIBC_2.3.2) => /lib/libc.so.6                libc.so.6 (GLIBC_2.1) => /lib/libc.so.6                libc.so.6 (GLIBC_2.2) => /lib/libc.so.6                libc.so.6 (GLIBC_PRIVATE) => /lib/libc.so.6                libc.so.6 (GLIBC_2.0) => /lib/libc.so.6        /lib/libc.so.6:                ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2                ld-linux.so.2 (GLIBC_2.3) => /lib/ld-linux.so.2                ld-linux.so.2 (GLIBC_2.1) => /lib/ld-linux.so.2        /lib/libpthread.so.0:                ld-linux.so.2 (GLIBC_2.3) => /lib/ld-linux.so.2                ld-linux.so.2 (GLIBC_2.1) => /lib/ld-linux.so.2                ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2                libc.so.6 (GLIBC_2.1.3) => /lib/libc.so.6                libc.so.6 (GLIBC_2.1) => /lib/libc.so.6                libc.so.6 (GLIBC_2.3.2) => /lib/libc.so.6                libc.so.6 (GLIBC_2.2) => /lib/libc.so.6                libc.so.6 (GLIBC_PRIVATE) => /lib/libc.so.6                libc.so.6 (GLIBC_2.0) => /lib/libc.so.6上面红色部分,说明可能不存在libc.so.6 。而在/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib目录下确实没有该库。        解决方法:虽然在/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib下面没有libc.so,但是在/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/lib下面可以找到该库。可以考虑/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib下建立一个连接把该库链接过来。      cd /usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib      ln ../../../lib/libc-2.7.so       或者更彻底的解决,把libc-2.7.so拷贝到/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib做好之后重新编译,该问题解决。由于gtk+编译采用的是config方式自动生成相应makefile,所以在./configure 运行之后,在makefile中在GLIB_LIBS定义中加入libc-2.7.so,加入之后的GLIB_LIBS定义如下:GLIB_LIBS= -pthread-L/usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib-lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 /usr/local/Canmore/IntelCE-1.1094/i686-linux-elf/usr/local/lib/libc-2.7.so修改好makefile之后再运行make 和 make install就可以顺利的编译和安装好gtk+了。
10-25 07:02