Compiling KMess for Windows
This is a complete howto to compile KMess 2 for Windows.
Note this is alpha software, and in the end we want to provide a simple installer you can double-click on. Until then, you'll have to run through these steps manually. You'll also have to install additional software so KDE 4 software can be compiled at Windows. That's what makes this tutorial extra long.
Thanks to K39 for taking the first steps here.
Installing all developer tools
First, download the "KDE Installer for Windows" from KDE techbase.
- Save it to some program folder (e.g. C:\KDE4) as you need to run it more often.
- Follow the instructions
- In the first setup, choose the developer version and MinGW compiler edition (unless you have Visual Studio installed too off course).
Make sure the following packages are installed:
- KDE: kdelibs-mingw, kdebase-runtime-mingw.
To compile the software you also need:
- devel-tools: cmake, doxygen, gcc-mingw, tortoisesvn, vcredist.
- kdesupport: phonon-mingw
- tools: mingw-utils, perl.
Also recommended to install:
- KDE: kdesdk-mingw (installs Kate, works a bit like Text Pad)
- debug-tools: all of these
- tools: findutils, grep (to really search in all files).
When prompted for file locations, you can enter:
- C:\KDE4 for KDE 4.
- C:\MinGW for MinGW (needs to be retyped with every MinGW installer...)
Using spaces in the paths, like C:\Program Files\KDE4, gives problems to compile the handbook and icon resources. This is a bug in KDE 4 at this moment.
These installers don't update the system paths unfortunately, so you need to do that yourself:
- Go to: Start -> Control Panel -> System -> Advanced -> Environment Variables.
- To the user variables, add KDEDIRS with the value C:\KDE4
- To the system variables, search for PATH, and append the following:
;C:\KDE4\bin;C:\KDE4\lib;C:\MinGW\bin
The Start-Menu also isn't updated, so you may want to create some shortcuts to KDE 4 apps like Kate.
Now try to run a KDE 4 application
- Navigatate to C:\KDE4\bin in the Explorer.
- First try to open a Qt 4 application (e.g. designer.exe).
- Then try to open a KDE 4 application (e.g. kate). For some reason, this will open a command prompt the first time.
If an application hangs for ~1 minute, it's likely starting up knotify4. This takes a lot of time, and this should be fixed inside KDE itself (KDE #163445).
Now you should be able to run apps from the command line too. Do yourself a favor by right-clicking on the title bar of the command prompt, and increase the buffer size. The command window will be much bigger now.
If KDE 4 applications are able to run, you're ready to compile KMess.
Accessing KMess SVN
We also installed TortoiseSVN in the previous steps. This tool makes it really easy to manage SVN from Windows Explorer.
To checkout the SVN code, do the following:
- Create a folder to store the development code, e.g. C:\kmess2.
- Right click on it, choose SVN Checkout... (this is installed with TortoiseSVN, might require a reboot).
- Enter http://kmess.svn.sourceforge.net/svnroot/kmess/trunk/kmess in the URL.
- Press OK.
Note again spaces in the paths give problems with compiling software (KDE #163440). Since the Desktop folder is actually C:\Documents and Settings\you\Desktop it causes problems as well.
Now you have the code, and you can build it. To generate the build instructions, do:
- Open a command prompt window.
- Navigate to the kmess2 directory.
- type the following commands:
mkdir build cd build cmake -G "MinGW Makefiles" ..
- If everything went well, type:
mingw32-make
- And then:
mingw32-make install
Manual things to fix (temporary)
Unfortunately, some things are went wrong (2008-05-12). The following things had to be fixed:
- building the handbook failed if there are spaces in the paths. Run mingw32-make VERBOSE=1 to see the actual command which fails. Copy this to a new Command Prompt window to run the proper command manually (with C:\Progra~1\..).
- The file build/src/CMakeFiles/kmess.dir/build.make had references to D:/kde/kde-mingw, manually replaced those with C:/Program\ Files/KDE4 (KDE #163438).
- If the PATH contains references to Gtk / Gimp it could cause DLL conflicts in libxml2 at KMess startup (KDE #164170). Update kmess.exe.bat, and remove those paths from there. Another option is putting the KDE4 directories at the start of the windows PATH variable. This way, the KDE4 DLL's are picked up first.
To fix the first two problems automatically, download the makefix.bat file attached at the bottom.
- Save the file in your build directory.
- Open the file in an editor, and change the paths to the KMess folders.
- type makefix in your console window to run it.
Related topics
Comparing files
It's highly recommended to install WinMerge. This also integrates with TortoiseSVN, so you'll be able to compare files easily.
Win Merge converts end-of-line characters to Windows format by default. You'll have to disable this option in the settings at: Edit -> Options -> Editor -> Preserve orginal EOL chars.
Applying patch files
The KDE 4 installer doesn't provide the patch command line tool (KDE #164184). It's possible to merge two files using TortoiseSVN, though this doesn't work really nice. Right click on the root folder, and select TortoiseSVN -> Apply patch....
In the editor, use the Save button to apply the changes to one file. When you hit Reload you'll see both files are identical now.
Creating a full debug version of KMess
To create a full debug release with debug output, use the following cmake command:
cmake -D CMAKE_INSTALL_PREFIX=C:\Progra~1\KDE4 -D CMAKE_BUILD_TYPE=debugfull -D KMESS_DEBUG_OUTPUT=1 -G "MinGW Makefiles" ..
To view the debug output, you need to have Debug View (dbgview) open. This program can be installed from the "KDE Installer for Windows".
Attachments
-
makefix.bat
(0.6 kB) - added by diederik
4 months ago.
Batch file to fix compiling in windows. Place this in the "build" folder, and type makefix to run it.
-
make.bat
(28 bytes) - added by diederik
4 months ago.
make.bat, copy to C:\Windows so you can type "make" instead of "gwin32-make"
-
kmess-windows-debug-hack.patch
(3.6 kB) - added by diederik
3 months ago.
Hack to write debugging output to C:\kmessdebug.log (workarround for disabled kDebug() on Windows release builds)
