User Tools

Site Tools


wiki:development:build-howto-mswin:x2goclient

This is an old revision of the document!


Build X2GoClient and 3rd-party programs for MS Windows

This howto explains how to build the MS Windows version of X2Go Client.

This howto explains how to build the 32-bit version of X2Go Client on MS Windows. If someone successfully attempts a 64-bit (which should work, but needs to be tested), please contribute to this wiki page.

This howto is intended for 2 different audiences:

  1. Those doing official X2Go Project builds.
  2. Those doing informal builds, persona builds, or builds for use within their organization.

The former audience has extra steps to do. These steps will be noted.

Overview of third-party components

X2Go Client for Windows needs several 3rd-party programmes for being able to run on MS Windows:

  • PuTTY for Kerberos 5 (GSSAPI) authentication

All these programmes, as well as many of the libraries, can now be downloaded from x2goclient-contrib.git. Older versions are available from our server

They can also be built from source, or downloaded from their project sites. However, this howto only explains how to build nxproxy and OpenSSH.

You can also copy the 3rd-party components from X2Go Client installation (on MS Windows) directory.

Build Utilities

For building X2Go Client, we highly recommend to install MSysGit and Notepad2.

MSysGit provides a Unix-like shell (bash) environment, so that you can use Git easily from the command line.

For official X2Go project updates to x2goclient-contrib, use Cygwin. It handles symlinks differently.

Notepad2 is a freeware alternative to Notepad shipped with Microsoft Windows. Notepad2 understands UTF-8 text formats (and others) and can handle Unix-style line endings. In case you want to introspect a code file, this tool is very handy.

Setup Build Environment

Installing MinGW (Current Version)

MinGW is a gcc compiler for Windows. You need it to build X2Go Client.

Since X2Go Client 4.0.3.0, X2Go Client uses Qt 4.8.6 specifically. Qt 4.8.6 uses MinGW 4.8.x. Qt 4.8.6 for Windows recommends this specific build of MinGW, so it is this specific build that you should use.

http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.8.2/threads-posix/dwarf/i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z

Extract it to your disk (D:\i686-4.8.2-release-posix-dwarf-rt_v3-rev3\mingw32 in this example).

Finally, you have to add these MinGW executable directories to your PATH environment variable: D:\i686-4.8.2-release-posix-dwarf-rt_v3-rev3\mingw32\bin, D:\i686-4.8.2-release-posix-dwarf-rt_v3-rev3\mingw32\libexec\gcc\i686-w64-mingw32\4.8.2.

Installing MinGW (Old Version)

Using Qt 4.8.5 + MinGW 4.4 is still an option for building X2Go Client 4.0.3.0 and later. It was how X2Go Client 4.0.2.1 and many prior versions were built. Unfortunately, you can not download binaries for this version from MinGW project site any more. You can build it from source or download it from X2Go Site

Extract it to your disk (D:\mingw in this example).

Finally, you have to add these MinGW executable directories to your PATH environment variable: D:\mingw\bin, D:\mingw\libexec\gcc\mingw32\4.4.0.

Installing Qt (Current Version)

You need Qt to build X2Go Client from source.

Qt-4.8.6 is tested and recommended for X2Go Client 4.0.3.0 and later.

Download and install the MinGW version of Qt-4.8.6 for Windows from here

In this example D:\Qt\4.8.6 will be chosen as installation directory

Installing Qt (Old Version)

Qt-4.8.5 was tested and recommended for X2Go Client 4.0.2.1 and earlier. It is still an option for X2Go Client 4.0.3.0 and later.

Download and install the MinGW version of Qt-4.8.5 for Windows from here

In this example D:\Qt\4.8.5 will be chosen as installation directory

Configuring Qt

Providing OpenSSL support in Qt

As X2Go Client needs a Qt with SSL support you must install OpenSSL for MS Windows. OpenSSL depends on the Microsoft Visual C++ 2008 Redistributables. Get that (32-bit version, x86) from the Microsoft site and install it prior to installing OpenSSL.

Download the OpenSSL installer for Windows by browsing here and selecting “Win32 OpenSSL v1.0.1*” where “1.0.1*” s the current version. You can also download it from our site, but only do so if we have the current version. Install it on your build system (for example to directory d:\OpenSSL-Win32).

