Difference between revisions of "BuildingWindows"

From Mumble Wiki
Jump to: navigation, search
m (Added a few lines in Boost and WinDBus for ease on installation/integrity)
Line 70: Line 70:
 
== Boost ==
 
== Boost ==
  
Download http://prdownloads.sf.net/boost/boost_1_33_1.zip?download and http://prdownloads.sf.net/boost/boost-jam-3.1.13-1-ntx86.zip?download and unzip both to C:\dev\
+
Download http://prdownloads.sf.net/boost/boost_1_34_1.zip?download and http://prdownloads.sf.net/boost/boost-jam-3.1.14-1-ntx86.zip?download and unzip both to C:\dev\
  
  cd \dev\boost_1_33_1
+
  cd \dev\boost_1_34_1
  copy ..\boost-jam-3.1.13-1-ntx86\bjam.exe
+
  copy ..\boost-jam-3.1.14-1-ntx86\bjam.exe
  bjam -s"TOOLS=mingw" --prefix=C:\dev\Boost install
+
  bjam --toolset=gcc --prefix=C:\dev\Boost install
  
 
This might take a while, but when done you'll have Boost installed.
 
This might take a while, but when done you'll have Boost installed.
Note that none of the other build dependencies do themselves depend on boost, so if you want you can just continue in a new command shell (but remember to call ''prep.bat''). Once all is done, you can safely delete the boost_1_33_1 and boost-jam directories. If you get the warning, that some targets were skipped or failed, it can be ignored for our purposes.  
+
Note that none of the other build dependencies do themselves depend on boost, so if you want you can just continue in a new command shell (but remember to call ''prep.bat''). Once all is done, you can safely delete the boost_1_34_1 and boost-jam directories. If you get the warning, that some targets were skipped or failed, it can be ignored for our purposes.  
  
 
== Microsoft Speech SDK ==
 
== Microsoft Speech SDK ==
Line 92: Line 92:
  
 
Checkout the SVN of WinDBus from https://windbus.svn.sourceforge.net/svnroot/windbus/trunk to c:\dev\windbus
 
Checkout the SVN of WinDBus from https://windbus.svn.sourceforge.net/svnroot/windbus/trunk to c:\dev\windbus
 +
 +
From http://82.149.170.66/kde-windows/win32libs/zip/complete/ download iconv, libxml and zlib. Unpack them to 'c:\Program Files\win32libs'
  
 
Run this command:
 
Run this command:
Line 117: Line 119:
 
  make install
 
  make install
  
Incase you get an error message licke this:
+
Regardless of what you say, Windbus is installed to c:\<Program Files>\dbus. Move that entire directory into c:\dev (so it ends up as c:\dev\dbus)
 
 
Please set the following variables:  
 
libxml2-include-dir (advanced)
 
libxml2-libraries (advanced)
 
  
you need to install libxml and most likely libiconv.
+
Copy all .dll files from c:\Program Files\win32libs\bin to c:\dev\dbus\bin
 
 
http://downloads.sourceforge.net/gnuwin32/libxml2-2.4.12-1-lib.zip
 
http://downloads.sourceforge.net/gnuwin32/libiconv-1.9.2-1-bin.zip
 
 
 
Extract both files to c:\<Program Files>\win32libs.
 
 
 
Regardless of what you say, Windbus is installed to c:\<Program Files>\dbus. Move that entire directory into c:\dev (so it ends up as c:\dev\dbus)
 
  
 
== OpenSSL ==
 
== OpenSSL ==

Revision as of 22:06, 20 August 2007

Building Mumble on Windows

Mumble has quite a few dependencies for building on Windows, and as the feature set grows, so does the list of dependencies. This page will try to detail the steps required to set up a Win32 build environment.

The paths used here equal the defaults assumed in the Mumble build files. You are free to change them, but you'll then need to change the mumble.pro file as well.

Also note, that if you are submitting a bug report for a selfbuilt executable, we expect you to either

  • Follow these instructions to the letter

or

  • Report any deviations from these instructions

Deviations means anything, from "I installed to the D: drive" to "I changed the gcc build options for Qt" or "I used another version of Speex".

