Difference between revisions of "Qt Webkit Win32 Build Instructions"

From Second Life Wiki
Jump to navigation Jump to search
Line 55: Line 55:
* 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.0
  configure -debug-and-release -no-qt3support -optimized-qmake -prefix C:\Qt\qt-all-opensource-src-4.5.0 -qt-libjpeg -qt-libpng -openssl -I C:\openssl-0.9.8j\include
  configure -debug-and-release -no-qt3support -prefix C:\Qt\qt-all-opensource-src-4.5.0 -qt-libjpeg -qt-libpng -openssl -I C:\openssl-0.9.8j\include


* When the license agreement appears, if you agree type:
* When the license agreement appears, if you agree type:

Revision as of 07:49, 25 March 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
  • Compile openssl
cd C:\openssl-0.9.8j
perl Configure VC-WIN32
ms\do_masm
nmake -f ms\ntdll.mak
  • 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/
  • 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.0 source which is found on the ftp server here:
ftp://ftp.qtsoftware.com/qt/source/qt-all-opensource-src-4.5.0.tar.gz
  • 2.3) Unzip the tarball and extract the contents of Qt in C:\Qt using your favorite zip tool
You should now have a directory C:\Qt\qt-all-opensource-src-4.5.0
  • 2.4) Apply patches
 There are patches that can be found in llmozlib/llmozlib2/*.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.0
configure -debug-and-release -no-qt3support -prefix C:\Qt\qt-all-opensource-src-4.5.0 -qt-libjpeg -qt-libpng -openssl -I C:\openssl-0.9.8j\include
  • 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
  • 2.6) optionally to build just the needed components:
nmake sub-winmain sub-corelib sub-opengl sub-gui sub-webkit sub-network
  • After building Qt the release and debug libraries will be in C:\Qt\qt-all-opensource-src-4.5.0\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
@echo off
echo Setting up a Qt environment...
set QTDIR=C:\Qt\qt-all-opensource-src-4.5.0
set PATH=C:\Qt\qt-all-opensource-src-4.5.0\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.0\bin\qt-vars.bat" Start in: C:\Qt\qt-all-opensource-src-4.5.0

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.0

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\glut.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.