Difference between revisions of "Qt Webkit Win32 Build Instructions"

From Second Life Wiki
Jump to navigation Jump to search
Line 7: Line 7:
Select the option (number 2 of 3) to add git to your path, but not all the unix
Select the option (number 2 of 3) to add git to your path, but not all the unix
tools that ship with it.
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
cd crypto/
find ./ -name "*.h" -exec cp {} ../include/openssl/ \;
cd ../ssl/
find ./ -name "*.h" -exec cp {} ../include/openssl/ \;
cd ..
cp *.h include/openssl/
 
 
1) Building the open source Qt snapshot with Visual Studio:
1) Building the open source Qt snapshot with Visual Studio:
* 1.1) Set up directories
* 1.1) Set up directories
Line 17: Line 37:
* 1.3) Configure Qt, takes about 10 minutes:
* 1.3) Configure Qt, takes about 10 minutes:
  cd qt-snapshot
  cd qt-snapshot
  configure -release -no-qt3support -prefix C:\Qt\qt-snapshot
  configure -debug-and-release -no-qt3support -prefix C:\Qt\qt-snapshot -openssl -I C:\openssl-0.9.8j\include
 
To build the debug version of Qt remote -release and add -debug to the configure command line.


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

Revision as of 14:13, 17 February 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

cd crypto/
find ./ -name "*.h" -exec cp {} ../include/openssl/ \;
cd ../ssl/
find ./ -name "*.h" -exec cp {} ../include/openssl/ \;
cd ..
cp *.h include/openssl/


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 -debug-and-release -no-qt3support -prefix C:\Qt\qt-snapshot -openssl -I C:\openssl-0.9.8j\include
  • 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
  • 1.4) 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-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 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.