C++WebKit内核编译

WebKit内核编译实在是一模一样起折磨人的事情,虽然webkit.org官方有一个文档,但是有时机器本身配置环境还是跟课程有反差。

由此三上三夜平均每天2点钟之加油,今天好不容易搞定了。

其实,官方的叙说已经坏到位,只要保证各一样步都尽了,差别应该无特别,需要多加拍卖的就是是本机实际条件造成的现实性问题。

第一以法定文档进行操作

http://www.webkit.org/building/tools.html

一、安装Visual
2005

  1. If you own Visual Studio 2005 (newer versions of Visual Studio are
    currently unsupported):

    Install Microsoft Visual Studio 2005 Team Suite Service Pack
    1.

    If you are building from Vista, install Service Pack 1 Update for
    Windows
    Vista.

    Install Visual Studio 2005 Service Pack 1 ATL Security
    Update.

    Install the following hotfixes to improve Visual Studio’s
    performance and responsiveness:

    1. KB918559
    2. KB935225
    3. KB943969
    4. KB947315

    Use the default options for these installations.

(我于伪装下四只补丁的下唤醒找不交提升之次第,我装的凡2005
中文版,估计补丁有题目,后来尚无理会了)

二、安装cygwin

  1. Install Cygwin

    Cygwin is a collection of utilities for Windows that includes not
    only a Subversionclient, but also additional tools that are required
    to build the WebKit source. Wehave made a downloader available that
    automatically collects all of the requiredpackages.

    Download cygwin-downloader.zip.

    Extract the content of the archive to some folder and
    start cygwin-downloader.exe from that folder.This will download
    all the Cygwin packages you need.

    When all the packages have finished downloading, the Cygwin
    installer will launch. ChooseInstall from Local Directory, then
    clickNext until theinstall is complete. If you are running
    Vista, the installer won’t be able to launch automatically, so you
    will have to manually launch Cygwin’s Setup.exe.

    Note: If you are behind a proxy you need to set
    the http_proxy environment variable to the URL of the proxy. This
    wouldlikely match this
    pattern:http[s]://[username[:password]@]somehost.com[:port]. Where
    the square brackets ([]) are not part of the url but enclose url
    elements that are optional indicating that those elements might be
    missing in your case together with their enclosed delimiter such as
    @ and :.

    Note: Vista may warn you that Cygwin did not install correctly.
    Ignore this warning and tell Vista that the install was successful.

    Warning: If you are running Vista or Windows 7, Cygwin may have
    trouble with implementingfork(the POSIX function frequently used
    to start child processes, needed by many of the WebKit build
    tools).In order to enablecygwin1.dll to implement fork
    successfully it is better if no DLL loaded in the parent process is
    relocated at runtime.One way to achive this is to rebase all cygwin
    dlls exceptcyglsa64.dllandcygwin1.dll to base addresses that
    cause them to not overlap in memory.

    In order to rebase all cygwin dlls a rebaseall script is provided
    in the cygwin
    installation’sbindirectory(usuallyC:\cygwin\bin).This script
    must be run fromash.exe (found in the same directory) while no
    other cygwin application is running.
    ash.exe has very limited command line editing features so cutting
    and pasting to the commandline is recommended.
    The PATH environment variable may not contain the /bin directory
    by defaultthus the script should be launched as/bin/rebaseall.
    If rebaseall is complaining about failure to write to a Windows
    Temp directory (i.e./cygdrive/c/Users/you/AppData/Local/Temp),fix
    the permissions on that folder
    (i.e./bin/chown you /cygdrive/c/Users/you/AppData/Local/Temp)
    orchange the TMP environment variable to point to a directory with
    the appropriate permission flags (i.e.:export TMP=/tmp).

    Note: The rebase process may need to be repeated to include any
    new libraries added later to cygwin by listing these libraries by
    full cygwin path in a file and passing the file torebaseall via
    the-T fileNamecommandline argument.The dlls
    underLayoutTests/http/conf are a relevant use case.

    Remove the following lines from /home/[username]/.bashrc (if
    present):

    unset TMP

    unset TEMP

    Those lines would prevent picking up the Windows TMP and TEMP
    environment variables.

    If you are behind a proxy you need to do the following to allow
    cygwin svn to get through the proxy (similar steps are available for
    your Windows svn):

    • In bash (Cygwin) run: svn help. This will create in your
      cygwin home directory the file .subversion/servers.
    • Edit the file mentioned above and follow the instructions in the
      file to set up your proxy settings.

