Difference between revisions of "LLQtWebKit Win32 Build Instructions"

From Second Life Wiki
Jump to navigation Jump to search
m (Text replacement - "hg.secondlife.com" to "bitbucket.org/lindenlab")
 
(5 intermediate revisions by 2 users not shown)
Line 2: Line 2:


== Introduction ==
== 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.
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 7/64 and Qt 4.7.1. It is not known if the same instructions work using other versions of Windows, Microsoft Visual Studio or Qt.


== Set up ==
== Set up ==
Line 8: Line 8:


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


== Build the open source version of Qt 4.6.0 using Microsoft Visual Studio ==
== Build the open source version of Qt 4.7.1 using Microsoft Visual Studio ==
=== Acquire the Qt 4.6.0 source with our patches ===
=== Acquire the Qt 4.7.1 source code ===
* Our clone of Qt is available here: http://gitorious.org/+lindenqt/qt/lindenqt
* Download the source from here: http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.1.zip
* 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
* Extract the contents of the tarball into <code>C:\qt-4.7.1</code>
** 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 <code>C:\qt-lindenqt</code>
* This may take some as the archive contains a lot of files
* 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 <code>C:\qt-lindenqt</code> and not <code>C:\qt-lindenqt\qt-lindenqt</code>  
** Note: Different tools have different concepts of "contents" - you should end up with the directories and files in <code>C:\qt-4.7.1</code> and not <code>C:\qt-4.7.1\qt-4.7.1</code>  
** Note: using Cygwin's <code>tar</code> 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.
** Note: using Cygwin's <code>tar</code> 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 <code>C:\qt-4.7.1\mkspecs\win32-msvc2005\qmake.conf</code> file and check that the <code>CONFIG</code> entry does not include an <code>embed_manifest_dll</code> entry
* Inspect the <code>C:\qt-4.7.1\mkspecs\win32-msvc2005\qmake.conf</code> file and check that the <code>QMAKE_LFLAGS</code> line contains a <code>/MANIFEST:NO</code> directive.


=== Configure Qt ===
=== 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)
* 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 <code>C:\qt-lindenqt</code> directory  
* Change to the <code>C:\qt-4.7.1</code> directory  
* Run this command:  
* Run this command:  
  <code>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</code>
  <code>configure -opensource -fast -debug-and-release -no-qt3support -no-phonon -no-phonon-backend -prefix C:\qt-4.7.1 -qt-libjpeg -qt-libpng -openssl-linked -I C:\openssl-0.9.8q\include -L C:\openssl-0.9.8q\out32dll -opensource -nomake demos -nomake examples</code>
* When you are asked if you want to use the Commercial or Open Source version type <code>o</code> to select Open Source and press the Enter key
* When the license agreement appears, if you agree type <code>y</code> the Enter key
* When the license agreement appears, if you agree type <code>y</code> the Enter key
* This operation takes around 10-15 minutes on a typical development system
* This operation takes around 10-15 minutes on a typical development system


=== Build Qt ===
=== Build Qt ===
* Change to the <code>C:\qt-lindenqt</code> directory  
* Change to the <code>C:\qt-4.7.1</code> directory  
* Run this command:
* Run this command:
  <code>nmake sub-src</code>
  <code>nmake</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 and dlls will be in <code>C:\qt-lindenqt\lib</code>
* After building Qt, the release and debug libraries and dlls will be in <code>C:\qt-4.7.1\lib</code>


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


== Build LLQtWebKit ==
== Build LLQtWebKit ==
Line 143: Line 144:
* 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.
* 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.
* 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.
* A useful pattern is to edit them so they only do what you need at that moment - build release LLQtWebKit and release testGL for example - then revert them when you're finished.


=== Build LLQtWebKit and test apps ===
=== Build LLQtWebKit and test apps ===

Latest revision as of 09:13, 1 May 2015

<<< 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 7/64 and Qt 4.7.1. 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://bitbucket.org/lindenlab/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.8q tarball from http://openssl.org/source/openssl-0.9.8q.tar.gz
  • Extract the contents to C:\openssl-0.9.8q
    • Note: Different archive tools have different concepts of "contents" - you should end up with the directories and files in C:\openssl-0.9.8q and not C:\openssl-0.9.8q\openssl-0.9.8q
    • 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.8q\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.8q 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\patches to C:\openssl-0.9.8q
    • 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.8q\out32dll directory - confirm they exist - they will be needed later.

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

Acquire the Qt 4.7.1 source code

  • Download the source from here: http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.1.zip
  • Extract the contents of the tarball into C:\qt-4.7.1
  • 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-4.7.1 and not C:\qt-4.7.1\qt-4.7.1
    • 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-4.7.1\mkspecs\win32-msvc2005\qmake.conf file and check that the CONFIG entry does not include an embed_manifest_dll entry
  • Inspect the C:\qt-4.7.1\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-4.7.1 directory
  • Run this command:
configure -opensource -fast -debug-and-release -no-qt3support -no-phonon -no-phonon-backend -prefix C:\qt-4.7.1 -qt-libjpeg -qt-libpng -openssl-linked -I C:\openssl-0.9.8q\include -L C:\openssl-0.9.8q\out32dll -opensource -nomake demos -nomake examples
  • 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-4.7.1 directory
  • Run this command:
nmake
  • 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-4.7.1\lib

Configure a Qt runtime environment

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

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 release 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