After installation, copy OpenSSL header files into MinGW's include directory:

For MinGW 4.8:

d:\OpenSSL-Win32\include\openssl -> d:\i686-4.8.2-release-posix-dwarf-rt_v3-rev3\mingw32\i686-w64-mingw32\include\openssl

For MinGW 4.4:

d:\OpenSSL-Win32\include\openssl -> d:\mingw\include\openssl

Static builds of Qt with SSL support

It is recommended to configure Qt to build statically linked applications.

This is how official X2Go Client builds are done

It will take some time to reconfigure Qt for static builds. You surely can skip this step, but in this case you must provide Qt libraries with your X2Go Client binary.

Open Qt Command Prompt and start configuration script.

For Qt 4.8.6, the command needs extra args due to QTBUG-38706:

$ configure -release -static -openssl -qt-style-windowsxp -qt-style-windowsvista

For Qt 4.8.5:

$ configure -release -static -openssl

For either version of Qt, rebuild Qt:

$ make sub-src

Dynamically linked builds of Qt with SSL support

If you choose to build dynamically linked applications with Qt, you still have to rebuild Qt in order to get OpenSSL support into Qt.

Open Qt Command Prompt and start configuration script.

For Qt 4.8.6, the command needs extra args due to QTBUG-38706:

$ configure -release -openssl -qt-style-windowsxp -qt-style-windowsvista

For Qt 4.8.5:

$ configure -release -openssl

For either version of Qt, rebuild Qt:

$ make sub-src

Installing libssh

You need libssh to build X2Go Client.

X2Go Client 4.0.3.0 and later use libssh 0.6.3 with pageant support.

Get the library package built with MinGW 4.8.x (currently 4.8.2) from x2goclient-contrib.git

Or for MingW 4.4.0, here on our site. And then extract files from archive.

Copy headers files in “include” directory of MinGW.

For MinGW 4.8:

x2goclient-contrib\libssh\0.6.3-762055b-pageant-support-mingw482_bin\include\libssh -> d:\i686-4.8.2-release-posix-dwarf-rt_v3-rev3\mingw32\i686-w64-mingw32\include\libssh

For MinGW 4.4:

libssh\include\libssh -> d:\mingw\include\libssh

Copy library files in “lib” directory of MinGW

For MinGW 4.8:

x2goclient-contrib\libssh\0.6.3-762055b-pageant-support-mingw482_bin\lib\*.* -> d:\i686-4.8.2-release-posix-dwarf-rt_v3-rev3\mingw32\i686-w64-mingw32\lib\

For MinGW 4.4:

libssh\lib\*.* -> d:\mingw\lib\

Build X2Go Client

Build X2Go Client from source

Open Qt Command Prompt, change to your build directory and get X2Go Client sources from git

$ git clone git://code.x2go.org/x2goclient.git
$ cd x2goclient

Generate the changelog, which x2goclient.exe –changelog will show:

$ copy debian\changelog txt\
git --no-pager log --since "2 years ago" --format="%ai %aN (%h) %n%n%x09*%w(68,0,10) %s%d%n" > ChangeLog.gitlog
$ copy ChangeLog.gitlog txt\git-info

Build X2Go Client:

$ cd x2goclient
$ PATH=%PATH%;D:\i686-4.8.2-release-posix-dwarf-rt_v3-rev3\mingw32\bin\
$ config_win.bat
$ mingw32-make
$ cd x2gohelper
$ mingw32-make
$ cd ..

X2Go Client binaries (x2goclient.exe & x2gohelper.exe) are in d:\build\x2goclient\release\ directory.

Build X2Go Client from source (debug build)

Repeat the instructions for “Build X2Go Client from source”, except

  1. Before running config_win.bat, edit x2goclient.pro so that “CONFIG += console” is uncommented
  2. Edit nsis\x2goclient.nsi so that the following lines:
  • CreateShortCut “$INSTDIR\X2Go Client.lnk” “$INSTDIR\x2goclient.exe”
  • CreateShortCut “$SMPROGRAMS\$STARTMENU_FOLDER\X2Go Client.lnk” “$INSTDIR\x2goclient.exe”
  • CreateShortCut “$DESKTOP\X2Go Client.lnk” “$INSTDIR\x2goclient.exe”