(上面的各一样步都使尽,包括用他cygwin配置,执行ash.exe
/binrebaseall)

三 安装 QuickTime
SDK和 DirectX SDK

  1. Install QuickTime SDK

    Download QuickTime SDK for Windows
    from http://developer.apple.com/quicktime/download/ and install it
    to the default location (\Program Files\QuickTime SDK). This is
    needed for media support.

  2. Install DirectX SDK

    Download the February 2010 DirectX
    SDK (newer
    versions do not support Visual Studio 2005). This is needed for
    accelerated compositing.

(都要装)


其他 

  1. Optional: Install the 32-bit version of Debugging Tools for Windows

    Debugging Tools for Windows includes many useful debugging tools
    such as WinDbg and NTSD. Some of WebKit’s tests and scripts use
    these tools. Follow theinstructions for installing the 32-bit
    version of Debugging Tools for
    Windows.

  2. Optional: Hotfix for 64-bit Windows to disable the user-mode
    callback filter for exceptions

    Without the 976038 hotfix,
    exceptions may be thrown in callback routines that do not cause a
    crash but leave the application in an inconsistent state that might
    cause a crash later. You will need to click on “View and request
    hotfix downloads” and fill out the form. A link to download the
    hotfix and a password will be emailed to you.

(编译通过的时这些我没装),最后要经过了。

五 总结一下

需我们自己开的事体

更改VC为DEBUG、设置“警告作为不当”为false、

编译错误以及缓解

率先,这同首文档算是比较咸的。

http://hi.baidu.com/ksoftware/blog/item/75dace1f94750179f724e457.html

转载一下

1) ERROR # PRJ0018 : 未找到下列环境变量: >$(WebKitOutputDir)
         SOLUTION # 添加环境变量WebKitOutputDir
      2) ERROR # fatal error C1083: 无法打开包文件:“unicode/uchar.h”:
No such file or directory
               # fatal error C1083: 无法打开包文件:“pthread.h”: No
such file or directory
               # ‘grep’
不是里还是外部命令,也不是不过运行的主次要批处理公事
               # fatal error C1083:
无法打开包文件:“WebKit2/WebKit2.h”: No such file or directory
               # error LNK2019: 无法解析的标符号
_u_charType_3_2,该符号在函数 “bool __cdecl
WTF::Unicode::isSeparatorSpace(int)”
(?isSeparatorSpace@Unicode@WTF@@YA_NH@Z) 中为引述
         SOLUTION # run update-webkit and build-webkit scripts again
      3) ERROR # error PRJ0002 : 错误的结果 1
(从“C:\WINDOWS\system32\cmd.exe”返回)
         SOLUTION # 关联错误 无需修正
      4) ERROR # error C2220: 警告被视为错误 – 没有变动“object”文件
               # error C2001: 常量中起易行符
               # fatal error C1057: 宏进行中遇意外之公文了
         SOLUTION #
发现DefaultLocalizationStrategy.cpp中之对引号格式为全角格式,改成为半角并加转义。
                      #if USE(CF)
                          RetainPtr<CFStringRef>
selectedCFString(AdoptCF,
truncatedStringForLookupMenuItem(selectedString).createCFString());
                          return
formatLocalizedString(WEB_UI_STRING(“Look Up \”%@\””, “Look Up
context menu item with selected word”), selectedCFString.get());
                      #else
                          return WEB_UI_STRING(“Look Up
\”<selection>\””, “Look Up context menu item with selected
word”).replace(“<selection>”,
truncatedStringForLookupMenuItem(selectedString));
                      #endif
      5) ERROR # error MIDL2152 : [version] format is incorrect 
               # error MIDL2214 : semantic check incomplete due to
previous errors
         SOLUTION # 查看WebKid.idl 定位到150行    
version(__TYPELIB_VERSION__) 发现一个version的函数
                      #define __TYPELIB_VERSION__
__BUILD_NUMBER_MAJOR__##.##__BUILD_NUMBER_MINOR__
                      试了生修改也
                      #define __TYPELIB_VERSION__ 0.1
                      重新转,成功。
      6) ERROR # error C2220: 警告被视为错误 – 没有变“object”文件
         SOLUTION # 在vs2005负再保存即可

