Difference between revisions of "Qt Webkit Win32 Build Instructions"

From Second Life Wiki
Jump to navigation Jump to search
(changed b2 from "glut.h" to "glui.h")
Line 66: Line 66:


* 2.2) Aquire the source for Qt
* 2.2) Aquire the source for Qt
  Download the 4.5.0 source which is found on the ftp server here:
  Download the 4.5.2 source which is found on the ftp server here:
  ftp://ftp.qtsoftware.com/qt/source/qt-all-opensource-src-4.5.0.tar.gz
  ftp://ftp.qtsoftware.com/qt/source/qt-all-opensource-src-4.5.2.tar.gz


* 2.3) Unzip the tarball and extract the contents of Qt in C:\Qt using your favorite zip tool ''(Note: using Cygwin's tar commmand might not work.  It results in an '''Access is Denied''' error when running configure below.  Use WinZip or some other tool instead.)''.
* 2.3) Unzip the tarball and extract the contents of Qt in C:\Qt using your favorite zip tool ''(Note: using Cygwin's tar commmand might not work.  It results in an '''Access is Denied''' error when running configure below.  Use WinZip or some other tool instead.)''.
  You should now have a directory C:\Qt\qt-all-opensource-src-4.5.0
  You should now have a directory C:\Qt\qt-all-opensource-src-4.5.2


* 2.4) Apply patches
* 2.4) Apply patches
   There are patches that can be found in llmozlib/llmozlib2/*.patch that should be applied to Qt
Review the file llmozlib/llmozlib2/qt_patches/merged_into_qt to determine which patches need to be applied.  Some patches are no longer needed with Qt 4.5.2.
   There are patches that can be found in llmozlib/llmozlib2/qt_patches/*.patch that should be applied to Qt


* 2.4) Configure Qt, takes about 10 minutes.  Open a vs console
* 2.4) Configure Qt, takes about 10 minutes.  Open a vs console
  cd C:\Qt\qt-all-opensource-src-4.5.0
  cd C:\Qt\qt-all-opensource-src-4.5.2
  configure -debug-and-release -no-qt3support -prefix C:\Qt\qt-all-opensource-src-4.5.0 -qt-libjpeg -qt-libpng -openssl-linked -I C:\openssl-0.9.8j\include -L C:\openssl-0.9.8j\out32dll
  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.8j\include -L C:\openssl-0.9.8j\out32dll


* When the license agreement appears, if you agree type:
* When the license agreement appears, if you agree type:
Line 84: Line 85:
  nmake sub-src
  nmake sub-src


* After building Qt the release and debug libraries will be in C:\Qt\qt-all-opensource-src-4.5.0\lib
* After building Qt the release and debug libraries will be in C:\Qt\qt-all-opensource-src-4.5.2\lib
* 2.8) Create the file C:\Qt\qt-all-opensource-src-4.5.0\bin\qt-vars.bat and put the following in it
* 2.8) 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 off
  echo Setting up a Qt environment...
  echo Setting up a Qt environment...
  set QTDIR=C:\Qt\qt-all-opensource-src-4.5.0
  set QTDIR=C:\Qt\qt-all-opensource-src-4.5.2
  set PATH=C:\Qt\qt-all-opensource-src-4.5.0\bin;%PATH%
  set PATH=C:\Qt\qt-all-opensource-src-4.5.2\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"
Line 96: Line 97:
* 2.8) Make a shortcut to qt-vars.bat on your desktop
* 2.8) Make a shortcut to qt-vars.bat on your desktop
Right-click > Properties on the shortcut and set:
Right-click > Properties on the shortcut and set:
Target: %COMSPEC% /k "C:\Qt\qt-all-opensource-src-4.5.0\bin\qt-vars.bat"
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.0
Start in: C:\Qt\qt-all-opensource-src-4.5.2


Rename the command prompt shortcut to "Qt 4.5 Command Prompt".
Rename the command prompt shortcut to "Qt 4.5 Command Prompt".
Line 103: Line 104:
You can test it by opening the prompt and typing
You can test it by opening the prompt and typing
  qmake --version
  qmake --version
To make sure that the version shows 4.5.0
To make sure that the version shows 4.5.2


3) Build llmozlib
3) Build llmozlib

Revision as of 15:30, 2 July 2009

These are instructions for building the Qt/WebKit library as well as testgl and uBrowser demo apps using WebKit.

If you do not have git, you can download and install from:

http://code.google.com/p/msysgit/

Select the option (number 2 of 3) to add git to your path, but not all the unix tools that ship with it.

0) Building the open source OpenSSL library with Visual Studio:

  • You can build Qt without ssl support (and skip this step) by removing -openssl from the Qt configure options.
  • Download the latest tarball from http://openssl.org/source/ (Currently it is openssl-0.9.8j.tar.gz)
  • Copy to C:\ and extract the contents C:\openssl-0.9.8j
  • The header files are symlinks to the real files, Microsoft's compiler doesn't seem to support NTFS sysmlinks so the real files have to be copied to the include directory. Below are steps to do that in cygwin's bash. Feel free to put the equivalent dos commands here as going into bash seems like a nasty hack.

Goto cd C:\openssl-0.9.8j and Launch bash and execute the following commands

rm include/openssl/*
cd crypto/
find ./ -name "*.h" -exec cp {} ../include/openssl/ \;
cd ../ssl/
find ./ -name "*.h" -exec cp {} ../include/openssl/ \;
cd ..
cp *.h include/openssl/
  • Patch the OpenSSL distribution - it's broken out of the box. Copy the following lines into a file called fix.patch in the C:\openssl-0.9.8j\util\ directory:
*** Source: http://marc.info/?l=openssl-dev&m=107628900919852&q=raw
*** openssl-0.9.7c/util/mk1mf.pl	Fri Mar 14 17:29:18 2003
--- openssl-0.9.7c-miket/util/mk1mf.pl	Sat Feb  7 21:58:57 2004
***************
*** 485,490 ****
--- 485,495 ----
  	chop;
  
  	($key,$val)=/^([^=]+)=(.*)/;
+ 	
+ 	# On some Windows machines, $val has linefeeds at the end, which confuses
+ 	# subsequent code in this file. So we strip all whitespace at the end.
+     $val =~ s/\s+$//;
+     
  	if ($key eq "RELATIVE_DIRECTORY")
  		{
  		if ($lib ne "")

then run this command from the C:\openssl-0.9.8j\util\ directory:

patch mk1mf.pl -p0 < fix.patch
  • Compile openssl
cd C:\openssl-0.9.8j
perl Configure VC-WIN32
ms\do_masm
nmake -f ms\ntdll.mak
  • The libraries libeay32.dll ssleay32.dll have now been build, they should be copied to wherever the Qt libraries are located for the applications that use them.

1) Acquire llmozlib

  • 1.1) Run "Qt Snapshot Command Prompt" and clone llmozlib in the C drive.
cd C:\
git clone git://code.staikos.net/llmozlib
  • 1.2) Checkout the qtwebkit branch
cd C:\llmozlib
git checkout -f -b qtwebkit origin/qtwebkit

2) Building the open source Qt snapshot with Visual Studio:

  • 2.1) Set up directories
  • Start/All Programs/Microsoft Visual Studio 2005/Visual Studio Tools/Visual Studio 2005 Command Prompt
mkdir C:\Qt
  • 2.2) Aquire the source for Qt
Download the 4.5.2 source which is found on the ftp server here:
ftp://ftp.qtsoftware.com/qt/source/qt-all-opensource-src-4.5.2.tar.gz
  • 2.3) Unzip the tarball and extract the contents of Qt in C:\Qt using your favorite zip tool (Note: using Cygwin's tar commmand might not work. It results in an Access is Denied error when running configure below. Use WinZip or some other tool instead.).
You should now have a directory C:\Qt\qt-all-opensource-src-4.5.2
  • 2.4) Apply patches

Review the file llmozlib/llmozlib2/qt_patches/merged_into_qt to determine which patches need to be applied. Some patches are no longer needed with Qt 4.5.2.

 There are patches that can be found in llmozlib/llmozlib2/qt_patches/*.patch that should be applied to Qt
  • 2.4) Configure Qt, takes about 10 minutes. Open a vs console
cd C:\Qt\qt-all-opensource-src-4.5.2
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.8j\include -L C:\openssl-0.9.8j\out32dll
  • When the license agreement appears, if you agree type:
  • y<enter>
  • 2.5) Build Qt, without demos. This takes 1-2 hours.
nmake sub-src
  • After building Qt the release and debug libraries will be in C:\Qt\qt-all-opensource-src-4.5.2\lib
  • 2.8) 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"
  • 2.8) Make a shortcut to qt-vars.bat on your desktop

Right-click > Properties on the shortcut and set: 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 command prompt shortcut to "Qt 4.5 Command Prompt".

You can test it by opening the prompt and typing

qmake --version

To make sure that the version shows 4.5.2

3) Build llmozlib

  • Investigate: does 'git config core.safecrlf true' solve the windows line ending issue?
  • 3.1) Launch the Qt command prompt, generate the makefile and build the library
cd C:\llmozlib\llmozlib2
qmake CONFIG-=debug
nmake

If you want to build the debug version of llmozlib run 'qmake CONFIG+=debug'

  • Now llmozlib is built and can be used in the viewer. If you want to build the test applications follow the next steps:

4) Acquire the test application library dependencies; Glut and GLUI

glut-3.7.6-bin.zip
glui-2.35.zip
  • b1. Extract the zip
  • b2. Open glui\src\msvc\glui.vcproj. Allow Visual Studio to convert the project.
  • b2. Edit src\include\GL\glui.h
  • b3. Move "#include <cstdlib>" to the top of the file, just under #define GLUI_GLUI_H
    (hence above #include <GL/glut.h>
  • b4. See http://www.lighthouse3d.com/opengl/glut/ for details on this edit
  • Copy the contents of c:\llmozlib\llmozlib2\tests\GL into glue\src\include\GL
  • b5. Follow the instructions in the readme.txt to compile the library
    Make sure to build a release library
  • b6. Copy glui.h and from the include into C:\llmozlib\llmozlib2\tests\GL
  • b7. Copy glui32.lib from msvc/lib into C:\llmozlib\llmozlib2\tests\GL

4) Build testgl and run it. Open the Qt Snapshot command prompt.

cd C:\llmozlib\llmozlib2\tests\testgl
qmake CONFIG-=debug
nmake
..\GL\testgl.exe

5) Build ubrowser and run it. Open the Qt Snapshot command prompt.

cd C:\llmozlib\llmozlib2\tests\ubrowser
qmake CONFIG-=debug
nmake
..\GL\ubrowser.exe

6) Build Second life

Notes: a. To generate a Visual studio vcproj file you have to use a Qt *commercial* command prompt and run the following:

 qmake -tp vc

b. Make sure all libs and app 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

Troubleshooting: 1) If you see this, you need to reorder the <cstdlib> and <GL/glut.h> includes.

C:\Program Files\Microsoft Visual Studio 8\VC\include\stdlib.h(406) : error C2381: 'exit' : redefinition; __declspec(noreturn) differs

       ../include\GL/glut.h(146) : see declaration of 'exit'

2) uBrowser crashes on startup in stdlib (vc8crt.dll or similar)

This happens when you mix debug and release libraries. Make sure you are using all "release" builds of GLUI and ubrowser.