Difference between revisions of "LLQtWebKit Win32 Build Instructions"

From Second Life Wiki
Jump to navigation Jump to search
Line 60: Line 60:
  <code>nmake sub-src</code>
  <code>nmake sub-src</code>
* This operation takes around 1-2 hours on a typical development system
* This operation takes around 1-2 hours on a typical development system
* After building Qt the release and debug libraries will be in <code>C:\Qt\qt-all-opensource-src-4.5.2\lib</code>
* After building Qt the release and debug libraries and dlls will be in <code>C:\Qt\qt-all-opensource-src-4.5.2\lib</code>


=== Configure a Qt runtime environment ===
=== Configure a Qt runtime environment ===

Revision as of 13:31, 22 October 2009

<<< 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). They have been tested using Microsoft Visual Studio 2005 (SP2) on Windows XP Service Pack 2 and Qt 4.5.2. It is not known if the same instructions work on Windows Vista or Windows 7 or using other versions of Microsoft Visual Studio or Qt.

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 tools have different concepts of "contents" - you should end up with the directories and files in C:\llqtwebkit and not C:\llqtwebkit\llqtwebkit
  • Do not build anything yet - some of the files that were just downloaded will be used to modify the OpenSSL and Qt source code

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.8k tarball from http://openssl.org/source/openssl-0.9.8k.tar.gz
  • Extract the contents to C:\openssl-0.9.8k
    • Note: Different tools have different concepts of "contents" - you should end up with the directories and files in C:\openssl-0.9.8k and not C:\openssl-0.9.8k\openssl-0.9.8k
  • Open the "Visual Studio 2005 Command Prompt" (Start Menu->Microsoft Visual Studio 2005->Visual Studio Tools->Visual Studio 2005 Command Prompt)
  • Patch the OpenSSL distribution - the line endings are broken out of the box on Windows.
    • Copy the OpenSSL patch files from the LLQtWebKit\other_patches directory into the C:\openssl-0.9.8k directory.
    • Open a command prompt and change to the C:\openssl-0.9.8k directory
    • Run this command:
      • patch -p1 < 010-openssl-fix-line-endings.patch
  • In the same directory, execute the following commands to build OpenSSL:
    • perl Configure VC-WIN32
    • ms\do_masm
  • Patch the ntdll.mak file generated by the previous steps using
    • 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.8k\out32dll directory - confirm they exist - they will be needed later.

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

Downloading and patching the Qt source

  • Download the Qt 4.5.2 source from ftp://ftp.qtsoftware.com/qt/source/qt-all-opensource-src-4.5.2.tar.gz (Approximately 125MB)
  • Extract the contents of the tarball into C:\Qt
  • 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\qt-all-opensource-src-4.5.2 and not C:\Qt\qt-all-opensource-src-4.5.2\qt-all-opensource-src-4.5.2
    • Note: using Cygwin's tar command might not work. It results in an Access is Denied error when running configure below. Use WinZip or some other tool instead.).
  • Copy the .patch files that are required from the C:\llqtwebkit\qt_patches\ to the C:\Qt\qt-all-opensource-src-4.5.2 directory
  • If you do not have an MSVC command prompt open, open one now. (Start Menu->Microsoft Visual Studio 2005->Visual Studio Tools->Visual Studio 2005 Command Prompt)
  • Change to the C:\Qt\qt-all-opensource-src-4.5.2 directory
  • Apply the patches in the order indicated by the number in the filename - 002, 007, 008 etc.
  • For each .patch file, run the following command:
patch -p1 < $PATCH_NAME
  • where $PATCH_NAME is the filename of the patch file

Configure Qt

  • Change to the C:\Qt\qt-all-opensource-src-4.5.2 directory
  • Run this command:
configure -debug-and-release -no-qt3support -prefix C:\Qt\qt-all-opensource-src-4.5.2 -qt-libjpeg -qt-libpng -openssl-linked -I C:\openssl-0.9.8k\include -L C:\openssl-0.9.8k\out32dll
  • 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 y <enter>
  • This operation takes around 10-15 minutes on a typical development system

Build Qt

  • Change to the C:\Qt\qt-all-opensource-src-4.5.2 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\qt-all-opensource-src-4.5.2\lib

Configure a Qt runtime environment

  • Copy the OpenSSL dynamic libraries (C:\openssl-0.9.8k\out32dll\libeay32.dll and C:\openssl-0.9.8k\out32dll\ssleay32.dll) to the Qt binary directory (C:\qt\qt-all-opensource-src-4.5.2\bin)
  • Create the file C:\Qt\qt-all-opensource-src-4.5.2\bin\qt-vars.bat and put the following in it:
@echo off
echo Setting up a Qt environment...
set QTDIR=C:\Qt\qt-all-opensource-src-4.5.2
set PATH=C:\Qt\qt-all-opensource-src-4.5.2\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\qt-all-opensource-src-4.5.2\bin\qt-vars.bat"
Start in: C:\Qt\qt-all-opensource-src-4.5.2
  • Rename the shortcut to "Qt 4.5.2 Command Prompt".
  • Test it by opening the prompt and typing
qmake --version
  • Confirm that the Qt version displayed is 4.5.2


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

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