Are replaced with the following:

  • CreateShortCut “$INSTDIR\X2Go Client.lnk” “$INSTDIR\x2goclient.exe” “–debug”
  • CreateShortCut “$SMPROGRAMS\$STARTMENU_FOLDER\X2Go Client.lnk” “$INSTDIR\x2goclient.exe” “–debug”
  • CreateShortCut “$DESKTOP\X2Go Client.lnk” “$INSTDIR\x2goclient.exe” “–debug”

Copy the X2Go Client binaries to the desired folder

The 2 binaries to copy are.

  1. x2goclient.exe (from the release/ folder)
  2. x2gohelper.exe (from the release/ folder)

However, you must decide where you wish to copy them.

  1. If you wish to run x2goclient from a folder without creating and running the NSIS installer , copy them to the dist folder.
  2. If you wish to run x2goclient from a folder without creating and running the NSIS installer , create the nsis\x2goclient folder and copy them there

Pack/Compress X2Go Client

You may want to pack X2Go Client to reduce it size. You can do it with upx, which is available for Windows, Linux and Cygwin.

It is available in x2goclient-contrib.git. The current version is located at:

x2goclient-contrib\upx\3.91_bin\upx.exe

Building nxproxy & OpenSSH (Optional)

Building a new version nxproxy or OpenSSH is optional for non-official X2Go project builds.

Official X2Go project builds usually rebuild nxproxy and OpenSSH if there are desired updates to those components, or if the cygwin libraries have been updated.

Installing Cygwin

Download and start the Cygwin installer

Choose your cygwin directory. For example c:\cygwin. Follow installer instructions.

on installer page “Select Packages” you can select programs and libraries that should be installed in your cygwin environment. For building of nxproxy you will need:

  • autoconf
  • automake
  • gcc-core
  • gcc-g\+\+
  • git
  • libX11-devel
  • libjpeg-devel
  • libpng15-devel (X2Go Client 4.0.3.x)
  • libpng-devel (X2Go Client 4.0.4.x)
  • libmpfr4
  • make
  • mc
  • zlib-devel
  • wget
By installing the libjpeg-devel package, you are now installing libjpeg-turbo instead of the legacy libjpeg . The same applies for the dependency libjpeg8 package, which provides the cygjpeg-8.dll file that you will copy later.

For building of OpenSSH Server, you will also need::

  • libedit-devel
  • libncurses-devel
  • openssl-devel
  • patch

For openssh you should install both, binary and source packages (toggle “Src” checkbox beside of package name). Source package will be installed in /usr/src directory in your Cygwin installation.

If you are updating the X2Go Windows build VM, X2Go-WinBuilder, install these packages too:

  • bashdb
  • bash-completion
  • chere
  • colorgcc
  • colordiff
  • diffutils
  • dos2unix
  • cygcheck-dep
  • cygutils-extra
  • indent
  • renameutils
  • vim
  • git-completion
  • patch
  • patchutils
  • openssh
  • xz
  • unzip
  • nano
  • bzip2
  • time

If you are doing official builds, install these source packages for both nxproxy and openssh:

  • dash
  • cygwin
  • gcc (select source for: gcc-core)
  • libedit (select source for: libedit0)
  • libjpeg-turbo (select source for: libjpeg-devel)
  • libpng15 (select source for: libpng-devel) (X2Go Client 4.0.3.x)
  • libpng (select source for: libpng-devel) (X2Go Client 4.0.4.x)
  • ncurses (select source for: libncurses-devel)
  • openssh (source, but not binary)
  • openssl
  • zlib (select source for: zlib-devel)

Building nxproxy

  • Open a cygwin shell and change to your build directory. In this example d:\Build will be used
$ cd /cygdrive/d/Build
Do not download and use the sources from git. Unlike the tarball, the git sources do not have the X2Go project's patches (debian/patches/) applied. (Technically, you could use the sources from git and apply the patches manually.)
$ wget http://code.x2go.org/releases/source/nx-libs/nx-libs-3.5.0.27-lite.tar.gz
$ tar -xvzf nx-libs-3.5.0.27-lite.tar.gz
$ cd nx-libs-3.5.0.27

Fix building with libpng15 (X2Go Client 4.0.3.x):

