最近在tcc8900(arm11)平台上移植了一下webkit浏览器(gtk),花了近两天时间,大部分时间都给编译各种依赖的库给耗费了,特记录一下,以备后来者参考。
atk-1.30.0 fontconfig-2.8.0 gtk+-2.16.0 libsoup-2.30.2 pango-1.28.0 webkit-1.3.3 zlib-1.2.3 DirectFB-1.4.5 freetype-2.3.9 jpeg-6b
libxml2-2.7.7 cairo-1.8.10 enchant-1.6.0 glib-2.24.0 icu4c-3_8_1
libpng-1.2.39 pixman-0.18.2
1.首先设置下环境变量,并且考虑好在开发板上的存储路径
比如我用sd卡存储测试,我就把编译的程序和库安装到/mnt/SD目录,然后把文件复制到sd,再把sd卡挂载到板子的/mnt/SD目录,这样不用来回变换运行时需要设置的环境变量
在台式机上操作:
#ln -s /home/qwdu/8900/webkit/deplib /mnt/SD
#cd /mnt/SD
#vi setenv.sh
#!/bin/sh
export CC="/opt/armv6/codesourcery/bin/arm-linux-gcc"
export CXX="/opt/armv6/codesourcery/bin/arm-linux-g++"
export RANLIB="/opt/armv6/codesourcery/bin/arm-linux-ranlib"
export AR="/opt/armv6/codesourcery/bin/arm-linux-ar"
export LD="/opt/armv6/codesourcery/bin/arm-linux-ld"
export STRIP="/opt/armv6/codesourcery/bin/arm-linux-strip"
export PREFIX=`pwd`
export PATH=$PATH:$PREFIX/bin
export C_INCLUDE_PATH=$PREFIX/include
export LD_LIBRARY_PATH=$PREFIX/lib
export PKG_CONFIG_PATH=$LD_LIBRARY_PATH/pkgconfig
export LDFLAGS=-L$LD_LIBRARY_PATH
export CFLAGS=-I$PREFIX/include
#source ./setenv.sh
2.开始编译
jpeg-6b./configure --build=i686-pc-linux --host=arm-linux --target=arm-linux --enable-static --enable-shared --prefix=$PREFIX
make;make install
libpng-1.2.39
./configure --build=i686-pc-linux --host=arm-linux --target=arm-linux --enable-static --enable-shared --prefix=$PREFIX
make;make install
freetype-2.3.9
./configure --build=i686-pc-linux --host=arm-linux --target=arm-linux --enable-static --enable-shared --prefix=$PREFIX
make;make install
pixman-0.18.2
./configure --build=i686-pc-linux --host=arm-linux --target=arm-linux --enable-shared --prefix=$PREFIX
make;make install
enchant-1.6.0
./configure --build=i686-pc-linux --host=arm-linux --target=arm-linux --enable-shared --prefix=$PREFIX
make;make install
DirectFB-1.4.5
./configure -host=arm-linux --prefix=$PREFIX --with-gfxdrivers=none --enable-sdl=no --disable-x11 "CFLAGS=-I$PREFIX/include" "LIBS=-L$PREFIX/lib -lz -ljpeg"
make;make install
libxml2-2.7.7
./configure --build=i686-pc-linux --host=arm-linux --target=arm-linux --enable-shared --prefix=$PREFIX
make;make install
fontconfig-2.8.0
./configure --build=i686-pc-linux --host=arm-linux --target=arm-linux --enable-shared --prefix=$PREFIX --with-freetype-config=$PREFIX/bin/freetype-config --enable-libxml2 --with-arch=arm
make;make install
icu4c-3_8_1
这个比较特殊,先编译一个pc版本,然后把bin目录重命名为bin-host,再交叉编译
./configure
make
mv bin bin-host
mv lib lib-host
./configure --build=i686-pc-linux --host=arm-linux --target=arm-linux --enable-shared --prefix=$PREFIX
make;make install
cp config/icu-config /mnt/SD/bin
glib-2.24.0
export ARCH=arm
echo ac_cv_type_long_long=yes>>$ARCH-linux.cache
echo glib_cv_stack_grows=no>>$ARCH-linux.cache
echo glib_cv_uscore=no>>$ARCH-linux.cache
echo c_cv_func_posix_getpwuid_r=yes>>$ARCH-linux.cache
echo ac_cv_func_posix_getpwuid_r=yes>>$ARCH-linux.cache
./configure --build=i686-pc-linux --host=arm-linux --target=arm-linux --enable-shared --prefix=$PREFIX --cache-file=$ARCH-linux.cache
make;make install
cairo-1.8.10
./configure --build=i686-pc-linux --host=arm-linux --target=arm-linux --enable-shared --prefix=$PREFIX --enable-directfb=yes --without-x --disable-xlib --disable-xlib-xrender --disable-win32 --enable-png
make;make install
pango-1.28.0
export CAIRO_CFLAGS="-fno-strict-aliasing -I$PREFIX/include/cairo -I$PREFIX/include/fontconfig -I$PREFIX/include -I$PREFIX/include/pixman-1 -I$PREFIX/include/freetype2 -I$PREFIX/include/libpng12"
export CAIRO_LIBS="-L$PREFIX/lib -lcairo"
export GLIB_CFLAGS="-I$PREFIX/include -I$PREFIX/include/glib-2.0 -I$PREFIX/lib/glib-2.0/include"
export GLIB_LIBS="-L$PREFIX/lib -lgobject-2.0 -lgmodule-2.0 -lglib-2.0"
export FONTCONFIG_CFLAGS="-I$PREFIX/include/fontconfig -I$PREFIX/include"
export FONTCONFIG_LIBS="-L$PREFIX/lib -lfontconfig"
export FREETYPE_CFLAGS="-I$PREFIX/include/freetype2 -I$PREFIX/include"
export FREETYPE_LIBS="-L$PREFIX/lib -lfreetype -lz"
export FREETYPE_CONFIG="${PREFIX}/bin/freetype-config"
export CAIRO_PREFIX=$PREFIX
./configure --build=i686-pc-linux --host=arm-linux --target=arm-linux --enable-shared --prefix=$PREFIX --without-x
make;make install
libsoup-2.30.2
./configure --build=i686-pc-linux --host=arm-linux --target=arm-linux --enable-shared --prefix=$PREFIX --without-gnome --with-libgcrypt-prefix=/home/qwdu/8900/webkit/deplib --disable-ssl --without-apache-httpd
make;make install
因为我主机上安装了libgcrypt-dev,不想让他找到,估计设置一个目录,让他找不到
atk-1.30.0
./configure --build=i686-pc-linux --host=arm-linux --target=arm-linux --enable-shared --prefix=$PREFIX --disable-glibtest
make;make install
gtk+-2.16.0
echo gio_can_sniff=yes >arm-linux.cache
export BASE_DEPENDENCIES_LIBS="-L$PREFIX/lib -lpangocairo-1.0 -lpango-1.0 -lcairo -ljpeg -lpng12 -lpangoft2-1.0"
./configure --build=i686-pc-linux --host=arm-linux --target=arm-linux --enable-shared --prefix=$PREFIX --with-gdktarget=directfb --without-libtiff --disable-glibtest --disable-largefile --with-included-loaders=jpeg,gif,png,xpm --without-libjasper --without-x --enable-debug=no --cache-file=arm-linux.cache --disable-cups
make;make install
webkit-1.3.3
./configure --build=i686-pc-linux --host=arm-linux --target=arm-linux --enable-shared --prefix=$PREFIX --with-target=directfb --disable-datalist --disable-ruby --disable-sandbox --disable-video --disable-xslt --disable-dom-storage --disable-offline-web-applications --disable-channel-messaging --disable-database --disable-eventsource --disable-icon-database
make;make install
3.遇到的问题以及解决方法
icu编译,请先下载icu-cross-compile.patch
|
文件: | icu-cross-compile.rar |
大小: | 3KB |
下载: | 下载 |
|
在编译icu之前打上补丁(patch -p0
pango编译出错,运行下面命令:
cd pango
perl -pi -e 's/\@ENUMPREFIX\@/PANGO/g' pango-enum-types.h
cd ..
gtk编译出错,请按照下面方法修改
(1)configure阶段找不到pango,明明pango已经编译安装,打开config.log,发现链接库依赖出错,做如下修改:
方法一:
vi configure:
----PANGO_PACKAGES="pango pangocairo
++++PANGO_PACKAGES="pango pangocairo pangoft2 pixman-1 directfb libxml-2.0 libpng"
方法二:
export LDFLAGS="-L$PREFIX/lib -Wl,-rpath,$PREFIX/lib"
(2)编译阶段出错
perl -pi -e 's/\@ENUMPREFIX\@/GDK/g' gdk-pixbuf/gdk-pixbuf-enum-types.h
perl -pi -e 's/\@ENUMPREFIX\@/GDK/g' gdk/gdkenumtypes.h
perl -pi -e 's/\@ENUMPREFIX\@/GTK/g' gtk/gtktypebuiltins.h
webkit编译出错
请对照下面的patch修改,具体行数可能不一样,不能直接patch,需要手工一步一步修改
|
文件: | webkit-directfb.rar |
大小: | 6KB |
下载: | 下载 |
|
编译过程中出现
DerivedSources/WebCore/JSDOMWindow.cpp:330:26: error: JSTimeRanges.h: No such file or directory
请到DerivedSources/WebCore/JSDOMWindow.cpp文件330行,注释这一句即可
到开发板上的操作
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$/mnt/SD/lib
#mkdir /mnt/SD/etc/pango
#pango-querymodules > /mnt/SD/etc/pango/pango.modules
#gdk-pixbuf-query-loaders > /mnt/SD/etc/gtk-2.0/gdk-pixbuf.loaders
#mkdir /mnt/SD/share/fonts
#复制一个矢量字体文件到/mnt/SD/share/fonts,比如文泉译字体wqy-microhei.ttc
修改一下字体配置路径
#vi /mnt/SD/etc/fonts/fonts.conf
/mnt/SD/share/fonts
一般arm上的移植到此就可结束,运行GtkLauncher,应该没有问题
但是我用的tcc8900平台需要直接高清分辨率1080p显示,而且framebuffer默认输出模式是yuv,还要做一些修改
systems/fbdev/fbdev.c
dfb_pixelformat_name(config->format), shared->fix.line_length );
这里改成
dfb_pixelformat_name(config->format), var.xres*2 );
这里var.yres_virtual * shared->fix.line_length );改成
var.yres_virtual * var.xres*2 );
// if (config->format == DSPF_RGB332)
// dfb_fbdev_set_rgb332_palette();
// else
// dfb_fbdev_set_gamma_ramp( config->format );
这三行注释,否则运行directfb相关程序内核直接崩溃,好像是调色板那个fb的ioctl没支持
在open fb之后加入
int color = IMGFMT_RGB565;
int on=1;
ioctl(dfb_fbdev->fd, TCC_LCD_FB_IOCTL_SET_FORMAT, &color);
ioctl(dfb_fbdev->fd, TCC_LCD_FB_IOCTL_DISP_ONOFF,&on);
systems/fbdev/fbdev_surface_pool.c
lock->pitch = shared->fix.line_length;
这里改成
lock->pitch = surface->config.size.w*2;
编译之后替换板子上的/mnt/SD/lib/directfb-1.4-5/systems/libdirectfb_fbdev.so
最后关闭fb1,fb2,运行GtkLauncher,终于正常运行
部分patch参考此网站
%2Ftuxbuilder%2Ftrunk%2Fcross%2Fdirectfb%2F&rev=0&sc=1