[GRASS-dev] fixes for Windows

Glynn Clements glynn at gclements.plus.com
Tue Dec 15 22:01:54 EST 2009


Michael Barton wrote:

> With help from Glynn Clements, I was able to fix the bug that  
> prevented NVIZ for TclTk from running from the wxPython menu. I also  
> added the TclTk digitizer to the menu. So now Windows users will have  
> easy access to 3D rendering and digitizing (without requiring that  
> msys be loaded) until the wxPython equivalents can be implemented in  
> Windows.

FWIW, with a bit of hacking, I managed to get vdigit and nviz to
compile with MinGW, but both fail at the linking step with a
"ld.exe has encountered a problem ..." dialog. That's as far as I have
got so far.

Issues:

1. The lack of python-config and wx-config scripts. I just created
scripts which give the right answers for my system.

2. The setup.py build system passes the Platform.make settings to gcc
without going through the shell, which means that the MSys-style
pathnames don't get translated to valid Windows pathnames.

I got around this by inserting the following into setup.py:

	mounts = [('/c/', 'c:/'),
		  ('/usr/', 'c:/msys/1.0/'),
		  ('/', 'c:/msys/1.0/')]
	
	def from_msys(d):
	    for src, dst in mounts:
		if d.startswith(src):
		    d = dst + d[len(src):]
		    break
	    d = d.replace('/', '\\')
	    return d
	
	inc_dirs = map(from_msys, inc_dirs)
	lib_dirs = map(from_msys, lib_dirs)

Cygwin has the "cygpath" utility for this, but I couldn't find
anything similar for MSys.

3. Python.h defines HAVE_PUTENV and HAVE_FTIME, which causes the
preprocessor to emit "... redefined" warnings. These are only
warnings, but AC_CHECK_HEADERS fails if anything is written to stderr.

4. setup.py doesn't consider enough variables, e.g. CPPFLAGS and
INCLUDE_DIRS aren't used. But then the whole thing with trying to
parse the *.make files is broken (e.g. "make ... VAR=val" doesn't
work).

5. The definition of PACKAGE needs the backslashes, i.e.:

	macros = [('PACKAGE', '\\"grasslibs\\"')]

(but this might break other platforms).

BTW, vdigit uses _(...) but doesn't include glocale.h, so this will
use wxWidgets' _(...) macro from <wx/intl.h>, not GRASS'.

6. A couple of minor bugs:

vdigit/digit.cpp expects _CPPRTTI to be defined if _WIN32 is defined,
but this should only be done for MSVC.

vdigit/driver.cpp uses getpid() but doesn't include <unistd.h>.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list