Compiling for Microsoft Windows

161 views
Skip to first unread message

David

unread,
Feb 3, 2011, 2:57:41 PM2/3/11
to osm-gps-map
I would like to compile OSM-GPS-Map for MS-Windows XP and Python 2.7.
I am unable to find instructions for doing this. I have made a few
attempts to do this using Mingw, but so far without success. Can
anyone tell me what is a working toolchain and how to satisfy the
dependencies?

John Stowers

unread,
Feb 3, 2011, 3:24:06 PM2/3/11
to osm-g...@googlegroups.com

There are windows builds to download on the website, but if you want
to compile yourself, the basic steps I use are (from memory)

1) Setup according to http://git.gnome.org/browse/pygtk/tree/README.win32
2) Get windows builds of libsoup, libxml etc. I'm not on my windows PC
at the moment, but when given multiple locations from which to
download libxml, choose the one on the GNOME servers. This should work
I think.
3) Download a osm-gps-map tarball. Build the windows C library,
./configure from inside a msys shell should work. Install the C
library to its own path and adjust PKG_CONFIG_PATH and LD_LIBRARY_PATH
4) Build the python bindings from the tarball. Execute

python setup.py build --compiler=mingw32 bdist_wininst
--user-access-control=auto

3) Finished. I hope!

If that does not work I can prepare more detailed instructions from my
windows PC

John

dlm

unread,
Jun 5, 2013, 1:43:20 AM6/5/13
to osm-g...@googlegroups.com
Having problems compiling osmgpsmap-0.7.3 on windows. What a mess...

Installed:
python2.7 (32 bits)
pygtk bundle for win32 python 2.7
mingw toolchain, msys, autoconf, automake (using mingw-get, this bought in libxml2)
libsoup from http://ftp.gnome.org/pub/gnome/binaries/win32/libsoup/
gnome-common from http://ftp.gnome.org/pub/gnome/binaries/win32/gnome-common/

A few issues along the way:
* Using the pygtk bundle caused problems with mingw, apparently because of the conflicting pkg-config
* Wasn't clear where libsoup and gnome-common needed to be placed, so had to add ACLOCAL_FLAGS etc
* Could find gtk-doc stuff, so I just stripped it out of autogen.sh, configure.ac etc
Eventually successfully compiled and ran the example!

Next I tried to get the python bindings to compile:
I used "python setup.py build ..."
* I had problems with this distutils issue: see http://stackoverflow.com/questions/13592192/compiling-pygraphviz-unrecognized-command-line-option-mno-cygwin
*  I had problems with paths to pygtk and osmgpsmap dependencies (presumably this is mostly caused by my pkg-config issues) but I worked around those
* Then the listed sources in setup.py are osmgpsmapmodule.c and osmgpsmap.c, but the latter is missing, and I get missing definitions if I drop it from the list.

So I'm stuck. Any hints?

Many thanks,
dm

dlm

unread,
Jun 5, 2013, 2:14:35 AM6/5/13
to osm-g...@googlegroups.com
I tried the following codegen:

codegen -o osmgpsmap.override osmgpdmap.defs >osmgpsmap.c

But that doesn't resolve the missing symbols errors:

undefined reference to 'pyosmgpsmap_functions'
..
undefined reference to 'pyosmgpsmap_register_classes'
..
undefined reference to 'pyosmgpsmap_add_constants'

Damien Moore

unread,
Jun 5, 2013, 2:49:10 AM6/5/13
to osm-g...@googlegroups.com

It looks like codegen is spitting out an error related to a key error on GdkEvent* (msys term doesn't allow cut and paste or I would paste something more informative). I give up for now...

--
You received this message because you are subscribed to the Google Groups "osm-gps-map" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osm-gps-map...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

dlm

unread,
Jun 5, 2013, 4:12:46 PM6/5/13
to osm-g...@googlegroups.com
For what it's worth I finally got the python bindings compiled, although the win setup package was broken because it was missing the osmgpsmap DLL (only the pyd file was present). I manually moved the files into place and was able to use the widget from python.

To compile the osmgpcmap.defs into osmgpsmap.c I used the following script:

#!/bin/sh
export CODEGENDIR=`pkg-config --variable codegendir pygtk-2.0` ##didn't work because it pointed to the wrong place
export PYGTKDEFSDIR=`pkg-config --variable defsdir pygtk-2.0` ## ditto
export CODEGENDIR="/C/Python27/Lib/site-packages/gtk-2.0/codegen"
export PYGTKDEFSDIR="/C/Python27/share/pygtk/2.0/defs"

python $CODEGENDIR/codegen.py \
    --register $PYGTKDEFSDIR/gtk-types.defs \
    --register $PYGTKDEFSDIR/gdk-types.defs \
    --override osmgpsmap.override \
    --prefix pyosmgpsmap osmgpsmap.defs > osmgpsmap.c



In summary, I think I would have a hard time replicating all of the steps I had to take to build the lib and bindings on a clean system. The major stumbling blocks:
1. pkg-config doesn't seem to know where all of the libs are because the mingw/pygtk bundle versions conflict, maybe there's a simple environment variable that enables a way to get the missing the pkg-config datafiles
2. I don't know how to install gtk-doc and it was a pain stripping out the dependency
3. python2.7's setup.py uses some cygwin flags that apparently aren't present in gtk anymore
4. osmgpsmap's windows build files for the python bindings seem to be out of date. It isn't simply a matter of python setup.py ... because (a) the codegen stuff needs to be called and (b) for some reason bdist doesn't pick up the libs

If anyone has some tips on how to fix some of these things, that would be helpful.
Reply all
Reply to author
Forward
0 new messages