initial qof compile trial on windows/mingw32

Christian Stimming stimming at tuhh.de
Tue Feb 28 09:06:02 EST 2006


Hi there,

since someone asked about a potential win32 port and since the qof part 
is available as a separate package, I though I could give it a try to 
compile that separate package on windows/mingw32. See http://mingw.org 
for more info on that build environment.

As for my machine: I have msys-1.0.10, msysdtk-1.0.1, mingw-5.0.0 on a 
windows2000 computer, which has gcc-3.4.4 and some similarly 
not-quite-recent software.

I can compile the major parts of qof; however, some functions that are 
available on Linux/MacOSX/BSD are unavailable on mingw32 and so the 
compile couldn't complete successfully.

One easy fix could be identified: The header <dlfcn.h>, used in 
qof/qofbackend.c and qof/qofsession.c, is unavailable on windows, but 
after that particular include has been removed, the two files could be 
compiled without error.

I will explain the rest of the problems below; parts of it might be 
#ifdef'd out by _WIN32; other parts might be replaced by glib wrappers 
if available (but I don't know any of them below). It's not at all 
trivial, but OTOH it looks as if it's actually easier than the gnome2 
porting task :-) So, for someone who really gets into this, qof might 
compile after a few hours of work, so the non-gnome parts of gnucash 
could probably be ported in a few days.

Christian


In particular, the following functions are unavailable on windows/mingw32:

strptime, localtime_p -- both are available in gnucash in lib/libc/, but 
not in the qof package

gmtime_r (in qof/gnc-date.c)
gettimeofday (in qof/qoflog.c, as well as struct timezone)
getppid, getlogin, getuid, getgid, gethostname (all in qof/guid.c)

And the following headers are also unavailable on windows/mingw32:

<sys/times.h> (in qof/guid.c)
and the function "times" is unavailable as well (in qof/guid.c)
<dlfcn.h> (in qofbackend.c and qofsession.c; can be removed)

For the curious, I'll add my configure argument to the qof-0.6.2 package:

./configure --disable-error-on-warning 
PKG_CONFIG=/c/msys/1.0/bin/pkg-config.exe 
LIBXML2_CFLAGS=-I/libxml2-2.6.23.win32/include 
LIBXML2_LIBS="-L/libxml2-2.6.23.win32/lib -llibxml2" CFLAGS=-I/usr/include

and during this, I noticed yet another problem with qof's build system. 
Note that I didn't specify a --prefix, which will give:

qof configuration summary:
===========================

CFLAGS      :    -Wdeclaration-after-statement    (sic!)
LDFLAGS     :
QOF_CFLAGS  :   -I/usr/local/include/qof
QOF_LIBS    :   -lqof -lqofsql
DWI_LIBS    :
LIBXML2     :   2.4.12        (sic!)
LIBGDA      :
prefix      :   /usr/local
data dir    :   /usr/local/share
XML dir     :   NONE/share/xml/qof/qsf
include dir :   /usr/local/include
lib dir     :   NONE/lib

oops, obvious problem with unused --prefix :

   $ grep NONE config.status
s, at CATOBJEXT@,NONE,;t t
s, at QSF_SCHEMA_DIR@,NONE/share/xml/qof/qsf,;t t
s, at BACKEND_SCHEMA_DIR@,NONE/share/xml/qof/,;t t
s, at QSF_LIB_DIR@,NONE/lib,;t t

@Neil: You must use ${prefix} here in a way so it is *not* evaluated 
during ./configure (which it currently is), but the string "${prefix}" 
must be passed in precisely this way into the Makefiles, so that it will 
be evaluated there and then correctly. During the ./configure run, a 
non-specified will mean the variable ${prefix} has the value NONE; 
therefore you shouldn't evaluate the variable during ./configure but 
instead only later in the Makefile, where it will have the correct 
value. Gnucash already does it correctly; you should probably copy the 
relevant parts to qof.

@Neil 2nd: The AC_PROG_INTLTOOL macro from configure.in checks various 
things; it also checks for the XML::Parser module of Perl, which isn't 
used in the qof package at all (and I didn't know how to install it on 
mingw32). That check can be disabled if you modify the macro call in 
configure.in as follows:
-AC_PROG_INTLTOOL
+AC_PROG_INTLTOOL([], [no-xml])
That would be a small simplification for that esoteric build 
environment. However, for gnuacsh that part of intltool will be needed, 
so someone who really wants to compile gnucash on mingw32 has to find a 
different solution to this anyway.


More information about the gnucash-devel mailing list