Windows XP Compilation Howto

by brian

updated by kaazoo

This is a step-by-step guide to compiling and installing DrQueue on Windows XP.

At the time of writing, there was no suitable current release of DrQueue for Windows; the latest version, 0.64.3, contains bugs that have already been fixed in the development code. Therefore, this has only been tested using the trunk code as of 10/29/08.

This process has been tested on both 32- and 64-bit XP Professional, with updates up through Service Pack 2.

If there are steps that could be changed to be more efficient, please feel free to let me know.


Compilation is done on Windows the same way it is under Linux/OS X, using SCons. Our goal is to set up Cygwin to mimic a Linux environment, integrating packages that Cygwin does not by default offer in order to compile successfully.

1. Install Cygwin
a. Download Cygwin from http://www.cygwin.com. I used v1.5.25-15.
b. Do a default install. Set these packages to install if they are not already:

  • cygrunsrv
  • gcc
  • g++
  • make
  • gtk2
  • gtk2-devel
  • atk-devel
  • subversion
  • pkg-config
  • python
  • vim, nano - optional. You need a text editor that can use UNIX-friendly line breaks. I use vim, but many people aren't comfortable with it. If you want a graphical text editor, I recommend PSPad.

    http://www.pspad.com/

    On opening a file in PSPad, go to Format -> UNIX to ensure it will be saved as a Unix-friendly file.

I installed Cygwin to C:\cygwin; all subsequent Cygwin paths in this tutorial will use that path. If you choose a different location to install to, substitute your install path accordingly.

2. Install .NET Framework

You might have this already - check out C:\WINDOWS\Microsoft.NET\Framework, each "v#" folder is an installed framework. More than one version will work for our purposes - the one I've used is 3.5, Service Pack 1, which I got from here:

http://www.microsoft.com/downloads/details.aspx?familyid=AB99342F-5D1A-413D-8319-81DA479AB0D7&displaylang=en

3. Install SCons

a. Download SCons for Windows from http://scons.org/. I used v1.1.0.
b. SCons needs to find an installation of Python in order to install. If you have one installed already, you can skip this step. If you're not if you have one, run the SCons installer and it will tell you. I installed Python v2.6 for Windows, using all of the default installation settings. This installed Python to C:\Python26. You will not be using this install of Python to compile, you will be using the Cygwin one.
c. Install SCons. This placed the SCons executables in C:\Python26\Scripts and the SCons modules in C:\Python26\Lib\site-packages. Both of these things need to be accessible to Cygwin.

  • Add Python Executables to the System Path
    • Using your UNIX-friendly text-editor (see step 1b), edit the file C:\cygwin\etc\profile. In Cygwin this path is seen as /etc/profile.
    • Locate the line that begins with PATH=...
    • The end of this line will look like "...:$PATH". Leaving the rest of the line untouched, change the end of the line to "...:/cygdrive/c/Python26/Scripts:$PATH". Make sure your colons are in the right place.
    • Save and close profile.
  • Add SCons modules to the Cygwin installation
    • Copy the folder C:\Python26\Lib\site-packages\scons-1.1.0 into the directory C:\cygwin\lib\python2.5\site-packages.
      UPDATE:
      a. Download SCons as ZIP file from http://scons.org/. I used v1.2.0.
      b. Unpack the ZIP file for example with 7zip.
      c. Start Cygwin shell and go into the extracted directory:
      cd /cygdrive/C/Dok*/USER/Desktop/scons-1.2.0
      

      d. Install SCons:
      python setup.py install
      

4. Integrate GTK+2 with Cygwin

drqman uses GTK+2, which Cygwin does not provide by default.
  • Copy all directories from GTK\etc into C:\cygwin\etc
a. Download the gtk+2 All-In-One Bundle from http://www.gtk.org/download-windows.html
b. Extract it wherever you want. It doesn't matter where it is. We'll refer to it as GTK.
c. Copy GTK files into your Cygwin installation.
  • Copy all files and directories from GTK\include into C:\cygwin\usr\include
  • Copy all files from GTK\lib into C:\cygwin\lib
  • Copy the directories GTK\lib\glib-2.0 and GTK\lib\gtk-2.0 into C:\cygwin\lib
  • Copy all files from GTK\lib\pkgconfig into C:\cygwin\lib\pkgconfig

    In any of these cases if you are asked whether to replace files, do so.

    d. All GTK pkgconfig files by default have the wrong prefix set. Open all of the .pc files in C:\cygwin\lib\pkgconfig (using your UNIX-friendly text-editor). Make sure the first line of each file reads "prefix=/usr", modifying the ones that don't.

    This is an annoying step to do by hand. I'm sure there is a better way to make these changes, if you know what it is please share with us all.

    (tip by mrgoblin) open a cygwin prompt and do the following commands (assumes you have sed installed)

    cd /lib/pkgconfig
    sed -i -e 's,^prefix=c:/.*$,prefix=/usr,' *.pc
    

UPDATE:
This is not needed anymore. You can install GTK2 and its development files from the Cygwin package database.

5. Compile

a. In your Cygwin prompt, navigate to the directory containing your DrQueue sources.
b. Compile with SCons.

$ scons

6. Install

Perform these steps on any Windows machines you want to add to your DrQueue set up as slaves. Assumes you already have a running master with a shared directory, mounted as a network drive on your Windows slaves.
  • From C:\cygwin\bin
    • cygintl-3.dll
    • cygiconv-2.dll
    • cygwin1.dll
  • From GTK\bin, copy all .dll files.
    a. Create your Environment variables. Go to Control Panel -> System, select the Advanced tab, and click the "Environment Variables" button. You need to create four new variables under "System Variables":
  • DRQUEUE_ROOT = <Your server's share, not C:\drqueue>
  • DRQUEUE_MASTER = <Your server's name or IP>
  • DRQUEUE_BIN = C:\drqueue\bin
  • CYGWIN = server
    a. Run your cygserver config script. In a Cygwin prompt:
    $ cygserver-config
    

    a. Start the Cygwin service. Go to Control Panel -> Administrative Tools -> Services, find the service "CYGWIN cygserver", right click on it, and select "start".
a. Create the directory where [[DrQueue]] will be installed. I used C:\drqueue; the following steps assume you did too.
a. From your [[DrQueue]] source directory, copy the directories bin, db, etc, logs, and tmp to C:\drqueue.
a. From your [[DrQueue]] source directory, copy all .exe files to C:\drqueue\bin.
a. From your [[DrQueue]] source directory, copy drqman\drqman.exe to C:\drqueue\bin.
a. Copy all needed .dll files to C:\drqueue\bin

And that's it! You may now run any of your DrQueue executables from C:\drqueue\bin.

UPDATE:
  • You can also install DrQueue in your Cygwin setup:
    scons install
    
  • Copying the Cygwin directory to other computers and configuring the 'cygserver' service should be enough for mass deployment.
  • The environment variables can also be configured in the .bashrc file of your user. Add the following via into '~/.bashrc':
    export DRQUEUE_ROOT=/usr/local/drqueue
    export PATH=$PATH:$DRQUEUE_ROOT/bin
    export DRQUEUE_MASTER=IP_OF_MASTER
    export CYGWIN=server
    
  • Opening a Cygwin shell window and typing the following should start the master (-o for output to shell):
    master.exe.CYGWIN_NT-5.1.i686 -o
    
  • The following (in another Cygwin shell window) should start a slave:
    slave.exe.CYGWIN_NT-5.1.i686 -o