在windows下编译webkit

On 八月 3, 2011, in 技术记录, by pensz

这是半年前在windows上编译、调试webkit的一些记录,可能比较乱。

windows下的webkit apple port编译的经验总结

  1. 主要参考webkit官网,在不清楚文档中每一步的作用前,老老实实的按照文档做
  2. 安装cygwin的时候要选择install from local directory, 否则会缺失包
  3. 在WebKitLibraries/win/tools/vsprops目录下面手动建立一个.svn文件夹(可以通过命令行建立)
  4. BuildLog是很好的参考资料,一旦出错,参考该log是比较容易找出问题的
  5. build-webkit 和 通过 vs编译事实上是一样的,因为build-webkit调用的是就是vs的命令行
  6. 另外dumprendertree 还是必须将vs编译的选项 treat warning as error改成 no,否则无法编译通过
  7. 在编译时还遇到一个问题,就是cl.exe报fatal错误,查了相关资料,后来没做任何处理,重新编译就可以了
debug调试
用safari作为debug总是会出错,以下为错误信息:
Unhandled exception at 0×78145215 (msvcr80.dll) in Safari.exe: 0xC0000005: Access violation reading location 0x091bfffc.
memcpy(data, characters, length * sizeof(UChar));
+ dst 0x091c0034 “” unsigned char *
+ src 0x089e9b10 “,甓” unsigned char *
count 68945734 unsigned long
memcpy(data, characters, length * sizeof(UChar));
+ data 0x091c0034 “” wchar_t *
+ characters 0x089e9b10 “Ҷ” const wchar_t *
length 34472867 unsigned int
+ string {m_ptr=0x091c0020 } WTF::PassRefPtr<WTF::StringImpl>
后来使用winLancher作为debug的工具,还是不错的。
或者使用minibrowser作为debug的工具,需要主要的是,minibrowser要attach到webkit2的进程上面
运行这个需要apple的相关dll,这些dll的位置在 C:\Program Files\Common Files\Apple\Apple Application Support
注意,不要把webkit javascriptcore相关文件复制过去。
下面是点击一个按钮到提交form对应的堆栈信息:
WebKit.dll!WebCore::HTMLFormElement::prepareSubmit(WebCore::Event * event=0x03417dc0)  Line 265 C++
WebKit.dll!WebCore::HTMLInputElement::defaultEventHandler(WebCore::Event * evt=0x03417dc0)  Line 2207 + 0×13 bytes C++
WebKit.dll!WebCore::Node::dispatchGenericEvent(WTF::PassRefPtr<WebCore::Event> prpEvent={…})  Line 2747 + 0x1b bytes C++
WebKit.dll!WebCore::Node::dispatchEvent(WTF::PassRefPtr<WebCore::Event> prpEvent={…})  Line 2631 + 0×12 bytes C++
WebKit.dll!WebCore::Node::dispatchUIEvent(const WTF::AtomicString & eventType={…}, int detail=1, WTF::PassRefPtr<WebCore::Event> underlyingEvent={…})  Line 2799 + 0×22 bytes C++
WebKit.dll!WebCore::Node::defaultEventHandler(WebCore::Event * event=0x03ec3548)  Line 3021 + 0×23 bytes C++
WebKit.dll!WebCore::HTMLFormControlElementWithState::defaultEventHandler(WebCore::Event * event=0x03ec3548)  Line 472 C++
WebKit.dll!WebCore::HTMLInputElement::defaultEventHandler(WebCore::Event * evt=0x03ec3548)  Line 2442 C++
WebKit.dll!WebCore::Node::dispatchGenericEvent(WTF::PassRefPtr<WebCore::Event> prpEvent={…})  Line 2747 + 0x1b bytes C++
WebKit.dll!WebCore::Node::dispatchEvent(WTF::PassRefPtr<WebCore::Event> prpEvent={…})  Line 2631 + 0×12 bytes C++
WebKit.dll!WebCore::Node::dispatchMouseEvent(const WTF::AtomicString & eventType={…}, int button=0, int detail=1, int pageX=435, int pageY=73, int screenX=531, int screenY=178, bool ctrlKey=false, bool altKey=false, bool shiftKey=false, bool metaKey=false, bool isSimulated=false, WebCore::Node * relatedTargetArg=0×00000000, WTF::PassRefPtr<WebCore::Event> underlyingEvent={…})  Line 2924 C++
WebKit.dll!WebCore::Node::dispatchMouseEvent(const WebCore::PlatformMouseEvent & event={…}, const WTF::AtomicString & eventType={…}, int detail=1, WebCore::Node * relatedTarget=0×00000000)  Line 2833 C++
WebKit.dll!WebCore::EventHandler::dispatchMouseEvent(const WTF::AtomicString & eventType={…}, WebCore::Node * targetNode=0x03ee9b48, bool __formal=true, int clickCount=1, const WebCore::PlatformMouseEvent & mouseEvent={…}, bool setUnder=true)  Line 1845 + 0×23 bytes C++
WebKit.dll!WebCore::EventHandler::handleMouseReleaseEvent(const WebCore::PlatformMouseEvent & mouseEvent={…})  Line 1573 + 0x2f bytes C++
WebKit.dll!WebView::handleMouseEvent(unsigned int message=514, unsigned int wParam=0, long lParam=4784563)  Line 1402 C++
WebKit.dll!WebView::WebViewWndProc(HWND__ * hWnd=0x000d02da, unsigned int message=514, unsigned int wParam=0, long lParam=4784563)  Line 2052 + 0×14 bytes C++
user32.dll!77d18734()
[Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]
user32.dll!77d18816()
user32.dll!77d189cd()
user32.dll!77d191f1()
user32.dll!77d18a10()
WinLauncher_debug.exe!wWinMain(HINSTANCE__ * hInstance=0×00400000, HINSTANCE__ * hPrevInstance=0×00000000, wchar_t * lpCmdLine=0x00020b14, int nCmdShow=1)  Line 241 + 0×10 bytes C++
WinLauncher_debug.exe!__tmainCRTStartup()  Line 589 + 0x1c bytes C
kernel32.dll!7c817077()
更加详细的堆栈信息
WebKit.dll!WebCore::FrameLoader::submitForm(WTF::PassRefPtr<WebCore::FormSubmission> submission={…})  Line 367 C++
WebKit.dll!WebCore::HTMLFormElement::submit(WebCore::Event * event=0x03417dc0, bool activateSubmitButton=true, bool lockHistory=false, WebCore::FormSubmissionTrigger formSubmissionTrigger=NotSubmittedByJavaScript)  Line 312 C++
WebKit.dll!WebCore::HTMLFormElement::prepareSubmit(WebCore::Event * event=0x03417dc0)  Line 268 C++
WebKit.dll!WebCore::HTMLInputElement::defaultEventHandler(WebCore::Event * evt=0x03417dc0)  Line 2207 + 0×13 bytes C++
WebKit.dll!WebCore::Node::dispatchGenericEvent(WTF::PassRefPtr<WebCore::Event> prpEvent={…})  Line 2747 + 0x1b bytes C++
WebKit.dll!WebCore::Node::dispatchEvent(WTF::PassRefPtr<WebCore::Event> prpEvent={…})  Line 2631 + 0×12 bytes C++
WebKit.dll!WebCore::Node::dispatchUIEvent(const WTF::AtomicString & eventType={…}, int detail=1, WTF::PassRefPtr<WebCore::Event> underlyingEvent={…})  Line 2799 + 0×22 bytes C++
WebKit.dll!WebCore::Node::defaultEventHandler(WebCore::Event * event=0x03ec3548)  Line 3021 + 0×23 bytes C++
WebKit.dll!WebCore::HTMLFormControlElementWithState::defaultEventHandler(WebCore::Event * event=0x03ec3548)  Line 472 C++
WebKit.dll!WebCore::HTMLInputElement::defaultEventHandler(WebCore::Event * evt=0x03ec3548)  Line 2442 C++
WebKit.dll!WebCore::Node::dispatchGenericEvent(WTF::PassRefPtr<WebCore::Event> prpEvent={…})  Line 2747 + 0x1b bytes C++
WebKit.dll!WebCore::Node::dispatchEvent(WTF::PassRefPtr<WebCore::Event> prpEvent={…})  Line 2631 + 0×12 bytes C++
WebKit.dll!WebCore::Node::dispatchMouseEvent(const WTF::AtomicString & eventType={…}, int button=0, int detail=1, int pageX=435, int pageY=73, int screenX=531, int screenY=178, bool ctrlKey=false, bool altKey=false, bool shiftKey=false, bool metaKey=false, bool isSimulated=false, WebCore::Node * relatedTargetArg=0×00000000, WTF::PassRefPtr<WebCore::Event> underlyingEvent={…})  Line 2924 C++
WebKit.dll!WebCore::Node::dispatchMouseEvent(const WebCore::PlatformMouseEvent & event={…}, const WTF::AtomicString & eventType={…}, int detail=1, WebCore::Node * relatedTarget=0×00000000)  Line 2833 C++
WebKit.dll!WebCore::EventHandler::dispatchMouseEvent(const WTF::AtomicString & eventType={…}, WebCore::Node * targetNode=0x03ee9b48, bool __formal=true, int clickCount=1, const WebCore::PlatformMouseEvent & mouseEvent={…}, bool setUnder=true)  Line 1845 + 0×23 bytes C++
WebKit.dll!WebCore::EventHandler::handleMouseReleaseEvent(const WebCore::PlatformMouseEvent & mouseEvent={…})  Line 1573 + 0x2f bytes C++
WebKit.dll!WebView::handleMouseEvent(unsigned int message=514, unsigned int wParam=0, long lParam=4784563)  Line 1402 C++
WebKit.dll!WebView::WebViewWndProc(HWND__ * hWnd=0x000d02da, unsigned int message=514, unsigned int wParam=0, long lParam=4784563)  Line 2052 + 0×14 bytes C++
user32.dll!77d18734()
[Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]
user32.dll!77d18816()
user32.dll!77d189cd()
user32.dll!77d191f1()
user32.dll!77d18a10()
WinLauncher_debug.exe!wWinMain(HINSTANCE__ * hInstance=0×00400000, HINSTANCE__ * hPrevInstance=0×00000000, wchar_t * lpCmdLine=0x00020b14, int nCmdShow=1)  Line 241 + 0×10 bytes C++
Tagged with: