t_fischer: (happy)
[personal profile] t_fischer

Yesterday, I was working on porting KBibTeX to Windows. Eventually, I succeeded to make it compile and run. Continue to read to learn what changes had to be made and how to get it running on your own Windows machine. Special thanks for helping me go to SaroEngels on #kde-windows.

Screenshot: KBibTeX on Windows

A few weeks back I made the first attempts to port KBibTeX to Windows. From some spare parts I assembled a computer, installed Windows on it and tried to figure out how to compile KDE software. The lack of package management, a CP/M-inspired file hierarchy, and an inferior shell (cmd.exe has improved over COMMAND.COM, but cannot compete with Bash) make it a challenge to work seriously with Windows. Usually, one has to start by collecting software from different places, like Perl (I picked Strawberry), Python, cmake, svn (command-line only), and a C++ compiler (Microsoft's free-as-in-beer Visual C++ Express 2010). Don't forget to add each software's binaries' paths to the PATH variable. Check your installation by starting the Visual Studio 2010 Command Prompt and try to run perl, svn, etc.

Now, to install KDE, you have two paths to choose from. The first alternative is to install everything from source using the emerge tool. Be warned, this can take hours. To build KBibTeX it is not really necessary to build KDE from sources and unless you want to debug or program in KDE itself and have too much CPU time you want to stick with alternative two: Use the KDE Installer for Windows which fetches and installs precompiled packages for you. Start it via right-click and "Run as administrator". I can recommend the following choices:

  • Install from Internet
  • Install into C:\Program Files\KDE
  • "Package Manager" and "MSVC 2010 32Bit" (which should match Visual C++ Express 2010 which is 32bit only even on 64bit machines)

For all other fields you should pick values reasonable for you. Some mirrors seem to be outdated or no longer active, so try different ones to find one which has the most current KDE version for Windows (4.5.4 as of writing, where 4.6.3 is the official stable release).

In the Package Selection step, you should select the following packages as both "Bin" and "Devel":

  • kdebase-workspace-vc100 (Bin only)
  • kdelibs-vc100
  • kdewin-vc100
  • libxml2-vc100
  • libxslt-vc100
  • oxygen-icons-vc100
  • phonon-vc100 (not phonon-vlc-vc100)
  • poppler-vc100
  • qt-vc100
  • runtime-vc100 (Bin only)
  • soprano-vc100
  • win_iconv-vc100

There are some packages I am not sure of if you need to select them as well. Install Bin and Devel if you encounter error message about those packages missing. All other necessary packages will be automatically selected by the dependency resolver. You can add some user-space programs like Konqueror or Kate to complete your KDE installation.

Before proceeding, I recommend to make the following changes:

  • Locate nmake.exe in you system (part of MSVC's installation), make a copy called nmakeadmin.exe and configure it via Properties and Compatibility to "Run this program as an administrator"1.
  • You have to manually change share\apps\cmake\modules\KDELibs4LibraryTargets-relwithdebinfo.cmake in your KDE installation to fix the location of some libraries. Some paths are hardcoded in the wrong way. Search for N:\lib or N:/lib (used for kdewin.lib and soprano.lib) and replace it with the lib directory of your KDE installation. I did not know how well spaces are handled, so I used C:/PROGRA~1/KDE/lib.
  • Manually download automoc4-0.9.88.tar.bz2, extract it in some working directory, create a sibling directory called automoc4-build and go in this directory with the Visual Studio Command Prompt. Run:
    cmake ..\automoc4-0.9.88 -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="c:\Program Files\kde" && nmake && nmakeadmin install

Now it is time to start compiling KBibTeX. First, check out the most recent SVN snapshot (at least r696, version 0.3 will not work). I recommend to create a working directory somewhere in your user's document folder. Next, create a new folder called kbibtex-build next to kbibtex, open the Visual Studio 2010 Command Prompt and go into the kbibtex-build directory. Run the following cmake command, but adopt the paths to your local installation:

cmake ..\kbibtex -G "NMake Makefiles" -DKDE4_LIB_DIR="c:\Program Files\kde\lib" -DKDE4_INCLUDE_DIR="c:\Program Files\kde\include" -DCMAKE_INCLUDE_PATH="c:\Program Files\kde\include" -DCMAKE_LIBRARY_PATH="c:\Program Files\kde\lib;c:\Program Files\kde\bin" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="c:\Program Files\kde"

If this runs without problems, you can compile KBibTeX using MSVC's nmake:


Now, for the installation you need administrator permissions and that is where we use the nmakeadmin created before. Simply run the follow command and confirm using administrator permissions:

nmakeadmin install

Once this is done, you can find the KBibTeX binary in KDE's bin directory.

If you find errors or omissions in above description, please let me know. If you have problems in general with KDE on Windows, contact the KDE on Windows folks on IRC. If you are a developer and are interested in which changes I did in my build system and source code to make KBibTeX compile on Windows look at the changes made in SVN revisions 685 to 696.

1 This privilege escalation is only necessary if you install KDE somewhere where your current user has no write permissions. Alternatively, you can install KDE in your user's directory, run cmd.exe as administrator, or log in as administrator.

Identity URL: 
Account name:
If you don't have an account you can create one now.
HTML doesn't work in the subject.


If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

Notice: This account is set to log the IP addresses of everyone who comments.
Links will be displayed as unclickable URLs to help prevent spam.


t_fischer: (Default)
Thomas Fischer

March 2017


Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags