LLQtWebKit Win32 Build Instructions

From Second Life Wiki
Jump to navigation Jump to search

<<< Back to LLQtWebKit main page

Introduction

These are instructions for building the Qt/WebKit library (LLQtWebKit) on Windows as well as the test applications (testGL, uBrowser, QtTestApp, Win32GL). They have been tested using Microsoft Visual Studio 2005 (SP2) on Windows XP Service Pack 3 and Qt 4.6.0. It is not known if the same instructions work using other versions of Windows, Microsoft Visual Studio or Qt.

Set up

  • For clarity, these instructions contain references to example paths and directories. Except where noted, you may replace these with ones of your own choosing although it is generally advisable to choose ones without spaces in them.

Acquire LLQtWebKit source code

  • In a Web browser, navigate to http://hg.secondlife.com/llqtwebkit/
  • Select "get source->zip" from menu
  • A zip file of the source code will be downloaded
  • Extract the contents of the zip file to C:\llqtwebkit
    • Note: Different archiving tools have different concepts of "contents" - you should end up with the directories and files in C:\llqtwebkit and not C:\llqtwebkit\llqtwebkit

Build the open source OpenSSL library

  • Make sure a recent version of 'perl' and 'patch' are available on your system.
  • Download the OpenSSL 0.9.8l tarball from http://openssl.org/source/openssl-0.9.8l.tar.gz
  • Extract the contents to C:\openssl-0.9.8l
    • Note: Different archive tools have different concepts of "contents" - you should end up with the directories and files in C:\openssl-0.9.8l and not C:\openssl-0.9.8l\openssl-0.9.8l
    • Note: Some archive tools (notably 7-Zip) appear to have issues extracting the files correctly - make sure the header files in the C:\openssl-0.9.8l\include\openssl directory are not zero length before proceeding.
  • Open the "Visual Studio 2005 Command Prompt" (Start Menu->Microsoft Visual Studio 2005->Visual Studio Tools->Visual Studio 2005 Command Prompt)
  • Change to the C:\openssl-0.9.8l directory
  • Run these commands:
    • perl Configure VC-WIN32
    • ms\do_masm
  • Patch the ntdll.mak file generated by the previous steps (this fixes the DLL manifest settings so that they are compatible with the Second Life client build configuration)
    • Copy the patch file 020-openssl-disable-manifest.patch from the C:\llqtwebkit-4.6\patches to C:\openssl-0.9.8l
    • Run this command:
      • patch -p1 < 020-openssl-disable-manifest.patch
  • Continue to build
    • nmake -f ms\ntdll.mak
  • After a few minutes, the libraries libeay32.dll and ssleay32.dll will be built in the C:\openssl-0.9.8l\out32dll directory - confirm they exist - they will be needed later.

Build the open source version of Qt 4.6.0 using Microsoft Visual Studio

Acquire the Qt 4.6.0 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 lindenqt as tar.gz" link on the right hand side of the page
    • It's a large download - over 100MB - so it may take some time
    • 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 contents of the tarball into C:\qt-lindenqt
  • This may take some as the archive contains a lot of files
    • Note: Different tools have different concepts of "contents" - you should end up with the directories and files in C:\qt-lindenqt and not C:\qt-lindenqt\qt-lindenqt
    • Note: using Cygwin's tar command might not work. It may result in an Access is Denied error when running configure below. If so, try using WinZip, WinRAR or some other tool instead.

Configure Qt build system to disable manifests

  • Windows manifest files are not required for Qt builds used in the Second Life client.
  • Inspect the C:\qt-lindenqt\mkspecs\win32-msvc2005\qmake.conf file and check that the CONFIG entry does not include an embed_manifest_dll entry
  • Inspect the C:\qt-lindenqt\mkspecs\win32-msvc2005\qmake.conf file and check that the QMAKE_LFLAGS line contains a /MANIFEST:NO directive.

Configure Qt

  • If it's not open already, open the "Visual Studio 2005 Command Prompt" (Start Menu->Microsoft Visual Studio 2005->Visual Studio Tools->Visual Studio 2005 Command Prompt)
  • Change to the C:\qt-lindenqt directory
  • Run this command:
configure -debug-and-release -no-qt3support -no-phonon -no-phonon-backend -prefix C:\qt-lindenqt -qt-libjpeg -qt-libpng -openssl-linked -I C:\openssl-0.9.8l\include -L C:\openssl-0.9.8l\out32dll
  • When you are asked if you want to use the Commercial or Open Source version type o to select Open Source and press the Enter key
  • When the license agreement appears, if you agree type y the Enter key
  • This operation takes around 10-15 minutes on a typical development system

Build Qt

  • Change to the C:\qt-lindenqt directory
  • Run this command:
nmake sub-src
  • This operation takes around 1-2 hours on a typical development system
  • After building Qt, the release and debug libraries and dlls will be in C:\qt-lindenqt\lib

Configure a Qt runtime environment

  • Copy the OpenSSL dynamic libraries (C:\openssl-0.9.8l\out32dll\libeay32.dll and C:\openssl-0.9.8l\out32dll\ssleay32.dll) to the Qt binary directory (C:\qt-lindenqt\bin)
  • Create the file C:\qt-lindenqt\bin\qt-vars.bat and put the following in it:
