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.
- [Install the MINGW Compiler. See http://www.mingw.org/wiki/HOWTO_Install_the_MinGW_GCC_Compiler_Suite]
You will need:
- [GNU Binutils: http://downloads.sourceforge.net/mingw/binutils-2.17.50-20060824-1.tar.gz]
- [GCC Version 3: http://downloads.sourceforge.net/mingw/gcc-core-3.4.5-20060117-3.tar.gz]
- [MINGW API for MS-Windows: http://downloads.sourceforge.net/mingw/w32api-3.12-mingw32-dev.tar.gz]
- [MINGW Runtime: http://downloads.sourceforge.net/mingw/mingwrt-3.15.1-mingw32.tar.gz]
Then install the
Now you should be able to open a MSYS shell and run gcc. Now install CMAKE.
- [For CMAKE unzip: http://www.cmake.org/files/v2.6/cmake-2.6.2-win32-x86.zip in the osync-build directory]
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
- [For SVN unzip: http://subversion.tigris.org/files/documents/15/44095/svn-win32-1.5.4.zip to the osync-build directory]
- [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:
- glib: http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.18/glib_2.18.2-1_win32.zip
- and the glib import libs: http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.18/glib-dev_2.18.2-1_win32.zip
- libxml2: http://www.zlatkovic.com/pub/libxml/libxml2-2.7.2.win32.zip
- libxslt: http://www.zlatkovic.com/pub/libxml/libxslt-1.1.24.win32.zip
- iconv: http://www.zlatkovic.com/pub/libxml/iconv-1.9.2.win32.zip
- zlib1: http://www.zlatkovic.com/pub/libxml/zlib-1.2.3.win32.zip
- sqlite3: http://www.sqlite.org/sqlitedll-3_6_6_1.zip - Copy the dll to the bin directory
- sqlite3: http://www.sqlite.org/sqlite-amalgamation-3_6_6_1.zip - Copy the sqlite3.h to the include directory.
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#
