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



On 3/13/07, Brecht Sanders <brecht sanders org> wrote:
 Hi,
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.

Great!


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)
#endif
EOF


* 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?


You can run "make check" which will compile what's in the "tests" dir
and execute unit tests (I need to add more unit tests there as there
are currently only query parsing tests).

You can also use the programs in the "tools" directory:
* gda-diagnose will produce HTML about a lot of things (this is
probably the first one you want to try)
* gda-author-dict-file can generate a .XML dictionary file for a connection
* gda-list-config can list the configured data sources

To run the tests, you'll need to have some database servers (MySQL,
PostgreSQL, Oracle, or SQLite file). I can send you a nice SQLite file
to start with if you want.

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.

Those one can go as-is into libgda, yes.

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.

Can you send a message on the gtk-devel mailing list about that
(gtk-app-devel-list gnome org)? If no solution is found, then you
should file a bug report in bugzilla.

What was the goal of the win32 directory?

I have no idea...

Can I tell the configure/make process not to use this?

Sure, remove the win32 line from the SUBDIRS definition in Makefile.am
(or in the Makefile file).


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.

Yes, the configure file is generated by the autotools. If you have
problems, I can send you mine (for the latest SVN version).

Is there another way I could approach this?

You could install the autotools in your environment and call the
autotools programs such as aclocal, autoheader, autoconf and automake.


Thanks
    Brecht Sanders

Thanks a lot for your time and work. I'd really like to have
Libgda/Libgnomedb on Windows...


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.


Thanks.

Vivien



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