WebKit browser on Linux

Update: the trivial WebKit browser is now included in Ubuntu. Simply install libwebkitgdk0d on Ubuntu gutsy (just click the package name there to install it if you’re running gutsy now) and then run /usr/lib/WebKit/GdkLauncher to get a simple WebKit browser for testing your code.

You too can test WebKit, Apple’s web rendering engine and the thing that makes Safari work, on Linux. The KDE teams have been working hard on making it work inside Qt, the KDE widget set, and indeed it does work! A few simple steps are required.

First, check out the WebKit source code. There is loads of it, so this will take a while. You’ll need Subversion for this.

svn checkout http://svn.webkit.org/repository/webkit/trunk WebKit

That will give you a folder called WebKit. You’ll now need a few requirements; the key one is Qt4. On Ubuntu 6.10 (edgy), get this like so:

sudo aptitude install libqt4-dev

Now build your Qt-based WebKit browser:

QTDIR=/usr/share/qt4/ WebKit/WebKitTools/Scripts/build-webkit

Finally, run it:

WebKit/WebKitBuild/Release/WebKitQt/QtLauncher/QtLauncher about:blank

I created a menu entry to run it (right-click on the Applications menu, say “Edit Menus”). Now I can test stuff in WebKit!

Note that the Subversion version of WebKit is miiiiiiiiles ahead of what Safari is using in released versions of Mac OS X, so don’t think that just because something works in your little WebKit browser it’ll work in Safari. Nonetheless, cool.

