KDE LogoKDElibs.com
Cross-platform KDE Development











Building KDElibs 4 using GCC and MinGW (old tutorial)

Table of contents

Introduction

This step-by-step tutorial shows how to get the current kdelibs from the upcoming KDE4 based on Qt4 compiled under Microsoft Windows. The tutorial uses Qt 4.1.2 with patches coming from KDE's Qt-Copy. An additional tutorial that uses Qt 4.2 is at Building KDElibs 4 using GCC and MinGW with Qt 4.2.

Installing cmake

Informations about installing cmake could be found here (http://wiki.kde.org/tiki-index.php?page=KDECMakeIntro)

Installing subversion client

Subversion is required to access KDE source repositories. The clients are available as

Install one or both of the listed clients. Informations how to install could be found below the mentioned links.

Installing Perl

Perl is required because new dcopidl and other scripts depends on perl

  • download from downloads.activestate.com (http://downloads.activestate.com/ActivePerl/Windows/5.8/ActivePerl-5.8.7.813-MSWin32-x86-148120.zip)
  • install into c:\Perl

Get 3rd-party libraries required for KDElibs 4

Installing Qt Library

  • Download QT 4.1.2-mingw (http://www.trolltech.com/download.html?target=ftp://ftp.trolltech.com/qt/source/qt-win-opensource-4.1.2-mingw.exe) release
  • Run installer, add MinGW installation and install QT into c:\Qt\4.1.2 and MinGW in c:\MinGW.
  • This release requires some patches which are not applied yet by Trolltech.
    • checkout qt patches from KDE svn (http://developer.kde.org/source/) path trunk/qt-copy/patches by running the following commands:
      cd c:\daten\kde4
      svn co svn://anonsvn.kde.org/home/kde/trunk/qt-copy/patches qt-copy-patches
      

      As result you will get a set of diff files like 0111-qurl_setPort.diff.

    • enter qt source dir and run the following command for each patch file
      cd c:\qt\4.1.2
      c:\Programme\gnuwin32\bin\patch -p0 <  c:\daten\kde4\qt-copy-patches\<patchfile>
      
    • then recompile qt
      cd c:\qt\4.1.2
      configure -qt-gif -plugin-sql-odbc -plugin-sql-sqlite -fast
      

Checking out KDE sources

See KDE's developer site how to retrieve the source (http://developer.kde.org/source/). In case you have svn installed you can run:

cd c:\daten\kde4
svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs

Setting up environment

Before any further steps the execution path must be updated.

set PATH=C:\Mingw\bin;c:\Qt\4.1.2\bin;c:\Perl\bin;%PATH%
set PATH=C:\Programme\gnuwin32\bin;C:\Programme\kdewin32\bin;%PATH%

Please note that C:\Programme\ reflects the path in which applications are installed by default. The path containing kdewin32 is required for the win32 supplemental library explaned below.

Preconfigure steps

On windows KDE requires a special supplemental library named kdewin32. This library must be build and installed first.

 cd c:\daten\kde4\
 svn co svn://anonsvn.kde.org/home/kde/trunk/kdesupport/kdewin32
 cd kdesupport\kdewin32
 cmake -G "MinGW Makefiles"
 mingw32-make
 mingw32-make install

This will install the library in c:\Programme\kdewin32.

Configure and compile kde 4 without test application

Now you are ready to configure the main kde sources by using the following commands:

 cd c:\daten\kde4
 mkdir kdelibs-build
 cd kdelibs-build
 cmake -G "MinGW Makefiles" ..\kdelibs\
 mingw32-make

configure and compile kde 4 with test application

cd c:\daten\kde4
mkdir kdelibs-build
cd kdelibs-build
cmake -DKDE4_BUILD_TESTS=1 -G "MinGW Makefiles" ..\kdelibs\
mingw32-make