WinGRASS 6 Current Status

From GRASS-Wiki
Jump to navigation Jump to search

This page describes the current status of winGRASS development:

  • Precompiled winGRASS/Cygwin packages are available here,
  • native winGRASS packages are here.

Current status - Summary

The native windows port of GRASS is slowly coming to a stage where it can be considered beta status. All main functions seem to work, but much more testing is needed. The port is of the current cvs branch GRASS 6.3. There are no ports of earlier versions.

The general idea is to reach a point where GRASS runs in Windows without any kind of unix emulation. Currently, this is possible, but limits the use to compiled modules as scripts are all of unix-shell type and cannot run within a Windows cmd.exe environment without a series of unix tools such as a shell, awk, sed, etc. So in order to run such scripts a collection of unix-like tools needs to be installed, such as Msys or Gnuwin32+Shell.

Another major feature not available in the windows version are the old-style interactive X monitors (opened with 'd.mon x0'). Display is thus "limited" to the Tcl/Tk and wxPython GUIs (i.e. the PNG, PS, Cairo, etc. monitors) and modules like i.points and d.zoom will not work.

Installing binary snapshots

Regular binary snapshots for windows are available here. To install them, just download and unzip. In order to be able to use the graphical user interface, you also have to download and install ActiveState Tcl.

You can then launch the GRASS GUI by clicking on the grass63.bat which is in c:\grass\bin\ (or wherever you unzipped the package). This should launch the GUI which gives you access to all GRASS modules.

If you like the command line, you can launch Windows' cmd.exe via Start->Run->cmd.exe. Then type 'c:\grass\bin\grass63.bat -text' to launch grass without the GUI. If you want to access the GUI at a later stage, just type 'gis.m'.

If you want to have access to shell scripts, you also have to install Msys and then adapt the grass63.bat script according to the examples in the file.

Compiling by yourself

(based on work from Paul Kelly - his message)

Requirements

  • To compile winGRASS natively, you need the following additional libraries: libpng, PROJ.4, GDAL, Zlib, XDR. They are available in a gzipped tar file (to get started quickly): http://www.stjohnspoint.co.uk/grass/ (get wingrass-extralibs.tar.gz).
  • Additionally, you need Msys & MingW (current version)
  • bison
  • flex

Decompressing bison and flex in the root msys directory should position the files in the correct directories.


Optionally:

  • Freetype
  • FFTW
  • PDCurses

TODO: is PDCurses really optionally?

Configuration and compilation

The prefix where you untar that file you will need to supply to the GRASS configure as:

     --with-includes=prefix --with-libs=prefix

Before compilation, you need to set your path in msys in order to add the path to the lib/ and bin/ directories of Paul's tarball before compiling. You might also need to edit the first few lines of the gdal-config script in the bin/ directory, to reflect the path where it is actually installed.

You also have to erase $(MANDIR) $(MANPAGES) from line 13 of man/Makefile, i.e. 'default: $(MANDIR) $(MANPAGES)' -> 'default:'.

If you get an error such as 'cannot open file `/msys/share/bison/m4sugar/m4sugar.m4': No such file or directory', one solution is to move around the msys bison installation a bit, so that m4sugar.m4 is available in the indicated path.

A working configure line is:

     ./configure --prefix=c:/grass --bindir=c:/grass/bin \
     --with-includes=/c/grass/forgrass/include \
     --with-libs=/c/grass/forgrass/lib --with-cxx --without-jpeg --without-tiff \
     --without-postgres --with-opengl=windows --without-fftw --without-x \
     --enable-x11=no --enable-shared=yes --with-tcltk-includes=/c/tcl/include \
     --with-tcltk-libs=/c/tcl/bin

Compile with make.

After compiling you should copy libxdr.dll, libproj.dll, libpng.dll, libgdal-1.dll and libz.dll.1.2.3 into the GRASS lib directory and all the GDAL and PROJ .exe files in the bin directory into the GRASS bin directory, and then you have a more or less self-contained GRASS distribution.

