Thursday, December 27, 2012

Debugging Webkit made easy!!!

Webkit debugging setup when i started i found that you need to go through different blogs, do lot of googling to find solution to problem you are facing.I thought of making note of the steps 
i followed to setup. This procedure i followed on Windows XP, if you are using different OS and also using Visual Studio Express version it may slightly differ or you might face different problems apart from mentioned below.In the References section i have mentioned the links which might help you if you are setting up on Windows 7 etc.

Basically ,I have tried to put up the things mentioned in proper order and also mentioned the problems i faced during setup & their solution.

Setup Required:

1.Visual Studio 2005
2. Microsoft Visual Studio 2005 Team Suite Service Pack 1
3. Visual Studio 2005 Service Pack 1 ATL Security Update


4. Cygwin:

Note: Run cygwin-downloader.exe and see that installation goes fine.If cygwin not installed properly, then
chances of getting errors are more while building webkit.

5. QuickTime SDK  
6. DirectX SDK

7. Download from

Install the above software's preferably in C: Drive.

Next step is to getting the source code:

Webkit source can be picked from , i suggest you to take the stable nightly build  
3-4 days old or do googling  before choosing any latest source.
It will help you to solve errors while building, you can get support from people who already built.

File will be with extn .tar.bz2 e.g: WebKit-r130591.tar.bz2 

You need to untar using command: tar xvjf <filename>

Now create a "WebKit"folder is not present , in C:\cygwin\home\<username>.
Please the extracted source code in the WebKit folder and place the folder
in WebKit folder

Go to Cygwin prompt and Run WebKit/Tools/Scripts/update-webkit script to extract the libraries from

Once you run the update command, it will update the to ..\WebKitLibraries\win folder.
Even after running this command,it is not properly updated. So, while building WebKit i merged few files from extracted to WebKitLibraries\win folder to resolve some errors.

Also you need to make sure that environment variables WEBKITLIBRARIESDIR and WEBKITOUTPUTDIR are added.

If not,you can manually add: 

WEBKITLIBRARIESDIR  : C:\cygwin\home\<yourname>\WebKit\WebKitLibraries\win
WEBKITOUTPUTDIR  : C:\cygwin\home\<yourname>\WebKit\WebKitBuild

Debugging in Visual Studio:

Open webkit.sln , you can find ..\WebKit\Source\WebKit\win\WebKit.vcproj folder.

Make sure to select debug instead debug_all

Select WebKitLauncherWin as startup project.

Build the solution.

Common errors you may encounter while building WebKit:

1.File not found errors:
Unzip and  merge the differences to WebKit/webkitlibaries folder in case you get errors related to files missing as mentioned already.
copy the file to the expected path from the location where it is present in the code already.

2. cmd.exe errors:
     Project : error PRJ0002 : Error result 1 returned from 'C:\WINDOWS\system32\cmd.exe'.
Please check if previously some error is present.Otherwise build the solution again.
Worst case:
Need to take the code again and build it.

3. Debugging information cannot be found:
Error:" Debugging information for 'Safari.exe' cannot be found or does not match. No symbols loaded."
Do the settings as per below link:

After solving errors, now the time to debug.:)
Start debugging (F5) setting WebKitLauncherWin as startup project.
Since Webkit2 runs in UI process and web process.we need to attach webkit2webprocess.exe from Debug->Attach to process after safari browser is launched..

Of course, launching safari browser takes little time and you need to wait.. and after that you can attach webkit2webprocess.

Checkout the below links if in case you face any problem during this setup.


You can drop me mail to for any queries or just leave your comment.

No comments:

Post a Comment