wiki:BuildingQtOnLinux

Version 11 (modified by treat@kde.org, 18 years ago) ( diff )

add heading

Building the Qt port on Linux

These instructions apply to Linux in general with source packages, Ubuntu Linux 6.10 (Edgy Eft) and Ark Linux.

Dependencies

The code should be easily built on any Linux distribution which has development packages for Qt installed.

The Qt port requires Qt version 4.3 or later.

The Qt port requires gperf.

The Qt port requires sqllite.

The Qt port requires bison.

The Qt port requires flex.

The Qt port requires libxslt.

Build WebKit

You'll then need to check out the source code from Subversion. The Qt port is part of the WebKit source tree, so you don't need anything extra.

Finally, set the QTDIR environment variable to Qt 4.x's installation path (/usr/lib/qt4 on Ark Linux, /usr/share/qt4 on *Ubuntu), and make sure Qt 4.x's qmake is the first qmake in your PATH (typically by running export PATH=$QTDIR/bin:$PATH).

Build WebKit and the Qt test browser with

WebKit/WebKitTools/Scripts/build-webkit

Testing the port

A very simple test browser is built at WebKit/WebKitBuild/Release/WebKitQt/QtLauncher/QtLauncher.

Common Build Errors

Using Qt 4.2 not required minimum version or later

../../../WebKitQt/Api/qwebnetworkinterface_p.h:134: error: ‘QSslError’ 
was not declared in this scope
../../../WebKitQt/Api/qwebnetworkinterface_p.h:134: error: template 
argument 1 is invalid
../../../WebKitQt/Api/qwebnetworkinterface_p.h:135: error: 
‘QAuthenticator’ has not been declared
../../../WebKitQt/Api/qwebnetworkinterface_p.h:136: error: expected ‘,’ 
or ‘...’ before ‘&’ token
../../../WebKitQt/Api/qwebnetworkinterface_p.h:136: error: ISO C++ 
forbids declaration of ‘QNetworkProxy’ with no type
make[1]: *** [tmp/ResourceHandleQt.o] Error 1

This error is caused by not having the minimum version of Qt installed. Install the minimum version of Qt, set the 'QTDIR' environment variable pointing to this version and try building WebKit again.

Missing gperf

../../../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

This error is typically caused by not having gperf installed. Install gperf, run touch WebCore/html/DocTypeStrings.gperf and try building WebKit again.

Missing SQLite development package

../../../WebCore/loader/icon/SQLDatabase.cpp:30:21: error: sqlite3.h: No such file or directory
../../../WebCore/loader/icon/SQLDatabase.cpp:36: error: "SQLITE_ERROR" was not declared in this scope
../../../WebCore/loader/icon/SQLDatabase.cpp:37: error: "SQLITE_DONE" was not declared in this scope
../../../WebCore/loader/icon/SQLDatabase.cpp:38: error: "SQLITE_OK" was not declared in this scope
../../../WebCore/loader/icon/SQLDatabase.cpp:39: error: "SQLITE_ROW" was not declared in this scope

This error is typically caused by not having the development component of libsqlite3 installed. Install the development package and try building WebKit again.

Missing flex

.../WebKitBuild/Release/lib/libWebKitQt.so: undefined reference to `WebCore::CSSParser::lex()'

This error is typically caused by not having flex installed. Install flex, run touch WebCore/css/tokenizer.flex and try building WebKit again.

Incompatible version of bison

bison -d -p kjsyy JavaScriptCore/kjs/grammar.y -o grammar.tab.c && mv grammar.tab.c tmp/grammar.cpp && mv grammar.tab.h tmp/grammar.h
JavaScriptCore/kjs/grammar.y:364.3-366.9: type clash (`node' `') on default action
JavaScriptCore/kjs/grammar.y:366.10: parse error, unexpected ":", expecting ";" or "|"

This error is caused by having an incompatible version of bison installed. The single reported case of this error occurred with bison 1.75, and was resolved by updating to bison 2.3.

GCC 4.2 incompatibility

../../../WebCore/rendering/RenderTable.cpp: In member function 'int
WebCore::RenderTable::calcBorderLeft() const':
../../../WebCore/rendering/RenderTable.cpp:722: error: no matching function for
call to 'max(unsigned int&, const short unsigned int:12&)'
../../../WebCore/rendering/RenderTable.cpp:735: error: no matching function for
call to 'max(unsigned int&, const short unsigned int:12&)'
../../../WebCore/rendering/RenderTable.cpp:749: error: no matching function for
call to 'max(unsigned int&, const short unsigned int:12&)'
../../../WebCore/rendering/RenderTable.cpp:751: error: no matching function for
call to 'max(unsigned int&, const short unsigned int:12&)'
../../../WebCore/rendering/RenderTable.cpp: In member function 'int
WebCore::RenderTable::calcBorderRight() const':
../../../WebCore/rendering/RenderTable.cpp:781: error: no matching function for
call to 'max(unsigned int&, const short unsigned int:12&)'
../../../WebCore/rendering/RenderTable.cpp:794: error: no matching function for
call to 'max(unsigned int&, const short unsigned int:12&)'
../../../WebCore/rendering/RenderTable.cpp:808: error: no matching function for
call to 'max(unsigned int&, const short unsigned int:12&)'
../../../WebCore/rendering/RenderTable.cpp:810: error: no matching function for
call to 'max(unsigned int&, const short unsigned int:12&)'
make[1]: *** [tmp/RenderTable.o] Error 1

Apply the patch attached to bug report http://bugs.webkit.org/show_bug.cgi?id=13985

Dependencies for specific Linux distributions

Installing dependencies on Ubuntu Edgy

To install required dependencies on Ubuntu edgy, do

sudo aptitude install libqt4-dev

or install the libqt4-dev package from Synaptic.

You might also need to install gperf, libxslt1-dev, and bison to resolve some dependencies.

sudo aptitude install gperf libxslt-dev bison flex

Installing dependencies on Ark Linux

On Ark Linux, install the required dependencies using

apt-get install devel-core qt4-devel qmake gperf libxslt-devel bison sqlite-devel

Alternatively, install the needed packages (see list above) through Mission Control -> Install Software.

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.