diff --git a/Pgn.cpp.orig b/Pgn.cpp
index cdcde84..1f56787 100644
--- a/nxcomp/Pgn.cpp.orig
+++ b/nxcomp/Pgn.cpp
@@ -28,7 +28,7 @@
 #endif
 #include <unistd.h>
 #include <stdio.h>
-#include <png.h>
+#include <libpng15/png.h>

 #include "Unpack.h"
 #include "Pgn.h"
diff --git a/configure.in.orig b/configure.in
index 6fa9757..b0699bb 100644
--- a/nxcomp/configure.in.orig
+++ b/nxcomp/configure.in
@@ -385,7 +385,7 @@ AC_SUBST(ALL)

 if test "$CYGWIN32" = yes; then
     ALL="\$(LIBCYGARCHIVE) \$(LIBCYGSHARED) \$(LIBARCHIVE)"
-    LIBS="-lstdc++ -lpng -ljpeg -lz"
+    LIBS="-lstdc++ -lpng15 -ljpeg -lz"
 else
     ALL="\$(LIBFULL) \$(LIBLOAD) \$(LIBSHARED) \$(LIBARCHIVE)"
 fi
diff --git a/nxproxy/configure.in.orig b/nxproxy/configure.in
index b86828d..5858b36 100644
--- a/nxproxy/configure.in.orig
+++ b/nxproxy/configure.in
@@ -159,7 +159,7 @@ dnl GCC 3.3.x requires also the z, png and jpeg libraries. This is
 dnl not true anymore since GCC 3.4.x.

 if test "$CYGWIN32" = yes; then
-    LIBS="$LIBS -L../nxcomp -lXcomp -lstdc++ -Wl,-e,_mainCRTStartup -ljpeg -lpng -lz"
+    LIBS="$LIBS -L../nxcomp -lXcomp -lstdc++ -Wl,-e,_mainCRTStartup -ljpeg -lpng15 -lz"
 else
     LIBS="$LIBS -L../nxcomp -lXcomp"
 fi
  • Build nxcomp
$ cd nxcomp
$ autoconf
$ ./configure
$ make
$ cd ..
  • Build nxproxy
$ cd nxproxy
$ autoconf
$ ./configure
$ make
$ cp -p nxproxy.exe nxproxy.exe.unstripped
$ strip nxproxy.exe
$ cd ..

Copying the nxproxy binaries

Now the nxproxy binary (nxproxy.exe) is ready. You can copy it into the programme packaging folder (dist/ or nsis/x2goclient/) of X2Go Client.

  1. From nxproxy directory (d:\Build\nx-libs\nxproxy) - nxproxy.exe
  2. From nxcomp directory (d:\Build\nx-libs\nxcomp) - cygXcomp.dll

You must also copy required libraries into that folder.

  1. From cygwin directory (c:\cygwin\bin):
    • cyggcc_s-1.dll
    • cygjpeg-8.dll
    • cygpng15-15.dll
    • cygstdc\+\+-6.dll
    • cygwin1.dll
    • cygz.dll

If you wish to facilitate debugging, or if you are updating x2goclient-contrib, you should copy these files over also:

  1. From nxproxy directory (d:\Build\nx-libs\nxproxy) - nxproxy.exe.unstripped
  2. From nxcomp directory (d:\Build\nx-libs\nxcomp):
    • libXcomp.dll.a
    • libXcomp.a

Building OpenSSH Server

Copy the source folder (downloaded and extracted from a tarball by cygwin) to your build directory. In this example d:\Build will be used

$cp -pr /usr/src/openssh-6.1.1p1-3-src /cygdrive/d/Build/

cd to the openssh source directory, extract the upstream (openssh.com) tarball within, and cd to the lower-level source directory

$cd /cygdrive/d/Build/openssh-6.6.1p1-3
$tar -xzvf openssh-6.6p1.tar.gz
$cd openssh-6.6p1

Apply any patches that cygwin provides. For example, with 6.6p1-3:

$patch < ../curve25519-sha256.patch

Get and apply the X2Go patch, which enables use of the Open SSH Server with X2Go Client

$wget http://code.x2go.org/releases/source/openssh-cygwin/openssh-6.6p1-1.x2go.patch ../
$patch.exe < ../openssh-6.6p1-1.x2go.patch