(我下载的是WebKit-r94831.tar.bz2
,遇到了ERROR # error C2220: 警告被视为错误 –
没有变化“object”文件,要设置者修改,于此同时要关警告被视为错误的VC编译选项)

附带,连接错误

参见这首博客http://blog.csdn.net/dummas/article/details/3871134

1>Linking…
11>LINK : warning LNK4044: unrecognized option ‘/dynamicbase’;
ignored
11>   Creating library
D:/liangjh/WebKit-r40102/WebKitBuild/lib/WebKit.lib and o
bject D:/liangjh/WebKit-r40102/WebKitBuild/lib/WebKit.exp
11>WebCore_debug.lib(CSSGradientValue.obj) : error LNK2001:
unresolved external
symbol “__declspec(dllimport) public: void __thiscall
std::exception::_Raise(voi
d)const ” (__imp_?_Raise@exception@std@@QBEXXZ)
11>WebCore_debug.lib(RenderLayer.obj) : error LNK2019: unresolved
external symbo
l “__declspec(dllimport) public: void __thiscall
std::exception::_Raise(void)con
st ” (__imp_?_Raise@exception@std@@QBEXXZ) referenced in function
“struct std::p
air<class WebCore::RenderLayer * *,int> __cdecl
std::get_temporary_buffer<class
WebCore::RenderLayer *>(int)”
(??$get_temporary_buffer@PAVRenderLayer@WebCore@@@
std@@YA?AU?$pair@PAPAVRenderLayer@WebCore@@H@0@H@Z)
11>WebCore_debug.lib(Gradient.obj) : error LNK2001: unresolved
external symbol “
__declspec(dllimport) public: void __thiscall
std::exception::_Raise(void)const
” (__imp_?_Raise@exception@std@@QBEXXZ)
11>WebCore_debug.lib(CSSFontSelector.obj) : error LNK2001:
unresolved external s
ymbol “__declspec(dllimport) public: void __thiscall
std::exception::_Raise(void
)const ” (__imp_?_Raise@exception@std@@QBEXXZ)
11>WebCore_debug.lib(CompositeAnimation.obj) : error LNK2001:
unresolved externa
l symbol “__declspec(dllimport) public: void __thiscall
std::exception::_Raise(v
oid)const ” (__imp_?_Raise@exception@std@@QBEXXZ)
11>WebCore_debug.lib(CSSGradientValue.obj) : error LNK2001:
unresolved external
symbol “__declspec(dllimport) public: __thiscall
std::exception::exception(char
const *,int)” (__imp_??0exception@std@@QAE@PBDH@Z)
11>WebCore_debug.lib(RenderLayer.obj) : error LNK2019: unresolved
external symbo
l “__declspec(dllimport) public: __thiscall
std::exception::exception(char const
 *,int)” (__imp_??0exception@std@@QAE@PBDH@Z) referenced in function
“public: __
thiscall std::bad_alloc::bad_alloc(char const *)”
(??0bad_alloc@std@@QAE@PBD@Z)
11>WebCore_debug.lib(Gradient.obj) : error LNK2001: unresolved
external symbol “
__declspec(dllimport) public: __thiscall
std::exception::exception(char const *,
int)” (__imp_??0exception@std@@QAE@PBDH@Z)
11>WebCore_debug.lib(CSSFontSelector.obj) : error LNK2001:
unresolved external s
ymbol “__declspec(dllimport) public: __thiscall
std::exception::exception(char c
onst *,int)” (__imp_??0exception@std@@QAE@PBDH@Z)
11>WebCore_debug.lib(CompositeAnimation.obj) : error LNK2001:
unresolved externa
l symbol “__declspec(dllimport) public: __thiscall
std::exception::exception(cha
r const *,int)” (__imp_??0exception@std@@QAE@PBDH@Z)
11>WebCore_debug.lib(CSSGradientValue.obj) : error LNK2001:
unresolved external
symbol “__declspec(dllimport) void __cdecl std::_Throw(class
std::exception cons
t &)” (__imp_?_Throw@std@@YAXABVexception@1@@Z)
11>WebCore_debug.lib(RenderLayer.obj) : error LNK2019: unresolved
external symbo
l “__declspec(dllimport) void __cdecl std::_Throw(class
std::exception const &)”
 (__imp_?_Throw@std@@YAXABVexception@1@@Z) referenced in function
