[gnome-db] Compiling libgda on win32 with MinGW/MSYS

I have continued my attempts to get libgda to compile for the win32 platform with MinGW/MSYS.
This time I had some success, though I haven't been able to do any testing yet nor did I include much of the database providers yet.
But I got libgda (tarball 2.99.5) compiled, linked and installed.

First I built all the dependancies myself from their current versions.
Also I use ActivePerl as perl interpreter.

My configure looks like this:
./configure --prefix=$MINGWPREFIX --disable-static --enable-shared --with-postgres=/mingw CFLAGS="-I$MINGWPREFIX/include/glib-2.0 -DLIBGDA_WIN32" LDFLAGS="-L$MINGWPREFIX/lib/glib-2.0" GMSGFMT=$MINGWPREFIX/bin/msgfmt MSGFMT=$MINGWPREFIX/bin/msgmerge XGETTEXT=$MINGWPREFIX/bin/xgettext

Then I make until I run into problems, address the problems and run make again.

Below are the tweaks I used to overcome individual obstacles.

* Issue:       strtok_r (reentrant version of strtok) does not exist on win32
* Solution:    define it as an alias for strtok (supposed to be reentrant safe on win32):
* Commands:
cat >> libgda/gda-decl.h << EOF
#ifdef G_OS_WIN32
  #define strtok_r(s,d,p) strtok(s,d)

* Issue:       libgda/gda-enum-types.h is generated with extra data on comment lines
               - MinGW/MSYS path before /*
               - /n after */
               probably a bug in glib-mkenums --fprod on glib2 for win32
* Solution:    to do: find why this is generated by glib-mkenums --fprod on win32 and fix it
* Workaround:  after configure change libgda/Makefile to not use --fprod
* Commands:
mv libgda/Makefile libgda/Makefile.bak
sed 's/--fprod \".*[^\\]\"//' libgda/Makefile.bak > libgda/Makefile

* Issue:       win32/libgda_graph-3.0.la and win32/libgda_handlers-3.0.la are zero sized
* Solution:    for some reason libgda/sql-delimiter/libgda_sql_delimiter-3.0.la is generated correctly
               so I just use a modified version of that (I know, it's a dirty workaround)
* Commands:
sed -e 's/libgda_sql_delimiter/libgda_graph/g' libgda/sql-delimiter/libgda_sql_delimiter-3.0.la > win32/libgda_graph-3.0.la
sed -e 's/libgda_sql_delimiter/libgda_handlers/g' libgda/sql-delimiter/libgda_sql_delimiter-3.0.la > win32/libgda_handlers-3.0.la

* Issue:       win32/.libs/libgda_sql_delimiter-3.0.dll.a is missing
* Solution:    libgda/sql-delimiter/.libs/libgda_sql_delimiter-3.0.dll.a exists so just use that
* Commands:
ln -s libgda/sql-delimiter/.libs/libgda_sql_delimiter-3.0.dll.a win32/.libs/libgda_sql_delimiter-3.0.dll.a

* Issue:       mkstemp does not exist on win32 but the following files refer to it
               - tools/gda-inspect-dict-file.c
               - testing/gda-test-sql.c
               - testing/gda-test-model-query.c
* Solution:    g_mkstemp does exist in glib2 so just use that
* Commands:
mv tools/gda-inspect-dict-file.c tools/gda-inspect-dict-file.c.bak
sed -e 's/mkstemp/g_mkstemp/g' tools/gda-inspect-dict-file.c.bak > tools/gda-inspect-dict-file.c
mv testing/gda-test-sql.c testing/gda-test-sql.c.bak
sed -e 's/mkstemp/g_mkstemp/g' testing/gda-test-sql.c.bak > testing/gda-test-sql.c
mv testing/gda-test-model-query.c testing/gda-test-model-query.c.bak
sed -e 's/mkstemp/g_mkstemp/g' testing/gda-test-model-query.c.bak > testing/gda-test-model-query.c

After this I can make install.

Like I said I haven't actually tested the results.
How can I run tests? I see there is a testing directory with executables. Do they need certain parameters and/or databases in order to actually run tests?

Can the solutions to the issues above be incorporated in libgda?
I'm sure at least the strtok_r and mkstemp ones are easy to fix.
The glib-mkenums --fprod issue could be a glib2 problem, I'm not sure.
Finally there are the problems with library related files in win32.
What was the goal of the win32 directory?
Can I tell the configure/make process not to use this?

One more question. I tried to get the latest SVN version and build that, but since there is no configure I could not do this. I assume the autoconf should generate those files but it just seems to choke.
Is there another way I could approach this?

    Brecht Sanders

P.S.: I'm glad I got this far. I was just about to give up since I also just compiled libdbi (see: http://libdbi.sourceforge.net/) with far less problems. But I believe libgda has a lot more to offer.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]