Build Open SSH Server

$./configure --libexecdir=/usr/sbin --with-libedit --with-xauth=/usr/bin/xauth --build=mingw32w32
$make
$strip *.exe
The command above is based on the command that Cygwin uses for their official builds, but with certain changes in order to eliminate unnecessary dependencies. Eliminating unnecessary dependencies decreases how frequently X2Go Client for Windows needs to rebuilt in order to include security patches for those dependencies.

Copying OpenSSH Server binaries

Open SSH Server binaries are ready. Now you can copy them in to the installation directory of x2goclient:

  • sftp.exe
  • sftp-server.exe
  • ssh-keygen.exe
  • sshd.exe

To be able to run Open SSH Server you should also copy needed programs and libraries from cygwin directory (c:\cygwin\bin).

1st, copy these files over without changing their filenames.

  • cygcrypto-1.0.0.dll
  • cygedit-0.dll
  • cyggcc_s-1.dll
  • cygncursesw-10.dll
  • cygssp-0.dll
  • cygwin1.dll
  • cygz.dll

2nd, copy the Dash executable over and rename it:

ash.exe -> sh.exe

Some of these libraries are also used by nxproxy. Open SSH Server and nxproxy should be built using same version of Cygwin.

This section needs to be updated for the .csv file that lists Cygwin packages and versions, and for the zip files on http://code.x2go.org/releases/ that contain pre-built binaries.

Copying 3rd-party libraries and components

Overview

To make X2Go Client usable on Windows, all libraries and components must be in the some directory as where the 2 binaries are.

All of the files referenced below (except for the OpenSSL-Win32 library, which you installed previously) can be obtained from x2goclient-contrib.git on http://code.x2go.org

In the previous step, you chose either the dist or nsis/x2goclient folder. To this folder you have to add the following components:

  • libraries
  • nxproxy with libraries
  • Open SSH Server with libraries (optional)
  • PuTTY
  • VcXsrv
  • PulseAudio (optional)

Scripted Copying

You can then install all of them by using the copy-deps-win32.bat script in the x2goclient source folder.

The scripted approach is limited to MinGW 4.8.

1st, clone x2goclient-contrib.git on http://code.x2go.org if you haven't already done so.

2nd, update the copy-deps-win32.bat script.

  • Do a find & replace in the script to replace the path to x2goclient-contrib with your own.
  • Do a find & replace in the script to replace the path to OpenSSL32-Win32 with your own.

Now run the script, telling it to copy to the dist folder

cd x2goclient
copy-deps-win32.bat dist

or to the nsis/x2goclient folder

cd x2goclient
copy-deps-win32.bat nsis/x2goclient

Scripted Copying (debug builds)

Follow the instructions for Scripted Copying.

However, at the end:

  1. View the copy-deps-win32.bat file to determine the location of the cygwin bundle.
  2. From the cygwin bundle, copy nxproxy.exe.unstripped to the dist or release/x2goclient folder.
  3. Replace nxproxy.exe with nxproxy.exe.unstripped

Manual Copying

Libraries

  1. If you are using MinGW 4.4, add its libraries (copy from D:\MinGW\bin)
    • libgcc_s_dw2-1.dll
    • mingwm10.dll
  2. If you are using MinGW 4.8, add its libraries (copy from D:\i686-4.8.2-release-posix-dwarf-rt_v3-rev3\mingw32\bin). (Note that the inclusion of '\' character before the '+' character is to work around a horrible issue in dokuwiki; the actual filenames do not have the '\“ character.)
    • libgcc_s_dw2-1.dll
    • libstdc\+\+-6.dll
    • libwinpthread-1.dll
  3. Add OpenSSL libraries (copy from your OpenSSL installation directory)
    • libeay32.dll
    • ssleay32.dll
    • libssh.dll
  4. libzip library (available here on our site) (binaries originally from the KDE Windows project site)
    • libzip.dll
  5. zlib library for libzip (available here on our site) (binaries originally from the KDE Windows project site )
    • libz.dll
  6. zlib library for libssh (available here on our site) (binaries originally from the zlib project site)
    • zlib1.dll
  7. If you want to use X2Go Client on older versions of Windows, you should put the “Microsoft Visual C\+\+ Redistributable 2008 Package”'s dll files into your X2Go Client package directory. (Originally downloaded from the Microsoft download site).
    • Microsoft.VC90.CRT.manifest
    • msvcm90.dll
    • msvcp90.dll
    • msvcr90.dll