Preparations

Create C:\dev, and inside that directory create a file prep.bat containing:

@echo off
SET QTDIR=C:\dev\Qt4.3.1
SET DBUSDIR=C:\dev\dbus
SET INCLUDE=
SET LIB=
SET PATH=C:\dev\MinGW\bin;%QTDIR%\bin;%DBUSDIR%\bin;C:\dev\openssl\out;C:\dev\openssl;C:\dev\cmake\bin;%PATH%

Start a new command shell (run cmd.exe) and

C:
CD \dev
prep.bat

Whenever something appears

like this

you're supposed to enter it in that command shell (or copy it from this webpage and rightclick in the command window and select Paste). When you later want to compile things, remember to call prep.bat first to set paths correctly.

Using your computer while compiling

Compilation is a almost 100% CPU bound job. The windows task switcher doesn't really understand that this isn't really an interactive application, and hence will happily make your entire desktop quite laggy just to gain 1% on the compile time. It is therefore recommended to open your task manager (Ctrl-Alt-Del), switch to Processes, locate cmd.exe, rightclick, Set Priority, BelowNormal. And answer Yes. Doing so will make sure your interactive things get priority. Note, however, that if you do other 100% cpu bound things (like play resource-intensive games), compilation will halt until you're done.

TortoiseSVN

Download the most recent version of TortoiseSVN at http://tortoisesvn.net/downloads and install it. The defaults are fine.

Download Mumble SVN

Open c:\dev, rightclick and SVN Checkout...

Repository is

https://mumble.svn.sourceforge.net/svnroot/mumble/trunk

checkout to C:\dev\mumble\

MinGW

Create a directory c:\dev\MinGW

Download the following files:

and unzip them all to the C:\dev\MinGW directory.

cd \dev\MinGW\bin
copy mingw32-make.exe make.exe

Boost

Download http://prdownloads.sf.net/boost/boost_1_34_1.zip?download and http://prdownloads.sf.net/boost/boost-jam-3.1.14-1-ntx86.zip?download and unzip both to C:\dev\

cd \dev\boost_1_34_1
copy ..\boost-jam-3.1.14-1-ntx86\bjam.exe
bjam --toolset=gcc --prefix=C:\dev\Boost install

This might take a while, but when done you'll have Boost installed. Note that none of the other build dependencies do themselves depend on boost, so if you want you can just continue in a new command shell (but remember to call prep.bat). Once all is done, you can safely delete the boost_1_34_1 and boost-jam directories. If you get the warning, that some targets were skipped or failed, it can be ignored for our purposes.

Microsoft Speech SDK

Go to http://www.microsoft.com/speech/speech2007/downloads.mspx and enter the link SAPI 5.1 SDK. A bit down on the following page is a download button for SpeechSDK51.exe. Download and install it to C:\dev\SpeechSDK

Microsoft DirectX SDK

Go to http://msdn.microsoft.com/directx/sdk/ and download the latest SDK. Install it to c:\dev\DXSDK\

WinDBUS

Download http://www.cmake.org/files/v2.4/cmake-2.4.7-win32-x86.zip and unpack it to c:\dev. Rename the top directory to just 'cmake'.

Checkout the SVN of WinDBus from https://windbus.svn.sourceforge.net/svnroot/windbus/trunk to c:\dev\windbus

From http://82.149.170.66/kde-windows/win32libs/zip/complete/ download iconv, libxml and zlib. Unpack them to 'c:\Program Files\win32libs'

Run this command:

cd \dev\windbus
patch -p0 < DBus-win32.patch

Now, you'll need to edit some of the files.

Edit windbus\dbus\dbus-spawn-win.c. On line 231, change

sitter->end_sync_event = NULL;

to

sitter->start_sync_event = NULL;

Edit windbus\dbus\dbus-sysdeps-win.c. On line 3019, change

if(CreateProcessA(dbus_exe_path, dbus_args, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))

to

if(CreateProcessA(dbus_exe_path, dbus_args, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi))

... and then finally, run these commands:

cd \dev
mkdir windbus-build
cd windbus-build
cmake -DDBUS_DISABLE_ASSERTS=ON -DDBUS_BUILD_TESTS=OFF -DDBUS_ENABLE_VERBOSE_MODE=OFF -DCMAKE_BUILD_TYPE=Release -DDBUS_INSTALL_SYSTEM_LIBS=ON -G "MinGW Makefiles" c:\dev\windbus\cmake
make
make install

Regardless of what you say, Windbus is installed to c:\<Program Files>\dbus. Move that entire directory into c:\dev (so it ends up as c:\dev\dbus)

Copy all .dll files from c:\Program Files\win32libs\bin to c:\dev\dbus\bin

OpenSSL

Download the latest OpenSSL source, unpack it to c:\dev\openssl

Download and install ActivePerl.

Open a new shell (so the path is correct)

cd \dev
prep
cd openssl
ms\mingw32

Qt

Download ftp://ftp.trolltech.com/qt/source/qt-win-opensource-src-4.3.1.zip and unzip to C:\dev. Rename the directory from qt-win-opensource-src-4.3.1 to Qt4.3.1

Go to C:\dev\Qt4.3.1\mkspecs\win32-g++ and open the file qmake.conf. Change the following lines:

QMAKE_CFLAGS_RELEASE	= -O2
QMAKE_CFLAGS_DEBUG	= -g

into

QMAKE_CFLAGS_RELEASE	= -O2 -march=pentium3 -mtune=generic -mmmx -msse
QMAKE_CFLAGS_DEBUG	= -O2 -fno-inline -g -march=pentium3 -mtune=generic -mmmx -msse

This will enable MMX and SSE instructions, and will also make sure Qt is tuned for modern architectures. It will also remove the exception threading support, which removes a few runtime dependencies.

So far, so good. However, in order to use SSE in threads, we'll need to make sure the thread stack is aligned, something neither the Windows runtime, the MinGW runtime or Qt does for us. So we'll hack this into Qt by fudging it's thread creation.

Open C:\dev\Qt4.3.1\src\corelib\thread\qthread_win.cpp in an editor. Locate the line which says

void QThread::start(Priority priority)

before this line, enter the following:

static unsigned int __attribute__((noinline, stdcall)) f_prime (void *p)
{
	return QThreadPrivate::start(p);
}
unsigned int __attribute__ ((stdcall)) QThreadStackAligned (void *p)
{
   (void)__builtin_return_address(1); // to force call frame
   asm volatile ("andl $-16,%%esp" ::: "%esp");
   return f_prime (p);
}

then, inside the ::start() function, change the line

   d->handle = (Qt::HANDLE) _beginthreadex(NULL, d->stackSize, QThreadPrivate::start,
                                           this, CREATE_SUSPENDED, &(d->id));

to read

   d->handle = (Qt::HANDLE) _beginthreadex(NULL, d->stackSize, QThreadStackAligned,
                                           this, CREATE_SUSPENDED, &(d->id));

In C:\dev\Qt4.3.1\tools\qdbus\src\src.pro change

CONFIG(debug, debug|release):LIBS += -ldbus-1d
else:LIBS += -ldbus-1

to

LIBS += -ldbus-1

Also, go into C:\dev\Qt4.31\tools\qdbus\tools\qdbusviewer\images and copy dbusviewer.ico to qdbusviewer.ico.

then it's time to compile Qt

cd \dev\Qt4.3.1
configure -debug-and-release -qt-sql-sqlite -no-qt3support -no-exceptions -qt-zlib -qt-libpng -qt-libjpeg -openssl -qdbus -I c:\dev\openssl\outinc -L c:\dev\openssl\out -I c:\dev\dbus\include -L c:\dev\dbus\lib
make

This will also take quite a while.

Building Mumble and Murmur

Once all of the above is done... Open C:\dev\mumble\src\mumble\mumble.pro and remove the line which says CONFIG += asio. That is only needed for ASIO support, which requires downloads of proprietary ASIO SDK to compile.

Note that this builds the debug versions, which is what we strongly recommend to use while developing. If you want to send the binary to someone else, use make release instead, which will result in a much smaller binary with fewer dependencies.

cd \dev\mumble
qmake
make clean
make