LLQtWebKit Mac OSX Build Instructions

From Second Life Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Introduction

These are instructions for building the Qt/WebKit library (LLQtWebKit) on Mac OS X as well as the test applications (testGL and uBrowser). They have been tested using XCode 3.2.1 on Mac OS X 10.6.2.

Set up

Create a directory you'll use for the build. This can be anywhere you like, but for the purposes of the example I'll use ~/llqtwebkit.

Acquire LLQtWebKit source code

  • In a Web browser, navigate to http://bitbucket.org/lindenlab/llqtwebkit/
  • Select "get source->zip" from menu
  • A zip file of the source code will be downloaded
  • Extract the files in the zip into ~/llqtwebkit (this should create the directory ~/llqtwebkit/llqtwebkit

Build the open source version of Qt using XCode

Acquire the Qt 4.6 source with our patches

  • Our clone of Qt is available here: http://gitorious.org/+lindenqt/qt/lindenqt
  • Download the source by clicking on the "lindenqt" branch under "Branches" and then using the "download as tar.gz" link on the right hand side of the page
    • Alternately, if you prefer you can clone the repository with git using the "clone" link on the page -- details of this are left as an exercise to the reader
  • Extract the tarball into ~/llqtwebkit
  • This may take some as the archive contains a lot of files
  • You should now have a directory ~/llqtwebkit/qt-lindenqt
  • Open a terminal window and cd to ~/llqtwebkit/qt-lindenqt directory
  • run the following commands (we'll use the QTDIR variable in later steps)
export QTDIR=`pwd`
export PATH=$QTDIR/bin:$PATH

Configure Qt

  • In the terminal window, make sure you're still in the directory ~/llqtwebkit/qt-lindenqt
  • Run the following command:
./configure -platform macx-g++40 -no-framework -fast -no-qt3support -prefix $PWD -static -release -no-xmlpatterns -no-phonon -universal -sdk /Developer/SDKs/MacOSX10.4u.sdk/ -nomake examples -nomake demos -nomake docs -nomake translations
  • When you are asked if you want to use the Commercial or Open Source version type o to select Open Source and press <enter>
  • When the license agreement appears, if you agree type yes <enter>
  • This operation takes around 10-15 minutes on a typical development system

Note: you can also add -opensource -confirm-license to automatically select and accept the LGPL.

Build Qt

  • In the terminal window, make sure you're still in the directory ~/llqtwebkit/qt-lindenqt
  • Run this command:
make
  • If you're on a multicore machine, you can speed up the build substantially by using the '-j' argument to make, which will cause it to build files in parallel. For example, on a 4-core system, I use:
make -j4
  • This takes a little over an hour on a 4-core Mac Pro.
  • After building Qt the built libraries will be in ~/llqtwebkit/qt-lindenqt/lib
  • For me, the full build fails with "duplicate symbol _sqlite3_status", but at that point it has already built most of what we need.
  • The one additional piece we need is the JavaScriptCore library in Webkit. To build that do the following:
cd $QTDIR/src/3rdparty/webkit/JavaScriptCore
make

Build LLQtWebKit

  • In the terminal window, change to the directory ~/llqtwebkit/llqtwebkit
  • Create a symlink to QTDIR in this directory (this allows the Xcode project to find it easily):
ln -s $QTDIR QTDIR
  • Open the llqtwebkit.xcodeproj project with Xcode
  • Build the "Release" configuration of the "llqtwebkit" target
  • The output of the build is ~/llqtwebkit/llqtwebkit/build/Release/libllqtwebkit.dylib
    • to build the Second Life viewer, this library needs to be copied to {VIEWERSRC}/libraries/universal-darwin/lib_release/ and llqtwebkit.h needs to go in {VIEWERSRC}/libraries/include/

Optional: build testgl

testgl is a simple example that uses the OpenGL GLUT toolkit to open a window, and renders web pages to an OpenGL texture using llqtwebkit.

  • First, build the llqtwebkit library as described above
  • In Terminal, go into the tests/testgl/ directory
  • Create a symlink to your built version of the llqtwebkit library:
ln -s ../../build/Release/libllqtwebkit.dylib
  • run the following commands:
qmake
make
  • this should create a 'testgl' binary, which you can run from the terminal window like so:
./testgl

Optional: build ubrowser

ubrowser is a more complex example that uses the GLUI toolkit to render web pages to OpenGL textures and apply them to various 3d models.

  • First, build the llqtwebkit library as described above
  • Open the Xcode project at tests/ubrowser/ubrowser.xcodeproj
  • Build and run using the Xcode UI