nxproxy

The latest version is available in x2goclient-contrib.git under the cygwin folder. This includes its libraries.

You can download older versions, including their libraries, from here here.

OpenSSH server

X2Go Client for Windows uses a modified Cygwin OpenSSH Server for file sharing.

The latest version is available in x2goclient-contrib.git under the cygwin folder.

You can download older versions from here.

PulseAudio

The latest version of PulseAudio for Windows (5.0) is available in x2goclient-contrib.git under the pulse folder.

You can download older Windows builds here here.

Note that the files must be installed to the pulse subfolder of dist or nsis/x2goclient.

Even older Windows builds are available from project site and the above link.

VcXsrv - XP Compatible

The latest version is available in x2goclient-contrib.git under the VcXsrv folder.

You can download older versions, modified by the X2Go project, (VcXsrv - XP Compatible), here: http://code.x2go.org/releases/binary-win32/3rd-party/vcxsrv-modified-by-x2go-project/.

Note that the files must be installed to the VcXsrv subfolder of dist or nsis/x2goclient.

Building VcXsrv from source is not the part of this Howto. However, it is documented under the source repo

All official X2Go Project builds use the 32-bit builds of VcXsrv. 64-bit builds are probably compatible with the 32-bit X2Go Client, but have not been tested. Furthermore, the XP compatible builds are only offered in 32-bit.

If you are doing an official X2Go Project build of X2Go Client 4.0.3.x, use the version: 1.15.2.3+xp-vc2013+x2go1 The ”+x2go1“ in the version string implies that an X2Go-specific patch, winmultiwindow.patch has been applied. It is believed that this patch cannot be upstreamed.

If you do install VcXsrv via the setup installer, and you are building X2Go Client 4.0.3.x or later, select to install the fonts. They will be an optional component of X2Go Client for Windows in its installer.

If you do install VcXsrv via the setup installer, and you are building X2Go Client 4.0.2.1, deselect to install the fonts. They would more than double the size of the X2Go NSIS installer. Some legacy apps do need them, and users can install them if they'd like.

Also, if you are doing an official X2Go Project build, remove these files that X2Go Client does not need and would take up extra space:

  • iconv.dll
  • libgcc-s-sjlj-1.dll
  • libiconv-2.dll
  • libwinpthread-1.dll
  • libxml2.dll
  • libxml2-2.dll
  • plink.exe
  • uninstall.exe
  • xauth.exe
  • XCalc
  • xcalc.exe
  • XCalc-color
  • XClock
  • xclock.exe
  • XClock-color
  • Xcms.txt
  • xhost.exe
  • xlaunch.exe
  • xrdb.exe
  • xwininfo.exe

Also, if you are doing an official X2Go Project build, create this file in the VcXsrv folder:

  • vcxsrv-version.txt

And specify the version string of VcXsrv in it. The version string should be the only contents of the file. For example:

1.15.2.3+xp-vc2013+x2go1

PuTTY

you can download PuTTY for Windows from project site. Building PuTTY from source is not the part of this Howto

These are the only binaries you need from PuTTY. Copy them directly into the dist/ or nsis/x2goclient folder.

  • plink.exe
  • pscp.exe

Creating an NSIS Installer

Install NSIS Unicode (currently, 2.46.5): http://www.scratchpaper.com/

Then, edit nsis/x2goclient.nsi to replace all instances of X2GOCLIENT_VERSION with the actual version, and any string at the end. For example ,if you were doing a test build of fixing bug 123 on top of 4.0.3.2, 4.0.3.2-bug123

Then, open nsis\x2goclient.nsi with NSIS Unicode. It will build an installer (*-setup.exe) to the same directory.

If you wish to build via the command-line, run:

"C:\Program Files (x86)\NSIS\Unicode\makensis.exe" x2goclient.nsi

(Adjust path if on 32-bit Windows.)

wiki/development/build-howto-mswin/x2goclient.1424864436.txt.gz · Last modified: 2015/02/25 11:40 by mikedep333