[GRASS-windows] Compiling grass7 on msys/mingw?

Glynn Clements glynn at gclements.plus.com
Mon Jan 12 15:53:11 EST 2009


Colin Nielsen wrote:

> > I suspect that Python wants PYTHONPATH to use Windows syntax, e.g.
> > (untested):
> >
> > -       PYTHONPATH="$(GISBASE)/etc/python:$$PYTHONPATH" \
> > +       PYTHONPATH="$(call mkpath,$(GISBASE)/etc/python,$$PYTHONPATH)" \
> > +
> > +ifneq ($(MINGW32),)
> > +mkpath = $(shell g.dirseps -h $(1))\;$(2)
> > +else
> > +mkpath = $(1):$(2)
> > +endif
> 
> I applied this to the Html.make file and tried again. I got:

[snip]

If you apply the above as-is, you will get this error. The htmldesc=
definition needs to be a contiguous block, and the ifneq...endif block
needs to follow it.

I have attached a complete, modified Html.make file to avoid
confusion. This has at least been tested on Linux.

> I then checked the variable PYTHONPATH and found that my Arc
> installation over-wrote the PYTHONPATH variable to its own folder. I
> changed this back to /usr/local/src/grass_trunk/lib/Python and ran it
> again (with the original Html.make) and got:

>     os.execvp("g.parser", [name] + argv)
>   File "C:\MinGW\Python\lib\os.py", line 353, in execvp
>     _execvpe(file, args)
>   File "C:\MinGW\Python\lib\os.py", line 389, in _execvpe
>     func(fullname, *argrest)
> OSError: [Errno 2] No such file or directory

Ugh. I suspect os.execvp() needs "g.parser.exe" rather than
"g.parser". On Windows, only the higher-level interfaces (e.g. 
ShellExecute() or "cmd /c ...") allow the .exe (or .bat etc) extension
to be omitted.

On Windows, we might want to use subprocess.Popen(shell=True) followed
by sys.exit() instead of os.execvp().

> Before I continue with this, is this some peculiarity with my
> installation or a more general problem with grass7 on mingw/msys?

The latter.

7.0 is quite fluid, and it doesn't seem to be getting much testing on
Windows (6.x doesn't get much testing either, but then 6.x isn't being
substantially rewritten).

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

-------------- next part --------------

# generic html rules for all commands

ifdef CROSS_COMPILING

html:

else

htmldesc = \
	GISRC=$(RUN_GISRC) \
	GISBASE=$(RUN_GISBASE) \
	PATH="$(BIN):$$PATH" \
	PYTHONPATH="$(call mkpath,$(GISBASE)/etc/python,$$PYTHONPATH)" \
	$(LD_LIBRARY_PATH_VAR)="$(BIN):$(ARCH_LIBDIR):$($(LD_LIBRARY_PATH_VAR))" \
	LC_ALL=C \
	$(1) --html-description < /dev/null | grep -v '</body>\|</html>' > $(2)

ifneq ($(MINGW32),)
mkpath = $(shell g.dirseps -h $(1))\;$(2)
else
mkpath = $(1):$(2)
endif

$(HTMLDIR)/%.html: %.html %.tmp.html $(HTMLSRC)
	-test -d $(HTMLDIR) || $(MKDIR) $(HTMLDIR)
	$(MODULE_TOPDIR)/tools/mkhtml.sh $* > $@
	-for file in  *.png *.jpg ; do \
		head -n 1 $$file | grep '^\#!' > /dev/null ; \
		if [ $$? -ne 0 ] ; then \
		   $(INSTALL_DATA) $$file $(HTMLDIR) ; \
		fi \
		done 2> /dev/null ; true

$(MANDIR)/%.$(MANSECT): $(HTMLDIR)/%.html
	$(HTML2MAN) $< $@

%.tmp.html: $(HTMLSRC)
	if [ "$(HTMLSRC)" != "" ] ; then $(call htmldesc,$<,$@) ; fi

html: $(HTMLDIR)/$(PGM).html $(MANDIR)/$(PGM).$(MANSECT)

endif

.PHONY: html


More information about the grass-windows mailing list