/ 中存储网

Ubuntu编译Webkit的方法及命令

2015-10-30 07:44:19 来源:中存储网

webkit是一个浏览器内核,google的chrome就是基于它的,接下来介绍一下如何在Ubuntu 11.04下编译Webkit源代码。网上有大量的关于如何在Windows下或者如何用Qt来编译Webkit,这篇文章不对此进行介绍,只介绍如何在命令行下编译Webkit源代码:

 
1.下载:在http://nightly.webkit.org/ 下载webkit的最新版本源码,我的是WebKit-r96832

2.编译:
./WebKit-r96832/Tools/Scripts/build-webkit --gtk

正常情况下会缺少各种库,没关系,一个一个解决。接下来列举了我所遇到的一些问题:

sudo apt-get install libtool
sudo apt-get install gtk-doc-tools

错误:undefined macro XXX (不记得了)
解决:sudo apt-get install libgtkhtml*       (全部安装)

错误:configure: error: JPEG library (libjpeg) not found
解决:sudo apt-get install libjpeg8-dev      (当时我编译的时候libjpeg的最新版是8,你编译的时候要选择当前的最新版,下同!)

错误:Cannot find icu-config. The ICU library is needed.
解决:sudo apt-get install libicu-dev

错误:configure: error: Package requirements (gail-3.0 >= 3.0) were not met: No package 'gail-3.0' found
解决:sudo apt-get install libgail-3-dev

错误:configure: error: X Toolkit Intrinsics library (libXt) not found
解决:sudo apt-get install libxt-dev

错误:configure: error: Package requirements (libsoup-2.4 >= 2.33.6) were not met: No package 'libsoup-2.4' found
解决:sudo apt-get install libsoup2.4-dev

错误:configure: error: SQLite3 is required for the Database related features
解决:sudo apt-get install libsqlite3-dev

错误:configure: error: Package requirements (libxslt >= 1.1.7) were not met: No package 'libxslt' found
解决:sudo apt-get install libxslt-dev

错误:configure: error: Package requirements (geoclue) were not met: No package 'geoclue' found
解决:sudo apt-get install libgeoclue-dev

错误:configure: error: Package requirements (gstreamer-0.10 >= 0.10
gstreamer-app-0.10
gstreamer-base-0.10
gstreamer-interfaces-0.10
gstreamer-pbutils-0.10
gstreamer-plugins-base-0.10 >= 0.10.30
gstreamer-video-0.10) were not met:

No package 'gstreamer-0.10' found
No package 'gstreamer-app-0.10' found
No package 'gstreamer-base-0.10' found
No package 'gstreamer-interfaces-0.10' found
No package 'gstreamer-pbutils-0.10' found
No package 'gstreamer-plugins-base-0.10' found
No package 'gstreamer-video-0.10' found
解决:sudo apt-get install libgstreamer*

最后终于没有问题,开始编译了!
./WebKit-r96832/Tools/Scripts/build-webkit --gtk

经过了漫长的等待(整整一个小时!),终于编译通过了!
记录一下编译通过的输出:
WebKit is now built (1h:01m:41s).
To run GtkLauncher with this newly-built code, use the
"Tools/Scripts/run-launcher" script.

如何运行?
./Tools/Scripts/run-launcher --gtk 就可以啦!

完成!