@echo off
echo Setting up a Qt environment...
set QTDIR=C:\qt-lindenqt
set PATH=C:\qt-lindenqt\bin;%PATH%
set QMAKESPEC=win32-msvc2005
call "C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat"
  • Make a shortcut to qt-vars.bat on your desktop
  • Right-click on the shortcut and set the following properties:
Target: %COMSPEC% /k "C:\qt-lindenqt\bin\qt-vars.bat"
Start in: C:\qt-lindenqt
  • Rename the shortcut to "Qt Linden Command Prompt".
  • Test it by opening the prompt and typing
qmake --version
  • Confirm that the Qt version displayed is 4.6.0

Build LLQtWebKit

  • Launch the Qt command prompt and enter the following in the command prompt:
cd C:\llqtwebkit
qmake CONFIG-=debug
nmake
  • This operation takes just a few seconds on a typical development system
  • If you want to build the debug version of LLQtWebKit, use qmake CONFIG+=debug instead
  • Now LLQtWebKit is built and can be used in the Second Life viewer.
  • If you want to build the test applications, follow the next steps:

Acquire test application dependencies

Glut

  • Glut is a cross-platform library that manages OpenGL state and creation/destruction of OpenGL windows
  • The author provides a library and header for Windows so you do not have to build them yourself
  • Download the library and headers from http://www.xmission.com/~nate/glut/glut-3.7.6-bin.zip
  • Extract the contents of the zip to a new folder called C:\llqtwebkit\tests\GL

GLUI

  • Glut is a cross-platform library that renders UI components in the uBrowser test application
  • The author does not provide libraries for Windows so you have to build them yourself.
  • Download the source code from http://sourceforge.net/projects/glui/files/Source/2.36/glui-2.36.zip/download
  • Extract to C:\glui-2.36
  • Copy glut.h from C:\llqtwebkit\tests\GL to C:\glui-2.36\src\include\GL as it is required to build GLUI
  • Open C:\glui-2.36\src\msvc\glui.sln and let Visual Studio convert the project
  • Select "Release" configuration of "_glui library" project and build it as normal
  • Copy the GLUI header (C:\glui-2.36\src\include\GL\glui.h) to C:\llqtwebkit\tests\GL
  • Copy the GLUI library you just built (C:\glui-2.36\src\msvc\lib\glui32.lib) to C:\llqtwebkit\tests\GL

Build test applications

testGL

  • Open the Qt command prompt using the shortcut you made and enter the following:
cd C:\llqtwebkit\tests\testgl
qmake CONFIG-=debug
nmake
..\GL\testgl.exe
  • If you want to build the debug version, use qmake CONFIG+=debug instead and run nmake clean first

uBrowser

  • Open the Qt command prompt using the shortcut you made and enter the following:
cd C:\llqtwebkit\tests\ubrowser
qmake CONFIG-=debug
nmake
..\GL\ubrowser.exe
  • Important: glui.h contains a pragma that forces the build to always link against the release version - glut32.lib - instead of the debug version. This means building a debug version of uBrowser is currently broken.

QtTestApp

  • Open the Qt command prompt using the shortcut you made and enter the following:
cd C:\llqtwebkit\tests\qttestapp
qmake CONFIG-=debug
nmake
..\GL\qttestapp.exe
  • If you want to build the debug version, use qmake CONFIG+=debug instead and run nmake clean first

Win32GL

  • Edit the path variables at the top of the C:\llqtwebkit\tests\win32gl\copy_files.bat directory to reflect the location of your OpenSSL, Qt and LLQtWebKit files.
  • Run the C:\llqtwebkit\tests\win32gl\copy_files.bat
  • Open the C:\llqtwebkit\tests\win32gl\win32gl.sln MSVC solution file
  • Select Release configuration
  • Update home_url in win32gl.cpp with the correct path to your testpage
  • Build and run as normal

Win32 Helper batch files

  • There are some helper batch files for Windows developers that may prove useful.
  • You will very likely need to configure settings at the top of each one to match the location of the files and directories on your system.
  • They do not do much error checking so make sure you understand the ramifications of any changes you make.
  • A useful pattern is to edit them so they only do what you need at that moment - build release LLQtWebKit and testGL for example - then revert them when you're finished.

Build LLQtWebKit and test apps

  • Now you have built LLQtWebKit by hand, I'll point out this batch file which does it for you.
  • C:\llqtwebkit\make_all.bat is a very simple batch file that will clean and build release and debug versions of LLQtWebKit and then clean and build release version of the test apps (except Win32GL).
  • You will need to modify the GL_COMPONENT_DIR variable near the top that sets the location of the GLUT and GLUI build files.
  • You almost certainly will want to run this batch file from a Qt command prompt as described above since various Qt directories need to be in the path.

Generate a directory tree compatible with the Second Life client build system

  • C:\llqtwebkit\copy_llqtwebkit.bat is a batch file that:
    • Generates a directory tree containing LLQtWebKit header and libraries along with the necessary Qt run time files that are required by the Second Life client.
    • Builds a tar.bz2 archive and associated MD5 sum that can be used in the LLQtWebKit section of the Second Life client install.xml configuration file.

Notes

  • To enable a run time console for the test applications add a CONFIG+=console line to the qmake line.
  • Make sure all libraries and applications are built as Multi-threaded Dll or Multi-threaded debug dll. In Visual Studio this is in Properties->configuration->c/c++->code generation->runtime library
  • Make sure you do not mix release and debug versions of libraries and applications