21 Responses to “WebKit browser on Linux”

  1. Is the javascript handling code included in the WebKit? Or, Can I test my JavaScript apps using this?

    Binny V A
  2. Binny V A: yep. I used it to test the recent sorttable release.

    sil
  3. The javascript engine in WebKit is afaik not the same that’s in safari, at least not when you build against Qt for some reason. Or so a trolltech guy told me, at least… :/

    Anonymous
  4. [...] Concretamente, Kryogenix da instrucciones de como instalarlo (por medio de virtualización me temo) en Ubuntu 6.10. [...]

    Probar un navegador WebKit en Linux | La brujula verde
  5. Navegador Webkit en Linux…

    Parece que ya es posible correr un navegador Webkit en Linux. Instrucciones para Ubuntu 6.10. Vía: http://www.labrujulaverde.com/2007/04/10/probar-un-navegador-webkit-en-linux/...

    meneame.net
  6. Thanks for posting your findings! svn checkout went fine, but I’ve run into an error after running

    QTDIR=/usr/share/qt4/ WebKit/WebKitTools/Scripts/build-webkit

    I’ll get an error:

    ———————————

    ***Unknown option -r
    Usage: qmake [mode] [options] [files]

    Failed to setup build environment using qmake!

    ———————————

    Do you have any suggestions? Thanks in advance!

    Jon
  7. Jon: I had that problem. I suspect that you have the qmake from Qt 3, and you need the one from Qt 4.

    sil
  8. That was it, thank you very much. As I went to build the browser, however, I ran into another problem. Maybe you can help?

    ../../../WebCore/html/HTMLDocument.cpp: In member function ‘virtual void WebCore::HTMLDocument::determineParseMode(const WebCore::String&)’:
    ../../../WebCore/html/HTMLDocument.cpp:389: error: expected initializer before ‘*’ token
    ../../../WebCore/html/HTMLDocument.cpp:390: error: ‘doctypeEntry’ was not declared in this scope
    ../../../WebCore/html/HTMLDocument.cpp:398: error: ‘doctypeEntry’ was not declared in this scope
    ../../../WebCore/html/HTMLDocument.cpp:401: error: ‘PubIDInfo’ has not been declared
    ../../../WebCore/html/HTMLDocument.cpp:405: error: ‘PubIDInfo’ has not been declared
    ../../../WebCore/html/HTMLDocument.cpp:409: error: ‘PubIDInfo’ has not been declared
    make[1]: *** [tmp/HTMLDocument.o] Error 1
    make[1]: Leaving directory `/home/jon/WebKit/WebKitBuild/Release/WebCore’
    make: *** [sub-WebCore-make_default-ordered] Error 2

    I’m really not sure what step to take next.

    Jon
  9. Jon: don’t know about that, I’m afraid. I’d suggest asking on IRC, on #webkit on irc.freenode.net.

    sil
  10. Okay thanks a lot anyways — I’ll check into it.

    Jon
  11. [...] Via: link [...]

    nulleando.com.ar » El engine de safari en linux
  12. I am getting the same XX has not been declared error. What commit id were things at when you built it successfully? I’ll be happy to rewind my SVN checkout to that revision number to get things to build.

    (In other words, the tree seems to be broken currently :-( — is the webkit team using something like tinderbox to check their builds? )

    martin langhoff
  13. martin: 
    aquarius@giles:~/code/webkit/WebKit$ svn info
    Path: .
    URL: http://svn.webkit.org/repository/webkit/trunk
    Repository Root: http://svn.webkit.org/repository/webkit
    Repository UUID: 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    Revision: 20788
    Node Kind: directory
    Schedule: normal
    Last Changed Author: bdash
    Last Changed Rev: 20788
    Last Changed Date: 2007-04-08 11:15:16 +0100 (Sun, 08 Apr 2007)
    Properties Last Updated: 2007-04-08 03:59:28 +0100 (Sun, 08 Apr 2007)
    
    sil
  14. i found i had to add the gperf table into HTMLDocument.cpp

    gperf -CEot -L ANSI-C -k “*” -N findDoctypeEntry -F ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards > WebCore/html/HTMLDocument.cpp

    end then edit the file by hand to move the gperf-generated table to a point prior to the first reference to it.

    i also applied this patch to fix a problem with the wrong qmake being called:

    Index: WebKitTools/Scripts/webkitdirs.pm
    ===================================================================
    — WebKitTools/Scripts/webkitdirs.pm (revision 23560)
    +++ WebKitTools/Scripts/webkitdirs.pm (working copy)
    @@ -487,7 +487,8 @@
    system “mkdir -p ” . baseProductDir() . “/$config”;
    chdir baseProductDir() . “/$config” or die “Failed to cd into ” . baseProductDir() . “/$config \n”;

    - my $result = system “qmake”, @buildArgs;
    + my $result = system “qmake-qt4″, @buildArgs;
    + $result = system “qmake”, @buildArgs if ($result ne 0);
    if($result ne 0) {
    die “Failed to setup build environment using qmake!\n”;
    }

    bsittler
  15. When I tried to do this I got: ERROR: flex, bison, gperf missing but required to build WebKit.
    So I searched and installed the required libraries and then executed again the build line:
    sudo apt-get install flex gperf bison

    movil
  16. [...] Los pasos para crearlo (via kryogenix y no traduzco esta parte a menos que alguien lo pida expresamente) [...]

    » Safari y otros navegadores en Linux
  17. If you have the problem of qmake v3 called instead of qmake v4 (***Unknown option -r), you can add this option to the command line:
    –qmake=qmake-qt4
    for example:
    QTDIR=/usr/share/qt4/ WebKit/WebKitTools/Scripts/build-webkit –qmake=qmake-qt4

    frasten
  18. [...] Font: WebKit browser on Linux [...]

    Message in a bottle…. » Navegador Webkit en linux
  19. I recently started a project called Arora which is a browser using QtWebKit. It provides a lot more then the QtLauncher does and can build against WebKit trunk or the already released Qt 4.4 packages. It is already good enough for most of my daily browsing and even writing this comment.

    Benjamin Meyer
  20. Hmm, looks like the link didn’t work. http://arora-browser.org/

    Benjamin Meyer
  21. Hey, thanks for this post! I’ve followed it and it worked perfectly in my Gentoo/Linux.

    Denilson

Leave a Reply

OpenID is a decentralised authentication system. If you use LiveJournal or Vox you already have an OpenID; just use the URL of your homepage there. See also how to get yourself an OpenID.