wiki:BuildingQtOnOSX

Version 7 (modified by vestbo@webkit.org, 15 years ago) ( diff )

--

See Also:

These instructions assume you are building on an OSX system with Mac Ports installed having the qt4-mac (4.5.2) port installed.

Checkout the Code

You'll need to check out WebKit from SVN or Qt WebKit from Git

svn checkout http://svn.webkit.org/repository/webkit/trunk WebKit # WebKit SVN Trunk

OR

git clone git://gitorious.org/webkit/webkit.git # Git mirror

Building

Workaround #1 - for missing Qt Headers

This works around the problem with Qt headers being reference directly from /usr/include regardless of where the QTDIR is (Fixes "../../../WebKit/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h:26:17: error: QChar: No such file or directory" errors):

export QTDIR=/opt/local/libexec/qt4-mac # mac ports Qt
cd /usr/include
for q in $QTDIR/include/*; do if [ ! -e "`basename $q`" ]; then sudo ln -s "$q"; fi ; done # create a symlink

Workaround #2 - for flex tokenizer.cpp generation problem

Next start the build:

export WEBKITSRCDIR=qtwebkit # change this to 'WebKit' to build WebKit SVN Trunk
export WEBKITOUTPUTDIR=`pwd`/${WEBKITSRCDIR}-build 
${WEBKITSRCDIR}/WebKitTools/Scripts/build-webkit --qt --qmake=qmake-4.5 --makeargs="-j2" -spec macx-g++ --no-video --debug

The build will ultimately fail with an error message "Undefined symbols: "WebCore::CSSParser::lex()", referenced from: WebCore::CSSParser::lex(void*)in CSSParser.o" when it attempts to link the binaries, to fix that we run the flex make target by hand and copy the result into the build output drectory:

cd ${WEBKITSRCDIR}/WebCore
rm tokenizer.cpp 
WebCore=. make -f DerivedSources.make tokenizer.cpp
mv tokenizer.cpp ${WEBKITOUTPUTDIR}/Debug/WebCore/generated/debug/tokenizer.cpp
cd ${WEBKITSRCDIR}/..

Finish Up and Run

Rerunning the build should recompile CSSParser.cpp and link correctly.

${WEBKITSRCDIR}/WebKitTools/Scripts/build-webkit --qt --qmake=qmake-4.5 --makeargs="-j2" -spec macx-g++ --no-video --debug

Finally start the demo Qt browser:

${WEBKITSRCDIR}/WebKitTools/Scripts/run-launcher --qt --debug # After this, check the dock and you'll see an icon for a Qt console app ...
Note: See TracWiki for help on using the wiki.