wiki:trunk/windows

Windows Port of OpenSync

The current version (svn November 2008) of opensync does not work on windows. This page describes the activities to port opensync to windows. There has been some activity in the past, but it seems that there has been no recent work, so the port is broken. (See releases/0.2x/docOutdateds/0.2x/CompilingForWin32_with_MinGW?)

The general ticket for the windows port is ticket #893.

There are a number of plugins available. The activity here is focused to have a working thunderbird/lightning (see ticket #284) sync available for windows.

How to do it

The first idea was to use the build environment from Mozilla. A description of the Build Environmnet can be found here:  https://developer.mozilla.org/en/Windows_Build_Prerequisites . I used the Visual C++ 8 Express Edition (VC9).

After some evaluation I moved to the MINGW/MSYS environment, because the MINGW environment already provides some definitions and header files which are used on UNIX. In a MSVC environment you have to provide that on your own (e.g. pid_t...)

So after having something working on MINGW it requires additional work to make it compile with MSVC.

Things to be done

CMake

The CMake system has to be adapted. The find mechanism for the libraries has to be fixed.

Libraries

The two compilers for windows builds are MINGW and Microsoft Visual C (MSVC). When you want to use a shared library (dll) on windows, then you have the shared library and a corresponding import library. The import library does not contain code, but information how to access the code in the shared library. The naming style is:

  • [MINGW - import library is libXXX.dll.a; shared library libXXX.dll]
  • [MSVC - import library is XXX.lib; shared library XXX.dll]

The shared libraries are compatible, however the import libraries are not. But it is possible to create import libraries:  http://www.emmestech.com/moron_guides/moron1.html The tool pexport is used:  http://www.emmestech.com/software/pexports-0.43/download_pexports.html

MSVC

MSVC is not C99 compliant. It does not allow in-block variable definition. For MSVC it is necessary to modify the code for this. MINGW is gcc, so that works.

Process Creation

fork() does not work on windows. This section needs to be ported.

Queue System

The queue system needs to be ported.

Setting up the build environment

  • [Make a directory osync-build]

Install the following software below that directory.

You will need:

Then install the

Now you should be able to open a MSYS shell and run gcc. Now install  CMAKE.

Open the msys shell and go to your home directory. In the windows path this is <osync-build>/msys/home/<user>. Create a .profile file and modify it such that you add the cmake path to your PATH.

export OSYNCBUILDDIR=/f/osync-build
export PATH=${PATH}:${OSYNCBUILDDIR}/cmake-2.6.2-win32-x86/bin
  • [add the path to the .profile file]
export PATH=${PATH}:${OSYNCBUILDDIR}/svn-win32-1.5.4/bin

Now you can checkout the current source. Go to the osync-build directory and do

svn co http://svn.opensync.org/trunk opensync

Now add a directory "libs" to the osync-build directory and unzip the following libraries there:

Do that in such a way that all "bin" directories overlay, i.e. all dll files end up in one bin directory. Copy the sqlite3.dll file also to the bin directory.

For testing purposes you also need the check library but that only builds on windows with a patch. I submitted the patch here:  http://sourceforge.net/tracker/index.php?func=detail&aid=2339213&group_id=28255&atid=392815. You will have to build it on your own...

  • Add the <osync-build>/libs/bin to the PATH in the .profile file.

Status

November 2008: I installed the MINGW build environment, libraries. Modified the code to be compilable. I can run the tests.

March 2009: 39 tests fail and 225 pass. So still something to do but the end comes closer.

April 2009: 37 tests fail and 247 pass. See http://www.opensync.org/testing/index.php?project=OpenSync&date=20090420#