Compiling Rdesktop for Win32

So you wanna have an opensource RDP client for Windows. Well .. no problem. Here is what you do:

Visit and download setup.exe. When downloaded, you must launch setup.exe and install a complete Cygwin environment. Cygwin is only needed when compiling Rdesktop, so don´t worry about the diskspace usage. You will get it all back again, when deleting cygwin.

When Cygwin has been installed, it´s time to visit, and download the latest release of the Rdesktop client. Save the tarball in the cygwin root folder, which defaults to c:\cygwin. At the time of writing, the latest version of Rdesktop is 1.6.0. When the package has been downloaded, it’s time to start the Cygwin XWin Server, and start compiling Rdesktop. Type the following commands into the shell, that starts with the X server:

tar -xf /rdesktop-1.6.0.tar.gz
cd rdesktop-1.6.0/
./configure --with-x --with-sound=oss; make; strip rdesktop.exe

Rdesktop has now been compiled (lucky you), and it’s time to collect all needed files for the RDP client, and create a single .zip file containing the Rdesktop Win32 distribution. Type the following commands into the shell for creating the Rdesktop distribution:

mkdir /Rdesktop-1.6.0-Win32
ldd rdesktop.exe | perl -ane 'print "cp \"$F[2]\" \"/Rdesktop-1.6.0-Win32\"\n" if !/cygdrive/i;' | sh
cp rdesktop.exe /Rdesktop-1.6.0-Win32
cp -r keymaps /Rdesktop-1.6.0-Win32
zip -9rq / /Rdesktop-1.6.0-Win32/*

By now you should have a Rdesktop distribution in your Cygwin root, named This .zip file contains all you need, to connect to your RDP compliant hosts (ie. Windows hosts), from any Win32 computer:

rdesktop.exe [hostname]


If you are having trouble with compiling your own Rdesktop client, you may choose to download the package that I created for this article:

If you should see the following error message:

ERROR: Failed to open display:

.. then your X-server is not running (download and install Xming if you need one), or your DISPLAY environment variable is not set. Set the needed variable with this command:


New additions to this post:

18/04/2011: has been compiled using this guide.

30/03/2012: has been compiled using this guide – and a slightly modified version has been created for creating a Windows Installer MSI: Rdesktop-1.7.1-Win32.msi

Inline images in Perl/TK applications.

Here you see a screenshot of an Perl/TK application, which isn´t quite like other Perl/TK applications. The difference between this and almost all the other TK applications you may be using, is that this application has all the nice images included in line. Wow .. this is neat stuff, but how is it done?

Sit back, and i’ll tell ya. :-)


Well .. first of all, you need to organise all the .gif images, that the application need, in a directory structure that makes sense. It could look something like this:


When the images has been organized, you need to create a script, that will convert the imagedata to plain text. This script is called, and must be located just outside the images directory. Here is the code for the script:

use GD;
use MIME::Base64;
foreach (<images/*>) {
   my $type = (split/\//, $_)[1];
   foreach (<$_/*.gif>) {
      my $name = (split /\./,((split/\//, $_)[2]))[0];
      print "Adding imagedata to datafile: $type/$name ($_).\n";
      open (GIF, $_);
      my $imagedata = encode_base64((newFromGif GD::Image(GIF))->gif);
      close GIF;
      $data .= "\n<" . $type . "/" . $name . ">\n" . $imagedata;
open (DATA, ">graphicsdata.txt");
print DATA $data;
close DATA;

When the script has been executed, you will have a text file named graphicsdata.txt, while contains all the images as clear text. It should look like this:


xGqQxmuRx2uSyG2TyW2Uym6Vy2+WzG+XzXCXzXCYznGZz3Kb0XOb0XSc0nWe1Heg1oOfdIGrYYWh ...


So far so good. Using the generated imagedata, it´s time for creating a script that holds the imagedata within the script:

use Tk;
my $ImageData = <<ENDOFGRAPHICS;
$MW = MainWindow->new(-title => "Inline image demo");
$WIDGETS{'Image'} = $MW->Label(
   -image => $MW->Photo("Image", -data => $ImageData))->grid(
      -row    => 1,
      -column => 1,
      -padx => 100,
      -pady => 100);
$MW->resizable(0, 0);

Voilá. That´s all that is to it. :-)