“protected: vi
rtual void __thiscall std::bad_alloc::_Doraise(void)const ”
(?_Doraise@bad_alloc
@std@@MBEXXZ)
11>WebCore_debug.lib(Gradient.obj) : error LNK2001: unresolved
external symbol “
__declspec(dllimport) void __cdecl std::_Throw(class std::exception
const &)” (_

_imp_?_Throw@std@@YAXABVexception@1@@Z)
11>WebCore_debug.lib(CSSFontSelector.obj) : error LNK2001:
unresolved external s
ymbol “__declspec(dllimport) void __cdecl std::_Throw(class
std::exception const
 &)” (__imp_?_Throw@std@@YAXABVexception@1@@Z)
11>WebCore_debug.lib(CompositeAnimation.obj) : error LNK2001:
unresolved externa
l symbol “__declspec(dllimport) void __cdecl std::_Throw(class
std::exception co
nst &)” (__imp_?_Throw@std@@YAXABVexception@1@@Z)
11>D:/liangjh/WebKit-r40102/WebKitBuild/bin/WebKit.dll : fatal error
LNK1120: 3
unresolved externals
11>Project : warning PRJ0018 : The following environment variables
were not foun
d:
11>$(PRODUCTION)
11>Build log was saved at
“file://D:/liangjh/WebKit-r40102/WebKitBuild/obj/WebKi
t/Debug/BuildLog.htm”
11>WebKit – 16 error(s), 14 warning(s)

立刻篇博客说,是google STL有关,要修改
WebKit/WebCore/config.h里面,在<wtf/platform.h>上面长

#define
_HAS_EXCEPTIONS 0
#define _STATIC_CPPLIB

然,我这样做事失败了之。搞了颇遥远发现自己有一个东西忘安装了Install Microsoft
Visual C++ Express 2005 Service Pack
1,官方下载的是

VS80sp1-KB926601-X86-ENU.exe,其实是自这里装不起,后来假装了VS80sp1-KB926604-X86-CHS.exe,才化解了之题目。

末,其他连接错误

  正在开创库 D:\WEBKIT\webkitH\WebKitBuild\lib\JavaScriptCore.lib
和对象 D:\WEBKIT\webkitH\WebKitBuild\lib\JavaScriptCore.exp
3>FunctionPrototype.obj : error LNK2019: 无法解析的表符号
_u_charType_46,该符号在函数 “bool __cdecl
WTF::Unicode::isSeparatorSpace(int)”
(?isSeparatorSpace@Unicode@WTF@@YA_NH@Z) 中受引述
3>JSGlobalObjectFunctions.obj : error LNK2001: 无法解析的外部符号
_u_charType_46
3>Lexer.obj : error LNK2001: 无法解析的表面符号 _u_charType_46
3>StringPrototype.obj : error LNK2019: 无法解析的外部符号
_u_strToLower_46,该符号在函数 “int __cdecl
WTF::Unicode::toLower(wchar_t *,int,wchar_t const *,int,bool *)”
(?toLower@Unicode@WTF@@YAHPA_WHPB_WHPA_N@Z) 中被引用
3>WTF.lib(StringImpl.obj) : error LNK2001: 无法解析的外表符号
_u_strToLower_46
3>StringPrototype.obj : error LNK2019: 无法解析的表符号
_u_strToUpper_46,该符号在函数 “int __cdecl
WTF::Unicode::toUpper(wchar_t *,int,wchar_t const *,int,bool *)”
(?toUpper@Unicode@WTF@@YAHPA_WHPB_WHPA_N@Z) 中给引用
3>WTF.lib(StringImpl.obj) : error LNK2001: 无法解析的表符号
_u_strToUpper_46
3>RegexCompiler.obj : error LNK2019: 无法解析的表面符号
_u_tolower_46,该符号在函数 “int __cdecl
WTF::Unicode::toLower(int)” (?toLower@Unicode@WTF@@YAHH@Z) 中给引述
3>RegexInterpreter.obj : error LNK2001: 无法解析的外部符号
_u_tolower_46
3>RegexJIT.obj : error LNK2001: 无法解析的外表符号 _u_tolower_46
3>RegexCompiler.obj : error LNK2019: 无法解析的表面符号
_u_toupper_46,该符号在函数 “int __cdecl
WTF::Unicode::toUpper(int)” (?toUpper@Unicode@WTF@@YAHH@Z) 中被引用
3>RegexInterpreter.obj : error LNK2001: 无法解析的表面符号
_u_toupper_46
3>RegexJIT.obj : error LNK2001: 无法解析的标符号 _u_toupper_46
3>WTF.lib(StringImpl.obj) : error LNK2019: 无法解析的表符号
_u_strFoldCase_46,该符号在函数 “int __cdecl
WTF::Unicode::foldCase(wchar_t *,int,wchar_t const *,int,bool *)”
(?foldCase@Unicode@WTF@@YAHPA_WHPB_WHPA_N@Z) 中被引述
3>WTF.lib(StringImpl.obj) : error LNK2019: 无法解析的外部符号
_u_charDirection_46,该符号在函数 “enum WTF::Unicode::Direction
__cdecl WTF::Unicode::direction(int)”
(?direction@Unicode@WTF@@YA?AW4Direction@12@H@Z) 中于引述
3>WTF.lib(WTFString.obj) : error LNK2001: 无法解析的标符号
_u_charDirection_46
3>WTF.lib(StringImpl.obj) : error LNK2019: 无法解析的标符号
_u_foldCase_46,该符号在函数 “int __cdecl
WTF::Unicode::foldCase(int)” (?foldCase@Unicode@WTF@@YAHH@Z) 中吃引述
3>WTF.lib(StringImpl.obj) : error LNK2019: 无法解析的外表符号
_u_memcasecmp_46,该符号在函数 “int __cdecl
WTF::Unicode::umemcasecmp(wchar_t const *,wchar_t const *,int)”
(?umemcasecmp@Unicode@WTF@@YAHPB_W0H@Z) 中给引用
3>WTF.lib(CollatorICU.obj) : error LNK2019: 无法解析的标符号
_ucol_strcoll_46,该符号在函数 “public: enum WTF::Collator::Result
__thiscall WTF::Collator::collate(wchar_t const *,unsigned
int,wchar_t const *,unsigned int)const ”
(?collate@Collator@WTF@@QBE?AW4Result@12@PB_WI0I@Z) 中受引述
3>WTF.lib(CollatorICU.obj) : error LNK2019: 无法解析的表符号
_ucol_setAttribute_46,该符号在函数 “private: void __thiscall
WTF::Collator::createCollator(void)const ”
(?createCollator@Collator@WTF@@ABEXXZ) 中让引用
3>WTF.lib(CollatorICU.obj) : error LNK2019: 无法解析的表面符号
_ucol_open_46,该符号在函数 “private: void __thiscall
WTF::Collator::createCollator(void)const ”
(?createCollator@Collator@WTF@@ABEXXZ) 中给引用
3>WTF.lib(CollatorICU.obj) : error LNK2019: 无法解析的外表符号
_ucol_getAttribute_46,该符号在函数 “private: void __thiscall
WTF::Collator::createCollator(void)const ”
(?createCollator@Collator@WTF@@ABEXXZ) 中叫引述
3>WTF.lib(CollatorICU.obj) : error LNK2019: 无法解析的表符号
_ucol_getLocaleByType_46,该符号在函数 “private: void __thiscall
WTF::Collator::createCollator(void)const ”
(?createCollator@Collator@WTF@@ABEXXZ) 中吃引用
3>WTF.lib(CollatorICU.obj) : error LNK2019: 无法解析的表符号
_ucol_close_46,该符号在函数 “private: void __thiscall
WTF::Collator::releaseCollator(void)”
(?releaseCollator@Collator@WTF@@AAEXXZ) 中受引述
3>D:\WEBKIT\webkitH\WebKitBuild\bin\JavaScriptCore.dll : fatal
error LNK1120: 15 只无法解析的外部命令

google搜索是啊icu3.2 icu4.0的东西,后面涉及到什么VS2005 2008扑。

其一题材,我碰到没搞定,后来重装的网,这个题材便从不出现了。

斯就算是持续找,不断尝试,本来还打算放弃了底,但是不甘心,最后竟成功了,也祝愿大家编译顺利。

 

转  http://blog.csdn.net/elfylin/article/details/6769747