Windows

From GnuCash
Revision as of 12:45, 10 March 2006 by Cstim (talk | contribs) (guile)
Jump to: navigation, search

GnuCash on Microsoft Windows

This page collects various notes about potentially compiling GnuCash on Microsoft Windows.

FAQ: Is it possible to compile GnuCash on Windows? A: Currently, no. However, with the 1.9.x/2.0.0 series now being released, gnucash is fully based on gtk2. This means it will probably be rather easy to finish a full windows port. "The other big application" Gnumeric already showed how to do it. Their UI code relies solely on gtk-2.0 (or 2.2 or whatever), i.e. they replaced every dependency on libgnomeui by its gtk equivalent. And gtk-2.2 is fully available on windows. Obviously they managed to do this somehow, so I suspect it shouldn't be too difficult to do the same with gnucash. Also, one of our smaller competitors, Grisbi http://sourceforge.net/projects/grisbi , is offering a windows port by this very same strategy.

Relevant recent gnucash-devel discussion:

Status: It is possible to compile all prerequisites successfully. It remains an open question how to approach the full gnucash package. --Cstim 07:55, 3 March 2006 (EST)

Prerequisites

Mingw32

See http://www.mingw.org . All available as pre-compiled binaries.

Many other pre-compiled binaries are also available from http://gnuwin32.sf.net/ . (All gtk-related packages like pkgconfig and libxml2, however, are already included in the large glade package, see below.)

SVN

There is an SVN client for windows. You can find one at: http://tortoisesvn.tigris.org

guile

In guile-1.6.7 several tweaks were necessary to get it to compile.

  • File libguile.c line 479: replace "#elif defined(FIONREAD)" by "#elif 0"
  • File libguile-ltdl/raw-ltdl.c lines 220, 222, 224: remove the LT_GLOBAL_DATA macro on each line
  • Files srfi/Makefile, libguile-ltdl/Makefile, libguile/Makefile: Add "-no-undefined" argument to libxyz_LDFLAGS variables, see also [1]
  • And finally set the env variable GUILE_LOAD_PATH to the actual load path, which is different from the one that was stored during compile due to mingw's path translation. Make e.g. export GUILE_LOAD_PATH=c:/msys/1.0/local/share/guile/1.6/

One possible set of configure arguments looked like this:

./configure --disable-elisp --disable-networking --disable-dependency-tracking --disable-libtool-lock --disable-linuxthreads -C --prefix=/usr/local LDFLAGS="-L/lib -L/mingw/lib -L/C/WINNT/system32 -lwsock32 -lregex"

For testing, first try to make sure "guile -v" will run and give you the version number. Then try a simple expression, like "guile -c '(display %load-path)'". However, so far I was unable to actually start the interactive interpreter (by simple "guile") because the readline library is unavailable. So running "guile" will give "ERROR: In procedure quasiquote: ERROR: Unbound variable: SIGBUS".

Also, the code generation in g-wrap does not yet work as well, because the DLLs for srfi-13-14 for whatever reason cannot be loaded.

g-wrap

See http://savannah.nongnu.org/bugs/index.php?func=detailitem&item_id=15972

Status: Compile is possible.

Frequent error: If you get the following linker error:

C:/msys/1.0/mingw/bin/../lib/gcc/mingw32/3.4.4/libgcc.a(w32-shared-ptr.o):: 
undefined reference to `_imp__GetAtomNameA@12'
undefined reference to `_imp__FindAtomA@4'
undefined reference to `_imp__AddAtomA@4'
undefined reference to `_imp__FindAtomA@4'

then it means that your windows DLL directory showed up first before your mingw DLL directory, i. e. the gcc linker command has -Lc:\WINNT\system32 before -L/mingw/lib. This wrong order might be caused from other, linked-in libraries, like from the libguile.la file in guile's library installation. To fix this: Edit the libguile.la file, remove -Lc:\WINNT\system32 so that you can correctly enfore that /mingw/lib comes first in the library search path.

glade

http://gladewin32.sourceforge.net This project offers a large (10MB) Installer which also includes all the rest of the gtk/glib platform, including pkgconfig, libxml2 and various other tools.

glib

http://www.gtk.org/download/ has binary windows packages, but the binary is already included in the glade installer above, so no separate download is necessary.

gnome

A lot of windows binaries for gnome packages missing in the glade package can be found at ftp://ftp.gnome.org.

GConf, Orbit2, gail, gnome-{common, mime-data, vfs}, intltool, libIDL, libart_lgpl, libbonobo{,ui}, libgnome{,canvas,ui} and pango can be found at:

Libgnomeprint, libgnomeprintui and libgtkhtml can be found at:

Gnucash

Instructions on how to tweak ./configure so that it doesn't complain about the missing gnome packages:

As gnucash uses symbolic links quite a lot, in the first build trials we used a trick to make use of symlinks: We completed a normal build on a SMB networked filesystem from a Linux computer, and then accessed that very same directory from windows. This way, the symlinks appear as normal directories from windows. Also, for whatever reason g-wrap didn't run on windows, so by using this SMB share, the Linux-generated g-wrap wrappers would simply be recompiled on Windows.

The ./configure line used was

./configure --disable-error-on-warning \
  LDFLAGS="-no-undefined -L/lib -L/mingw/lib -L/C/WINNT/system32 -lwsock32 -lregex" \
  CFLAGS="-I/usr/include -I/usr/local/include" \
  PKG_CONFIG=/c/GTK2-8-10/bin/pkg-config \
  LD_LIBRARY_PATH=/c/GTK2-8-10/lib PATH="/c/GTK2-8-10/bin:$PATH"

TODO

We collect various TODO-items that need to be solved in order to compile gnucash on Windows.

  • ln -s - The windows file systems don't have symlinks. GnuCash uses symlinks extensively all over the build system. The literal ln -s has been replaced by the macro LN_S. This still won't work in all cases because gnucash relies upon content that is created later in the symlinked directory, i.e. simply making a copy is IIRC not sufficient.
  • Stack size of guile -- When guile gives the error ERROR: Stack overflow, you need to modify the scm-file in question and change the line (debug-set! stack 200000) to this value.
  • src/app-utils/Makefile.am and others: Replace GNOME_CFLAGS by GTK_CFLAGS in CFLAGS variable if we don't need gnome.

The more tricky build errors have to do with file systems and process forks. In src/backend/file:

gnc-backend-file.c: In function `gnc_file_be_get_file_lock':
gnc-backend-file.c:128: error: `EOPNOTSUPP' undeclared (first use in this function)
gnc-backend-file.c:128: error: (Each undeclared identifier is reported only once
gnc-backend-file.c:128: error: for each function it appears in.)
gnc-backend-file.c: In function `gnc_int_link_or_make_backup':
gnc-backend-file.c:335: error: `EOPNOTSUPP' undeclared (first use in this function)
io-gncxml-v2.c: In function `try_gz_open':
io-gncxml-v2.c:1221: error: `_O_BINARY' undeclared (first use in this function)
io-gncxml-v2.c:1221: error: (Each undeclared identifier is reported only once
io-gncxml-v2.c:1221: error: for each function it appears in.)

Comments to this on IRC:

<warlord> windows certainly has an equivalent of link()
<warlord> It should have some equivalent of gethostid()
<warlord> it certainly has sleep(), or an equivalent thereof.
<warlord> it probably doesn't have pipe -- I'm not sure if there's a better way to use zlib.
<warlord> cstim: do you have "windows services for unix" installed?
<cstim> errr... not that I know of.
<warlord> You might want to install that.
<warlord> That should give you more unixy interfaces.
<warlord> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnucmg/html/UCMGch04.asp