Qt Webkit Win32 Build Instructions

From Second Life Wiki
Revision as of 14:11, 6 February 2009 by Icefox Carrasco (talk | contribs)
Jump to navigation Jump to search

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.

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

  • 1.1) Set up directories
  • Start/All Programs/Microsoft Visual Studio 2005/Visual Studio Tools/Visual Studio 2005 Command Prompt
mkdir C:\Qt
  • 1.2) Clone a copy of Qt - about 500 MB
cd C:\Qt
git clone git://labs.trolltech.com/qt-snapshot
  • 1.3) Configure Qt, takes about 10 minutes:
cd qt-snapshot
configure -release -no-qt3support -prefix C:\Qt\qt-snapshot
  • When the license agreement appears, if you agree type:
  • y<enter>
  • 1.4) 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-snapshot\lib
  • 1.5) Create the file C:\Qt\qt-snapshot\bin\qt-vars.bat and put the following in it
@echo off
echo Setting up a Qt environment...
set QTDIR=C:\Qt\qt-snapshot
set PATH=C:\Qt\qt-snapshot\bin;%PATH%
set QMAKESPEC=win32-msvc2005
call "C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat"
  • 1.6) Make a shortcut to qt-vars.bat on your desktop

Right-click > Properties on the shortcut and set: Target: %COMSPEC% /k "C:\Qt\qt-snapshot\bin\qt-vars.bat" Start in: C:\Qt\qt-snapshot

Rename the command prompt shortcut to "Qt Snapshot Command Prompt".

You can test it by opening the prompt and typing

qmake --version

To make sure that the version shows 4.5.0

2) Acquire llmozlib

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

3) Build llmozlib.a

  • 3.1) Launch the Qt command prompt, generate the makefile and build the library
cd C:\llmozlib\llmozlib2
qmake
nmake
  • 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

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.