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).
Please note beforehand that if you need to re-run the installer for any reason (forgot to install a package?) - make sure to deselect the "skip basic settings pages" box on the first page, or you may not be able to reselect packages.
Make sure the following packages are installed:
- KDE: kdelibs-mingw, kdebase-runtime-mingw.
To compile the software you also need: (make sure you select "bin" and "devel" for every option!)
- devel-tools: cmake, doxygen, gcc-mingw, tortoisesvn, vcredist.
- kdesupport: phonon-mingw, automoc-mingw, kdewin32-mingw, qca-mingw
- tools: mingw-utils, perl.
- qt: qt-mingw.
- win32libs: libxml2, libxslt2, iconv.
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 FilesKDE4, 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 and KDEDIR with the same value C:KDE4.
- To the system variables, search for PATH, and append the following:
;C:KDE4in;C:KDE4lib;C:MinGWin
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
- Navigate to C:KDE4in 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.exe). 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 SettingsyouDesktop 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 -D CMAKE_INSTALL_PREFIX=C:Progra~1KDE4 -D CMAKE_BUILD_TYPE=debugfull -D KMESS_DEBUG_OUTPUT=1 -G "MinGW Makefiles" ..
- (If you don't want a full debug build, run this command instead of the above cmake command:)
cmake -G "MinGW Makefiles" ..
- If everything went well, type:
mingw32-make
- And then:
mingw32-make install
To view the debug output, you need to have Debug View (dbgview) open. This program can be installed from the "KDE Installer for Windows".
Compiling qca2
Before compiling qca2, copy your ssleay32.dll file in KDE4/bin to libssl32.dll.
Since QCA2 is broken in the latest release of KDE 4 as of 31-03-2009, you need to build qca2 yourself. Use the instructions from http://techbase.kde.org/Getting_Started/Build/KDE4/Windows/Building_KDESupport_Libraries#qca to checkout kdesupport (or qca only maybe), compile (use CMAKE_BUILD_TYPE=Release instead of Debug!) and install it. This is non-ideal and has to be done because of a bug in the latest installer; which seems to ship with the debug version of qca2 and the release version of the KDE libs itself. Maybe this won't be needed for you; try running 'qcatool2 plugins'; if you see qca2-ossl listed under "Available providers", you're set.
After installing qca2, re-run qcatool2 plugins to see if it's correctly installed. After that, run KMess and you should be able to log in.
Manual things to fix (temporary)
If you get errors like:
C:/MinGW/include/winbase.h:1663: error: declaration of C function `LONG InterlockedCompareExchange(volatile LONG*, LONG, LONG)' conflicts with C:/KDE4/include/QtCore/qatomic_windows.h:387: error: previous declaration 'long int InterlockedCompareExchange(long int*, long int, long int)' here
You probably had MingW installed on your PC and the KDE installer updated it. In such cases, try to get this installation of MingW and install it over your current one... http://digikam3rdparty.free.fr/misc.tarballs/MinGW5.1.4ok This is, however, completely unsupported or anything - that may as well break your PC. Reference: http://mail.kde.org/pipermail/digikam-users/2008-November/006657.html
As of 2009-03-30, build.make still has references to D:/kde/kde-mingw. The .bat file supplied by Diederik still works, but you should edit it to replace the paths if needed. Also, after running it, re-run cmake or edit the Makefile and CMakeFileskmess.dirlink.txt. This is what Diederik wrote back in May 2008:
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.
Getting debugging to work
To get good debug output in the Debug View program by Sysinternals, after making sure you correctly set debugfull and everything in the build options, you need to edit two files:
- include/kdebug.h in your KDE directory: comment out line 38 to 48 (the lines about KDE_NO_DEBUG_OUTPUT and KDE_NO_WARNING_OUTPUT.
- kmessapplication.cpp: comment out line 53, the debug handler.
This will make the kmess debugging messages appear correctly in the Debug View program.
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.
Attachments
-
makefix.bat
(0.6 kB) - added by diederik
11 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
11 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
11 months ago.
Hack to write debugging output to C:kmessdebug.log (workarround for disabled kDebug() on Windows release builds)