For the GUI, including for displaying anything, you need to install Activestate Tcl/Tk 8.4.13 (in c:\tcl).

Known Issues

See also GRASS Mailing list archives and the compilation error log here.

Won't fix (at least not immediately)

  • No monitors

This means that you cannot launch any monitor launched with d.mon (x0, PNG, PS, etc). The only way you can render directly to a file is setting GRASS_RENDER_IMMEDIATE=TRUE on the command line. But you cannot directly display to screen from the command line. This will be solved in GRASS 7 with a new rendering system and possibly via the new wxgrass GUI. So no work will probably be put into this until then.

The absence of monitors also makes impossible the use of interactif modules based on these monitors, such as:

    • i.class
    • i.ortho.photo/photo.2image
    • i.ortho.photo/photo.2target
    • i.points
    • i.vpoints

The idea is to rewrite these modules to clearly separate diplay and backend parts, so that the backend can be run on the command line or from any GUI frontend. Volunteers needed.

  • Scripts need *nix-like shell

All current GRASS scripts are written in shell language. This means they need a shell, and several related tools (awk, sed, etc), to function. This means that whoever wants to be able to run these scripts has to install a shell with these tools. Currently recommended is Msys as this is a simple install of a package containing everything which is needed.

It is planned that these scripts be rewritten in a more portable language such as Python, thus totally eliminating the need for any shell. But this will probably not happen until the python wxgrass GUI is officially declared stable, thus making Python a mandatory requirement anyhow. Volunteers needed.


ToDo

Vector modules

  • v.digit: implement as pure tcl (Glynn)
  • Vector-DB connection: This has been solved by rewriting the DB lib to make it independent of XDR (Glynn)


Raster modules

  • r.terraflow does not compile

This seems to be due to the use of the function getrusage() which is not supported under MinGW. Check this octave patch email thread.

Miscellaneous

  • metacharacter escape in "sh -c '$cmd'"
  • modules not working: r.proj (v.proj too?), r.surf.rst, v.neighbors, v.kernel, r.cost
  • Cannot open Help pages.
  • Have to add c:\mingw\bin to PATH on some systems.
    • You should have typed c:/mingw instead of c:\mingw when asked by the MinGW installer.
  • Have to type "exit" in the console to save ~/.grassrc file. Then, close gis.m to finish the session.
  • A previous installation of grass under cygwin is likely to cause problems with WinGrass. Follow the directions to remove cygwin at http://cygwin.com/faq/faq-nochunks.html#faq.setup.uninstall-all

The following items cannot be fixed in the near future:

    • can't read "_data(.gronsole.gronsole,4,donecmd)": no such element in array error
      • Can whoever put this here be more precise about this error ?

TclTk issues

  • cannot run shell scripts: only .com, .exe, .bat
    • sh -c '$cmd'
  • var=val style argument is not valid for batch files: equal sign is a separator like a space. http://support.microsoft.com/?kbid=71247 http://www.gatago.com/alt/msdos/batch/17358926.html
    • need .exe wrapper for shell scripts? grass-xterm-wrapper.exe
    • We now have .bat wrappers for each shell script, which run the shell specified by the GRASS_SH environment variable and pass the full path to the script to it
  • file command returns bad code (catch is needed): http://sources.redhat.com/ml/insight/2003-q1/msg00079.html
    • catch {file copy}
    • catch {file delete}
    • catch {file rename -force} does not work. Delete old file first: catch {file delete}; catch {file rename}
  • file redirection (>@stdout, 2>@stderr) does not work: http://wiki.tcl.tk/672
    • Worked around by using a small C-program (grocat.exe) to combine stdout and stderr
    • exec a batch file doing redirection (>&2, 2>&1)
  • no -permissions file attributes
    • catch {file attributes -permissions}

Other libraries

GDAL

  • lib/gis/OBJ.*/fmode.o is needed for any GRASS related modules.
  • modified ltmain.sh to install binary files from wrapper scripts.